コード例 #1
0
 @Test
 public void run_test2() throws TimeoutException, AdbCommandRejectedException, IOException {
   videoCapture.setDevice(device);
   RawImage testRaw = new RawImage();
   testRaw.data = imagedata;
   testRaw.width = 10;
   testRaw.height = 10;
   testRaw.bpp = 16;
   when(device.getScreenshot()).thenReturn(testRaw);
   when(videoWriter.getTimeUnits()).thenReturn((int) 1000f);
   IVideoImageSubscriber videoImageSub = mock(IVideoImageSubscriber.class);
   videoCapture.addSubscriber(videoImageSub);
   videoCapture.setDeviceManufacturer("somethingHTC");
   doAnswer(
           new Answer() {
             public Object answer(InvocationOnMock invocation) {
               ((Runnable) invocation.getArguments()[0]).run();
               videoCapture.stopRecording();
               return null;
             }
           })
       .when(threadPool)
       .execute(any(Runnable.class));
   videoCapture.run();
   assertEquals(0, videoCapture.getiExceptionCount());
   assertTrue(videoCapture.isAllDone());
 }
コード例 #2
0
 @Test
 public void run_test() throws TimeoutException, AdbCommandRejectedException, IOException {
   videoCapture.setDevice(device);
   when(device.getScreenshot()).thenThrow(new IOException());
   videoCapture.run();
   assertEquals(6, videoCapture.getiExceptionCount());
 }