| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2016 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2016 The WebRTC Project Authors. All rights reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| 11 package org.webrtc; | 11 package org.webrtc; |
| 12 | 12 |
| 13 import android.test.InstrumentationTestCase; | 13 import static org.junit.Assert.assertEquals; |
| 14 import android.test.suitebuilder.annotation.SmallTest; | |
| 15 | 14 |
| 15 import android.support.test.filters.SmallTest; |
| 16 import java.io.File; | 16 import java.io.File; |
| 17 import java.io.IOException; | 17 import java.io.IOException; |
| 18 import java.io.RandomAccessFile; | 18 import java.io.RandomAccessFile; |
| 19 import java.lang.Thread; | 19 import java.lang.Thread; |
| 20 import java.nio.ByteBuffer; |
| 20 import java.nio.charset.StandardCharsets; | 21 import java.nio.charset.StandardCharsets; |
| 21 import java.nio.ByteBuffer; | |
| 22 import java.util.ArrayList; | 22 import java.util.ArrayList; |
| 23 import java.util.Random; | 23 import java.util.Random; |
| 24 import org.chromium.base.test.BaseJUnit4ClassRunner; |
| 25 import org.junit.Test; |
| 26 import org.junit.runner.RunWith; |
| 24 | 27 |
| 25 public class VideoFileRendererTest extends InstrumentationTestCase { | 28 @RunWith(BaseJUnit4ClassRunner.class) |
| 29 public class VideoFileRendererTest { |
| 30 @Test |
| 26 @SmallTest | 31 @SmallTest |
| 27 public void testYuvRenderingToFile() throws InterruptedException, IOException
{ | 32 public void testYuvRenderingToFile() throws InterruptedException, IOException
{ |
| 28 EglBase eglBase = EglBase.create(); | 33 EglBase eglBase = EglBase.create(); |
| 29 final String videoOutPath = "/sdcard/chromium_tests_root/testvideoout.y4m"; | 34 final String videoOutPath = "/sdcard/chromium_tests_root/testvideoout.y4m"; |
| 30 int frameWidth = 4; | 35 int frameWidth = 4; |
| 31 int frameHeight = 4; | 36 int frameHeight = 4; |
| 32 VideoFileRenderer videoFileRenderer = | 37 VideoFileRenderer videoFileRenderer = |
| 33 new VideoFileRenderer(videoOutPath, frameWidth, frameHeight, eglBase.get
EglBaseContext()); | 38 new VideoFileRenderer(videoOutPath, frameWidth, frameHeight, eglBase.get
EglBaseContext()); |
| 34 | 39 |
| 35 String[] frames = { | 40 String[] frames = { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 + "THE SECOND FRAME qwerty.FRAME\n" | 74 + "THE SECOND FRAME qwerty.FRAME\n" |
| 70 + "HERE IS THE THRID FRAME!"; | 75 + "HERE IS THE THRID FRAME!"; |
| 71 assertEquals(expected, fileContent); | 76 assertEquals(expected, fileContent); |
| 72 } finally { | 77 } finally { |
| 73 writtenFile.close(); | 78 writtenFile.close(); |
| 74 } | 79 } |
| 75 | 80 |
| 76 new File(videoOutPath).delete(); | 81 new File(videoOutPath).delete(); |
| 77 } | 82 } |
| 78 } | 83 } |
| OLD | NEW |