本文整理汇总了Java中com.android.ddmlib.IShellOutputReceiver.flush方法的典型用法代码示例。如果您正苦于以下问题:Java IShellOutputReceiver.flush方法的具体用法?Java IShellOutputReceiver.flush怎么用?Java IShellOutputReceiver.flush使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.android.ddmlib.IShellOutputReceiver
的用法示例。
在下文中一共展示了IShellOutputReceiver.flush方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createDeviceForShellCommandTest
import com.android.ddmlib.IShellOutputReceiver; //导入方法依赖的package包/类
private TestDevice createDeviceForShellCommandTest(final String output) {
return new TestDevice() {
@Override
public void executeShellCommand(
String cmd,
IShellOutputReceiver receiver,
long timeout,
TimeUnit timeoutUnit) {
byte[] outputBytes = output.getBytes();
receiver.addOutput(outputBytes, 0, outputBytes.length);
receiver.flush();
}
};
}
示例2: createDeviceForShellCommandTest
import com.android.ddmlib.IShellOutputReceiver; //导入方法依赖的package包/类
private TestDevice createDeviceForShellCommandTest(final String output) {
return new TestDevice() {
@Override
public void executeShellCommand(
String cmd, IShellOutputReceiver receiver, long timeout, TimeUnit timeoutUnit) {
byte[] outputBytes = output.getBytes(StandardCharsets.UTF_8);
receiver.addOutput(outputBytes, 0, outputBytes.length);
receiver.flush();
}
};
}
示例3: printToOutput
import com.android.ddmlib.IShellOutputReceiver; //导入方法依赖的package包/类
private final static void printToOutput(IShellOutputReceiver receiver, String message) {
byte[] data = message.getBytes();
receiver.addOutput(data, 0, data.length);
receiver.flush();
}
示例4: executeShellCommand
import com.android.ddmlib.IShellOutputReceiver; //导入方法依赖的package包/类
@Override
public void executeShellCommand(String command, IShellOutputReceiver receiver,
long maxTimeToOutputResponse, TimeUnit maxTimeUnits)
throws TimeoutException, AdbCommandRejectedException, ShellCommandUnresponsiveException,
IOException {
System.out.println(String.format("EXECSHELL(%S) CALLED", name));
// now fake out some tests result to make the test runner happy.
addLineToReceiver("INSTRUMENTATION_STATUS: numtests=2\r\n", receiver);
addLineToReceiver("INSTRUMENTATION_STATUS: numtests=2\r\n", receiver);
addLineToReceiver("INSTRUMENTATION_STATUS: stream=\r\n", receiver);
addLineToReceiver("com.android.tests.basic.MainTest:\r\n", receiver);
addLineToReceiver("INSTRUMENTATION_STATUS: id=InstrumentationTestRunner\r\n", receiver);
addLineToReceiver("INSTRUMENTATION_STATUS: test=testBuildConfig\r\n", receiver);
addLineToReceiver("INSTRUMENTATION_STATUS: class=com.android.tests.basic.MainTest\r\n", receiver);
addLineToReceiver("INSTRUMENTATION_STATUS: current=1\r\n", receiver);
addLineToReceiver("INSTRUMENTATION_STATUS_CODE: 1\r\n", receiver);
addLineToReceiver("INSTRUMENTATION_STATUS: numtests=2\r\n", receiver);
addLineToReceiver("INSTRUMENTATION_STATUS: stream=.\r\n", receiver);
addLineToReceiver("INSTRUMENTATION_STATUS: id=InstrumentationTestRunner\r\n", receiver);
addLineToReceiver("INSTRUMENTATION_STATUS: test=testBuildConfig\r\n", receiver);
addLineToReceiver("INSTRUMENTATION_STATUS: class=com.android.tests.basic.MainTest\r\n", receiver);
addLineToReceiver("INSTRUMENTATION_STATUS: current=1\r\n", receiver);
addLineToReceiver("INSTRUMENTATION_STATUS_CODE: 0\r\n", receiver);
addLineToReceiver("INSTRUMENTATION_STATUS: numtests=2\r\n", receiver);
addLineToReceiver("INSTRUMENTATION_STATUS: stream=\r\n", receiver);
addLineToReceiver("INSTRUMENTATION_STATUS: id=InstrumentationTestRunner\r\n", receiver);
addLineToReceiver("INSTRUMENTATION_STATUS: test=testPreconditions\r\n", receiver);
addLineToReceiver("INSTRUMENTATION_STATUS: class=com.android.tests.basic.MainTest\r\n", receiver);
addLineToReceiver("INSTRUMENTATION_STATUS: current=2\r\n", receiver);
addLineToReceiver("INSTRUMENTATION_STATUS_CODE: 1\r\n", receiver);
addLineToReceiver("INSTRUMENTATION_STATUS: numtests=2\r\n", receiver);
addLineToReceiver("INSTRUMENTATION_STATUS: stream=.\r\n", receiver);
addLineToReceiver("INSTRUMENTATION_STATUS: id=InstrumentationTestRunner\r\n", receiver);
addLineToReceiver("INSTRUMENTATION_STATUS: test=testPreconditions\r\n", receiver);
addLineToReceiver("INSTRUMENTATION_STATUS: class=com.android.tests.basic.MainTest\r\n", receiver);
addLineToReceiver("INSTRUMENTATION_STATUS: current=2\r\n", receiver);
addLineToReceiver("INSTRUMENTATION_STATUS_CODE: 0\r\n", receiver);
addLineToReceiver("INSTRUMENTATION_RESULT: stream=\r\n", receiver);
addLineToReceiver("Test results for InstrumentationTestRunner=..\r\n", receiver);
addLineToReceiver("Time: 0.247\r\n", receiver);
addLineToReceiver("\r\n", receiver);
addLineToReceiver("OK (2 tests)\r\n", receiver);
receiver.flush();
execShellCalled = true;
}