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 static org.junit.Assert.assertEquals; | 13 import static org.junit.Assert.assertEquals; |
14 | 14 |
| 15 import android.os.Environment; |
15 import android.support.test.filters.SmallTest; | 16 import android.support.test.filters.SmallTest; |
16 import java.io.File; | 17 import java.io.File; |
17 import java.io.IOException; | 18 import java.io.IOException; |
18 import java.io.RandomAccessFile; | 19 import java.io.RandomAccessFile; |
19 import java.lang.Thread; | 20 import java.lang.Thread; |
20 import java.nio.ByteBuffer; | 21 import java.nio.ByteBuffer; |
21 import java.nio.charset.StandardCharsets; | 22 import java.nio.charset.StandardCharsets; |
22 import java.util.ArrayList; | 23 import java.util.ArrayList; |
23 import java.util.Random; | 24 import java.util.Random; |
24 import org.chromium.base.test.BaseJUnit4ClassRunner; | 25 import org.chromium.base.test.BaseJUnit4ClassRunner; |
25 import org.junit.Test; | 26 import org.junit.Test; |
26 import org.junit.runner.RunWith; | 27 import org.junit.runner.RunWith; |
27 | 28 |
28 @RunWith(BaseJUnit4ClassRunner.class) | 29 @RunWith(BaseJUnit4ClassRunner.class) |
29 public class VideoFileRendererTest { | 30 public class VideoFileRendererTest { |
30 @Test | 31 @Test |
31 @SmallTest | 32 @SmallTest |
32 public void testYuvRenderingToFile() throws InterruptedException, IOException
{ | 33 public void testYuvRenderingToFile() throws InterruptedException, IOException
{ |
33 EglBase eglBase = EglBase.create(); | 34 EglBase eglBase = EglBase.create(); |
34 final String videoOutPath = "/sdcard/chromium_tests_root/testvideoout.y4m"; | 35 final String videoOutPath = Environment.getExternalStorageDirectory().getPat
h() |
| 36 + "/chromium_tests_root/testvideoout.y4m"; |
35 int frameWidth = 4; | 37 int frameWidth = 4; |
36 int frameHeight = 4; | 38 int frameHeight = 4; |
37 VideoFileRenderer videoFileRenderer = | 39 VideoFileRenderer videoFileRenderer = |
38 new VideoFileRenderer(videoOutPath, frameWidth, frameHeight, eglBase.get
EglBaseContext()); | 40 new VideoFileRenderer(videoOutPath, frameWidth, frameHeight, eglBase.get
EglBaseContext()); |
39 | 41 |
40 String[] frames = { | 42 String[] frames = { |
41 "THIS IS JUST SOME TEXT x", "THE SECOND FRAME qwerty.", "HERE IS THE THR
ID FRAME!"}; | 43 "THIS IS JUST SOME TEXT x", "THE SECOND FRAME qwerty.", "HERE IS THE THR
ID FRAME!"}; |
42 | 44 |
43 for (String frameStr : frames) { | 45 for (String frameStr : frames) { |
44 int[] planeSizes = { | 46 int[] planeSizes = { |
(...skipping 29 matching lines...) Expand all Loading... |
74 + "THE SECOND FRAME qwerty.FRAME\n" | 76 + "THE SECOND FRAME qwerty.FRAME\n" |
75 + "HERE IS THE THRID FRAME!"; | 77 + "HERE IS THE THRID FRAME!"; |
76 assertEquals(expected, fileContent); | 78 assertEquals(expected, fileContent); |
77 } finally { | 79 } finally { |
78 writtenFile.close(); | 80 writtenFile.close(); |
79 } | 81 } |
80 | 82 |
81 new File(videoOutPath).delete(); | 83 new File(videoOutPath).delete(); |
82 } | 84 } |
83 } | 85 } |
OLD | NEW |