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" | |
12 #include "content/public/test/browser_test_utils.h" | 11 #include "content/public/test/browser_test_utils.h" |
13 #include "content/public/test/content_browser_test_utils.h" | 12 #include "content/public/test/content_browser_test_utils.h" |
14 #include "media/base/media_switches.h" | 13 #include "media/base/media_switches.h" |
15 | 14 |
16 namespace { | 15 namespace { |
17 | 16 |
18 static const char kMediaRecorderHtmlFile[] = "/media/mediarecorder_test.html"; | 17 static const char kMediaRecorderHtmlFile[] = "/media/mediarecorder_test.html"; |
19 | 18 |
20 static struct EncodingParameters { | 19 static struct EncodingParameters { |
21 bool disable_accelerator; | 20 bool disable_accelerator; |
22 std::string mime_type; | 21 std::string mime_type; |
23 } const kEncodingParameters[] = { | 22 } const kEncodingParameters[] = { |
24 {true, "video/webm;codecs=VP8"}, | 23 {true, "video/webm;codecs=VP8"}, |
25 {true, "video/webm;codecs=VP9"}, | 24 {true, "video/webm;codecs=VP9"}, |
26 #if BUILDFLAG(RTC_USE_H264) | |
27 {true, "video/x-matroska;codecs=AVC1"}, | 25 {true, "video/x-matroska;codecs=AVC1"}, |
28 #endif | |
29 {false, ""}, // Instructs the platform to choose any accelerated codec. | 26 {false, ""}, // Instructs the platform to choose any accelerated codec. |
30 {false, "video/webm;codecs=VP8"}, | 27 {false, "video/webm;codecs=VP8"}, |
31 {false, "video/webm;codecs=VP9"}, | 28 {false, "video/webm;codecs=VP9"}, |
32 {false, "video/x-matroska;codecs=AVC1"}, | 29 {false, "video/x-matroska;codecs=AVC1"}, |
33 }; | 30 }; |
34 | 31 |
35 } // namespace | 32 } // namespace |
36 | 33 |
37 namespace content { | 34 namespace content { |
38 | 35 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 | 118 |
122 IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest, IllegalPauseThrowsDOMError) { | 119 IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest, IllegalPauseThrowsDOMError) { |
123 MakeTypicalCall("testIllegalPauseThrowsDOMError();", kMediaRecorderHtmlFile); | 120 MakeTypicalCall("testIllegalPauseThrowsDOMError();", kMediaRecorderHtmlFile); |
124 } | 121 } |
125 | 122 |
126 IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest, TwoChannelAudioRecording) { | 123 IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest, TwoChannelAudioRecording) { |
127 MakeTypicalCall("testTwoChannelAudio();", kMediaRecorderHtmlFile); | 124 MakeTypicalCall("testTwoChannelAudio();", kMediaRecorderHtmlFile); |
128 } | 125 } |
129 | 126 |
130 IN_PROC_BROWSER_TEST_P(WebRtcMediaRecorderTest, RecordWithTransparency) { | 127 IN_PROC_BROWSER_TEST_P(WebRtcMediaRecorderTest, RecordWithTransparency) { |
131 // Alpha channel is only supported in "video/webm;codecs={vp8/vp9}" cases. | |
132 if (GetParam().mime_type.find("video/webm") == std::string::npos) | |
133 return; | |
134 | |
135 MaybeForceDisableEncodeAccelerator(GetParam().disable_accelerator); | 128 MaybeForceDisableEncodeAccelerator(GetParam().disable_accelerator); |
136 MakeTypicalCall(base::StringPrintf("testRecordWithTransparency(\"%s\");", | 129 MakeTypicalCall(base::StringPrintf("testRecordWithTransparency(\"%s\");", |
137 GetParam().mime_type.c_str()), | 130 GetParam().mime_type.c_str()), |
138 kMediaRecorderHtmlFile); | 131 kMediaRecorderHtmlFile); |
139 } | 132 } |
140 | 133 |
141 IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest, IllegalStopThrowsDOMError) { | 134 IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest, IllegalStopThrowsDOMError) { |
142 MakeTypicalCall("testIllegalStopThrowsDOMError();", kMediaRecorderHtmlFile); | 135 MakeTypicalCall("testIllegalStopThrowsDOMError();", kMediaRecorderHtmlFile); |
143 } | 136 } |
144 | 137 |
145 IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest, | 138 IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest, |
146 IllegalStartWhileRecordingThrowsDOMError) { | 139 IllegalStartWhileRecordingThrowsDOMError) { |
147 MakeTypicalCall("testIllegalStartInRecordingStateThrowsDOMError();", | 140 MakeTypicalCall("testIllegalStartInRecordingStateThrowsDOMError();", |
148 kMediaRecorderHtmlFile); | 141 kMediaRecorderHtmlFile); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 RemovingTrackFromMediaStreamFiresErrorEvent) { | 184 RemovingTrackFromMediaStreamFiresErrorEvent) { |
192 MakeTypicalCall("testRemovingTrackFromMediaStreamFiresErrorEvent();", | 185 MakeTypicalCall("testRemovingTrackFromMediaStreamFiresErrorEvent();", |
193 kMediaRecorderHtmlFile); | 186 kMediaRecorderHtmlFile); |
194 } | 187 } |
195 | 188 |
196 INSTANTIATE_TEST_CASE_P(, | 189 INSTANTIATE_TEST_CASE_P(, |
197 WebRtcMediaRecorderTest, | 190 WebRtcMediaRecorderTest, |
198 testing::ValuesIn(kEncodingParameters)); | 191 testing::ValuesIn(kEncodingParameters)); |
199 | 192 |
200 } // namespace content | 193 } // namespace content |
OLD | NEW |