示例#1
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());
 }
示例#2
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, "");
 }
示例#3
0
  @Before
  public void setUp() {
    videoCapture = (VideoCaptureImpl) context.getBean(IVideoCapture.class);

    videoWriter = Mockito.mock(IVideoWriter.class);
    device = Mockito.mock(IDevice.class);
    threadPool = Mockito.mock(IThreadExecutor.class);
    videoCapture.setVideoWriter(videoWriter);
    videoCapture.setThreadExecutor(threadPool);
    MockitoAnnotations.initMocks(this);
  }
示例#4
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());
 }
示例#5
0
 @Test
 public void init_test_resIsNoError() throws IOException {
   videoCapture.setDevice(device);
   videoCapture.init(device, "");
 }