当前位置: 首页>>代码示例>>Java>>正文


Java IShellOutputReceiver类代码示例

本文整理汇总了Java中com.android.ddmlib.IShellOutputReceiver的典型用法代码示例。如果您正苦于以下问题:Java IShellOutputReceiver类的具体用法?Java IShellOutputReceiver怎么用?Java IShellOutputReceiver使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IShellOutputReceiver类属于com.android.ddmlib包,在下文中一共展示了IShellOutputReceiver类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testRun_ioException

import com.android.ddmlib.IShellOutputReceiver; //导入依赖的package包/类
/**
 * Test run when the device throws a IOException
 */
@SuppressWarnings("unchecked")
public void testRun_ioException() throws Exception {
    mMockDevice.executeShellCommand((String)EasyMock.anyObject(), (IShellOutputReceiver)
            EasyMock.anyObject(), EasyMock.eq(0L), EasyMock.eq(TimeUnit.MILLISECONDS));
    EasyMock.expectLastCall().andThrow(new IOException());
    // verify that the listeners run started, run failure, and run ended methods are called
    mMockListener.testRunStarted(TEST_PACKAGE, 0);
    mMockListener.testRunFailed((String)EasyMock.anyObject());
    mMockListener.testRunEnded(EasyMock.anyLong(), EasyMock.eq(Collections.EMPTY_MAP));

    EasyMock.replay(mMockDevice, mMockListener);
    try {
        mRunner.run(mMockListener);
        fail("IOException not thrown");
    } catch (IOException e) {
        // expected
    }
    EasyMock.verify(mMockDevice, mMockListener);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:RemoteAndroidTestRunnerTest.java

示例2: testDeviceStartActivityWaitForDebugger

import com.android.ddmlib.IShellOutputReceiver; //导入依赖的package包/类
@Test
public void testDeviceStartActivityWaitForDebugger() throws Exception {
  final AtomicReference<String> runDeviceCommand = new AtomicReference<>();
  TestDevice device =
      new TestDevice() {
        @Override
        public void executeShellCommand(
            String command,
            IShellOutputReceiver receiver,
            long maxTimeToOutputResponse,
            TimeUnit maxTimeUnits) {
          runDeviceCommand.set(command);
        }
      };
  assertNull(createAndroidDevice(device).deviceStartActivity("com.foo/.Activity", true));
  assertTrue(runDeviceCommand.get().contains(" -D"));
}
 
开发者ID:facebook,项目名称:buck,代码行数:18,代码来源:RealAndroidDeviceTest.java

示例3: testDeviceStartActivityDoNotWaitForDebugger

import com.android.ddmlib.IShellOutputReceiver; //导入依赖的package包/类
@Test
public void testDeviceStartActivityDoNotWaitForDebugger() throws Exception {
  final AtomicReference<String> runDeviceCommand = new AtomicReference<>();
  TestDevice device =
      new TestDevice() {
        @Override
        public void executeShellCommand(
            String command,
            IShellOutputReceiver receiver,
            long maxTimeToOutputResponse,
            TimeUnit maxTimeUnits) {
          runDeviceCommand.set(command);
        }
      };
  assertNull(createAndroidDevice(device).deviceStartActivity("com.foo/.Activity", false));
  assertFalse(runDeviceCommand.get().contains(" -D"));
}
 
开发者ID:facebook,项目名称:buck,代码行数:18,代码来源:RealAndroidDeviceTest.java

示例4: killMinicap

import com.android.ddmlib.IShellOutputReceiver; //导入依赖的package包/类
/**
 * 关闭minicap
 * 
 * @param pid
 *            进程号
 */
public static void killMinicap(final String serialNumber, final int pid) {
	logger.info(serialNumber + ":关闭minicap线程  " + pid);
	DeviceEntity deviceEntity = DeviceContainerHandler
			.getDevice(serialNumber);
	if (deviceEntity != null) {
		MinicapEntity minicapEntity = deviceEntity.getMinicapEntity();
		IDevice idevice = deviceEntity.getIdevice();

		executorService.execute(new Runnable() {
			IShellOutputReceiver receiver = new NullOutputReceiver();

			@Override
			public void run() {
				if (idevice.isOnline()) {
					try {
						idevice.executeShellCommand("exec kill " + pid,
								receiver, 3, TimeUnit.SECONDS);
					} catch (TimeoutException | AdbCommandRejectedException
							| ShellCommandUnresponsiveException
							| IOException e) {
						logger.error("关闭minicap出错", e);
					}
					minicapEntity.setStatus(Status.CLOSED);
				}
			}
		});
	}
}
 
开发者ID:GroupControlDroid,项目名称:GroupControlDroidClient,代码行数:35,代码来源:MinicapManager.java

示例5: setDebugLayoutEnabled

import com.android.ddmlib.IShellOutputReceiver; //导入依赖的package包/类
public static void setDebugLayoutEnabled(IDevice device, boolean enabled, IShellOutputReceiver iShellOutputReceiver) {
    String cmd = "setprop " + Property.DEBUG_LAYOUT_PROPERTY + " " + (enabled ? "true" : "false");
    System.out.println(cmd);
    executeShell(device, iShellOutputReceiver, cmd);
    executeShell(device, null, "am broadcast -a red.dim.updatesystemprop -n red.dim.duang/.UpdateReceiver");

}
 
开发者ID:zzz40500,项目名称:ADB-Duang,代码行数:8,代码来源:PropertyHelper.java

示例6: setShowOverdrawEnabled

import com.android.ddmlib.IShellOutputReceiver; //导入依赖的package包/类
public static void setShowOverdrawEnabled(IDevice device, boolean enabled, IShellOutputReceiver iShellOutputReceiver) {
    String cmd = "setprop " + Property.getDebugOverdrawPropertyKey(getApiLevel(device)) + " "
            + (enabled ? Property.getDebugOverdrawPropertyEnabledValue(getApiLevel(device)) : "false");
    System.out.println(cmd);
    executeShell(device, iShellOutputReceiver, cmd);
    executeShell(device, null, "am broadcast -a red.dim.updatesystemprop -n red.dim.duang/.UpdateReceiver");
}
 
开发者ID:zzz40500,项目名称:ADB-Duang,代码行数:8,代码来源:PropertyHelper.java

示例7: executeShellCommand

import com.android.ddmlib.IShellOutputReceiver; //导入依赖的package包/类
@Override
public void executeShellCommand(String arg0, IShellOutputReceiver arg1)
    throws TimeoutException,
        AdbCommandRejectedException,
        ShellCommandUnresponsiveException,
        IOException {
    // TODO Auto-generated method stub

}
 
开发者ID:MusalaSoft,项目名称:atmosphere-agent,代码行数:10,代码来源:ShellCommandExecutorTest.java

示例8: startScreenRecorder

import com.android.ddmlib.IShellOutputReceiver; //导入依赖的package包/类
@Override
public void startScreenRecorder(String remoteFilePath,
                                ScreenRecorderOptions options,
                                IShellOutputReceiver receiver)
    throws TimeoutException,
        AdbCommandRejectedException,
        IOException,
        ShellCommandUnresponsiveException {
    // TODO Auto-generated method stub

}
 
开发者ID:MusalaSoft,项目名称:atmosphere-agent,代码行数:12,代码来源:ShellCommandExecutorTest.java

示例9: answer

import com.android.ddmlib.IShellOutputReceiver; //导入依赖的package包/类
@Override
public Void answer(InvocationOnMock invocation) throws Throwable {
    Object[] args = invocation.getArguments();
    String request = (String) args[0];
    IShellOutputReceiver output = (IShellOutputReceiver) args[1];

    switch (request) {
    // device is booted check
        case "getprop init.svc.bootanim":
            printToOutput(output, "stopped\r\n");
            break;
    }
    return null;
}
 
开发者ID:MusalaSoft,项目名称:atmosphere-agent,代码行数:15,代码来源:FakeDeviceShellAnswer.java

示例10: testRegisteringUncompatibleDevice

import com.android.ddmlib.IShellOutputReceiver; //导入依赖的package包/类
@Test
public void testRegisteringUncompatibleDevice() throws Exception {
    // FIXME: This is not really an unit test
    String mockDeviceSerialNumber = "UncompatibleDevice";
    boolean mockDeviceEmulator = false;
    String mockDeviceApiNotCompatibleApiVersion = "16";

    Map<String, String> mockPropMap = new HashMap<>();
    mockPropMap.put(DevicePropertyStringConstants.PROPERTY_API_LEVEL.toString(),
                    mockDeviceApiNotCompatibleApiVersion);

    IDevice mockDevice = mock(IDevice.class);
    when(mockDevice.getSerialNumber()).thenReturn(mockDeviceSerialNumber);
    when(mockDevice.isEmulator()).thenReturn(mockDeviceEmulator);
    when(mockDevice.arePropertiesSet()).thenReturn(true);
    when(mockDevice.getProperties()).thenReturn(mockPropMap);

    FakeOnDeviceComponentAnswer onDeviceAnswer = new FakeOnDeviceComponentAnswer();
    FakeDeviceShellAnswer shellAnswer = new FakeDeviceShellAnswer();
    Mockito.doAnswer(onDeviceAnswer).when(mockDevice).createForward(anyInt(), anyInt());
    Mockito.doAnswer(shellAnswer).when(mockDevice).executeShellCommand(Matchers.anyString(),
                                                                       Matchers.any(IShellOutputReceiver.class));
    Mockito.doAnswer(shellAnswer).when(mockDevice).executeShellCommand(Matchers.anyString(),
                                                                       Matchers.any(IShellOutputReceiver.class),
                                                                       anyInt());

    assertNull("Successfully registered device with API Level lower than 17.",
               deviceManager.registerDevice(mockDevice));
}
 
开发者ID:MusalaSoft,项目名称:atmosphere-agent,代码行数:30,代码来源:DeviceCompatibilityTest.java

示例11: testRegisteringCompatibleDevice

import com.android.ddmlib.IShellOutputReceiver; //导入依赖的package包/类
@Test
public void testRegisteringCompatibleDevice() throws Exception {
    // FIXME: This is not really an unit test
    String mockDeviceSerialNumber = "CompatibleDevice";
    boolean mockDeviceEmulator = false;
    String mockDeviceApiCompatibleApiVersion = "17";

    Map<String, String> mockPropMap = new HashMap<>();
    mockPropMap.put(DevicePropertyStringConstants.PROPERTY_API_LEVEL.toString(), mockDeviceApiCompatibleApiVersion);

    IDevice mockDevice = mock(IDevice.class);
    when(mockDevice.getSerialNumber()).thenReturn(mockDeviceSerialNumber);
    when(mockDevice.getProperty(IDevice.PROP_BUILD_API_LEVEL)).thenReturn(mockDeviceApiCompatibleApiVersion);
    when(mockDevice.isEmulator()).thenReturn(mockDeviceEmulator);
    when(mockDevice.arePropertiesSet()).thenReturn(true);
    when(mockDevice.getProperties()).thenReturn(mockPropMap);

    FakeOnDeviceComponentAnswer onDeviceAnswer = new FakeOnDeviceComponentAnswer();
    FakeDeviceShellAnswer shellAnswer = new FakeDeviceShellAnswer();
    Mockito.doAnswer(onDeviceAnswer).when(mockDevice).createForward(anyInt(), anyInt());
    Mockito.doAnswer(shellAnswer).when(mockDevice).executeShellCommand(Matchers.anyString(),
                                                                       Matchers.any(IShellOutputReceiver.class));
    Mockito.doAnswer(shellAnswer).when(mockDevice).executeShellCommand(Matchers.anyString(),
                                                                       Matchers.any(IShellOutputReceiver.class),
                                                                       anyInt());

    assertEquals("The mocked device was not successfully wrapped.",
                 mockDevice.getSerialNumber(),
                 deviceManager.registerDevice(mockDevice));

    assertEquals("The mocked device is not present in Agent after it was registered.",
                 mockDevice,
                 deviceManager.getDeviceBySerialNumber(mockDeviceSerialNumber));
}
 
开发者ID:MusalaSoft,项目名称:atmosphere-agent,代码行数:35,代码来源:DeviceCompatibilityTest.java

示例12: executeShellCommand

import com.android.ddmlib.IShellOutputReceiver; //导入依赖的package包/类
@Override
public void executeShellCommand(String command, IShellOutputReceiver receiver,
                                long maxTimeToOutputResponse, TimeUnit maxTimeUnits)
                                throws TimeoutException, AdbCommandRejectedException,
                                ShellCommandUnresponsiveException, IOException {
    iDevice.executeShellCommand(command, receiver, maxTimeToOutputResponse, maxTimeUnits);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:ConnectedDevice.java

示例13: runAndVerify

import com.android.ddmlib.IShellOutputReceiver; //导入依赖的package包/类
/**
 * Calls {@link RemoteAndroidTestRunner#run(ITestRunListener...)} and verifies the given
 * <var>expectedCmd</var> pattern was received by the mock device.
 */
private void runAndVerify(String expectedCmd) throws Exception {
    mMockDevice.executeShellCommand(expectedCmd, (IShellOutputReceiver)
            EasyMock.anyObject(), EasyMock.eq(0L), EasyMock.eq(TimeUnit.MILLISECONDS));
    EasyMock.replay(mMockDevice);
    mRunner.run(mMockListener);
    EasyMock.verify(mMockDevice);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:RemoteAndroidTestRunnerTest.java

示例14: monkey

import com.android.ddmlib.IShellOutputReceiver; //导入依赖的package包/类
/**
 * Executes a monkey command on the device, and sends the result to a
 * <var>receiver</var>.
 * 
 * @param command the shell command to execute
 * @param receiver the {@link IShellOutputReceiver} that will receives the
 *            output of the shell command
 */
public boolean monkey(String command, IShellOutputReceiver receiver) {
    boolean result = false;
    try {
        mDevice.executeShellCommand(command, receiver, 60000);
        result = true;
    } catch (ShellCommandUnresponsiveException mttor) {
        result = true;
    } catch (Exception ex) {
        result = false;
    }
    return result;
}
 
开发者ID:apack1001,项目名称:Android-Monkey-Adapter,代码行数:21,代码来源:MonkeyTestDevice.java

示例15: logcat

import com.android.ddmlib.IShellOutputReceiver; //导入依赖的package包/类
/**
 * Executes a logcat command on the device, and sends the result to a
 * <var>receiver</var>.
 * 
 * @param receiver the {@link IShellOutputReceiver} that will receives the
 *            output of the shell command
 */
public boolean logcat(IShellOutputReceiver receiver) {
    boolean result = false;
    try {
        mDevice.executeShellCommand("logcat -v threadtime *:V", receiver,
                60000);
        result = true;
    } catch (ShellCommandUnresponsiveException mttor) {
        result = true;
    } catch (Exception ex) {
        result = false;
    }
    return result;
}
 
开发者ID:apack1001,项目名称:Android-Monkey-Adapter,代码行数:21,代码来源:MonkeyTestDevice.java


注:本文中的com.android.ddmlib.IShellOutputReceiver类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。