OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/macros.h" | 6 #include "base/macros.h" |
7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 #include "content/browser/webrtc/webrtc_content_browsertest_base.h" | 9 #include "content/browser/webrtc/webrtc_content_browsertest_base.h" |
10 #include "content/public/common/content_switches.h" | 10 #include "content/public/common/content_switches.h" |
11 #include "content/public/common/features.h" | |
11 #include "content/public/test/browser_test_utils.h" | 12 #include "content/public/test/browser_test_utils.h" |
12 #include "content/public/test/content_browser_test_utils.h" | 13 #include "content/public/test/content_browser_test_utils.h" |
13 #include "media/base/media_switches.h" | 14 #include "media/base/media_switches.h" |
14 | 15 |
15 namespace { | 16 namespace { |
16 | 17 |
17 static const char kMediaRecorderHtmlFile[] = "/media/mediarecorder_test.html"; | 18 static const char kMediaRecorderHtmlFile[] = "/media/mediarecorder_test.html"; |
18 | 19 |
19 static struct EncodingParameters { | 20 static struct EncodingParameters { |
20 bool disable_accelerator; | 21 bool disable_accelerator; |
21 std::string mime_type; | 22 std::string mime_type; |
22 } const kEncodingParameters[] = { | 23 } const kEncodingParameters[] = { |
23 {true, "video/webm;codecs=VP8"}, | 24 {true, "video/webm;codecs=VP8"}, |
24 {true, "video/webm;codecs=VP9"}, | 25 {true, "video/webm;codecs=VP9"}, |
26 #if BUILDFLAG(RTC_USE_H264) | |
25 {true, "video/x-matroska;codecs=AVC1"}, | 27 {true, "video/x-matroska;codecs=AVC1"}, |
28 #endif | |
26 {false, ""}, // Instructs the platform to choose any accelerated codec. | 29 {false, ""}, // Instructs the platform to choose any accelerated codec. |
27 {false, "video/webm;codecs=VP8"}, | 30 {false, "video/webm;codecs=VP8"}, |
28 {false, "video/webm;codecs=VP9"}, | 31 {false, "video/webm;codecs=VP9"}, |
29 {false, "video/x-matroska;codecs=AVC1"}, | 32 {false, "video/x-matroska;codecs=AVC1"}, |
30 }; | 33 }; |
31 | 34 |
32 } // namespace | 35 } // namespace |
33 | 36 |
34 namespace content { | 37 namespace content { |
35 | 38 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
118 | 121 |
119 IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest, IllegalPauseThrowsDOMError) { | 122 IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest, IllegalPauseThrowsDOMError) { |
120 MakeTypicalCall("testIllegalPauseThrowsDOMError();", kMediaRecorderHtmlFile); | 123 MakeTypicalCall("testIllegalPauseThrowsDOMError();", kMediaRecorderHtmlFile); |
121 } | 124 } |
122 | 125 |
123 IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest, TwoChannelAudioRecording) { | 126 IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest, TwoChannelAudioRecording) { |
124 MakeTypicalCall("testTwoChannelAudio();", kMediaRecorderHtmlFile); | 127 MakeTypicalCall("testTwoChannelAudio();", kMediaRecorderHtmlFile); |
125 } | 128 } |
126 | 129 |
127 IN_PROC_BROWSER_TEST_P(WebRtcMediaRecorderTest, RecordWithTransparency) { | 130 IN_PROC_BROWSER_TEST_P(WebRtcMediaRecorderTest, RecordWithTransparency) { |
128 MaybeForceDisableEncodeAccelerator(GetParam().disable_accelerator); | 131 // Alpha channel is only supported in "video/webm;codecs={vp8/vp9}" cases. |
129 MakeTypicalCall(base::StringPrintf("testRecordWithTransparency(\"%s\");", | 132 if (GetParam().mime_type.find("video/webm") != std::string::npos) { |
mcasas
2017/04/20 22:39:47
if (GetParam().mime_type.find("video/webm") == std
| |
130 GetParam().mime_type.c_str()), | 133 MaybeForceDisableEncodeAccelerator(GetParam().disable_accelerator); |
131 kMediaRecorderHtmlFile); | 134 MakeTypicalCall(base::StringPrintf("testRecordWithTransparency(\"%s\");", |
135 GetParam().mime_type.c_str()), | |
136 kMediaRecorderHtmlFile); | |
137 } | |
132 } | 138 } |
133 | 139 |
134 IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest, IllegalStopThrowsDOMError) { | 140 IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest, IllegalStopThrowsDOMError) { |
135 MakeTypicalCall("testIllegalStopThrowsDOMError();", kMediaRecorderHtmlFile); | 141 MakeTypicalCall("testIllegalStopThrowsDOMError();", kMediaRecorderHtmlFile); |
136 } | 142 } |
137 | 143 |
138 IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest, | 144 IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest, |
139 IllegalStartWhileRecordingThrowsDOMError) { | 145 IllegalStartWhileRecordingThrowsDOMError) { |
140 MakeTypicalCall("testIllegalStartInRecordingStateThrowsDOMError();", | 146 MakeTypicalCall("testIllegalStartInRecordingStateThrowsDOMError();", |
141 kMediaRecorderHtmlFile); | 147 kMediaRecorderHtmlFile); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
184 RemovingTrackFromMediaStreamFiresErrorEvent) { | 190 RemovingTrackFromMediaStreamFiresErrorEvent) { |
185 MakeTypicalCall("testRemovingTrackFromMediaStreamFiresErrorEvent();", | 191 MakeTypicalCall("testRemovingTrackFromMediaStreamFiresErrorEvent();", |
186 kMediaRecorderHtmlFile); | 192 kMediaRecorderHtmlFile); |
187 } | 193 } |
188 | 194 |
189 INSTANTIATE_TEST_CASE_P(, | 195 INSTANTIATE_TEST_CASE_P(, |
190 WebRtcMediaRecorderTest, | 196 WebRtcMediaRecorderTest, |
191 testing::ValuesIn(kEncodingParameters)); | 197 testing::ValuesIn(kEncodingParameters)); |
192 | 198 |
193 } // namespace content | 199 } // namespace content |
OLD | NEW |