コード例 #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());
 }
コード例 #3
0
 @Test(expected = IOException.class)
 public void init_test_resIsIOException() throws IOException {
   videoCapture.setDevice(device);
   Exception e = new IOException();
   doThrow(e)
       .when(videoWriter)
       .init(any(String.class), any(VideoFormat.class), any(float.class), any(int.class));
   videoCapture.init(device, "");
 }
コード例 #4
0
 @Test
 public void init_test_resIsNoError() throws IOException {
   videoCapture.setDevice(device);
   videoCapture.init(device, "");
 }