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/test/browser_test_utils.h" | 11 #include "content/public/test/browser_test_utils.h" |
12 #include "content/public/test/content_browser_test_utils.h" | 12 #include "content/public/test/content_browser_test_utils.h" |
13 #include "media/base/media_switches.h" | 13 #include "media/base/media_switches.h" |
14 | 14 |
15 namespace { | 15 namespace { |
16 | 16 |
17 static const char kMediaRecorderHtmlFile[] = "/media/mediarecorder_test.html"; | 17 static const char kMediaRecorderHtmlFile[] = "/media/mediarecorder_test.html"; |
18 | 18 |
19 static struct EncodingParameters { | 19 static struct EncodingParameters { |
20 bool disable_accelerator; | 20 bool disable_accelerator; |
21 std::string video_codec; | 21 std::string mime_type; |
22 } const kEncodingParameters[] = { | 22 } const kEncodingParameters[] = { |
23 {true, "VP8"}, {true, "VP9"}, {true, "H264"}, | 23 {true, "video/webm;codecs=VP8"}, {true, "video/webm;codecs=VP9"}, |
24 {false, "VP8"}, {false, "VP9"}, {false, "H264"}, | 24 {true, "video/webm;codecs=avc1"}, {true, "video/x-matroska;codecs=AVC1"}, |
| 25 {false, "video/webm;codecs=VP8"}, {false, "video/webm;codecs=VP9"}, |
| 26 {false, "video/webm;codecs=H264"}, |
25 }; | 27 }; |
26 | 28 |
27 } // namespace | 29 } // namespace |
28 | 30 |
29 namespace content { | 31 namespace content { |
30 | 32 |
31 // This class tests the recording of a media stream. | 33 // This class tests the recording of a media stream. |
32 class WebRtcMediaRecorderTest | 34 class WebRtcMediaRecorderTest |
33 : public WebRtcContentBrowserTestBase, | 35 : public WebRtcContentBrowserTestBase, |
34 public testing::WithParamInterface<struct EncodingParameters> { | 36 public testing::WithParamInterface<struct EncodingParameters> { |
(...skipping 29 matching lines...) Expand all Loading... |
64 MakeTypicalCall("testStartAndRecorderState();", kMediaRecorderHtmlFile); | 66 MakeTypicalCall("testStartAndRecorderState();", kMediaRecorderHtmlFile); |
65 } | 67 } |
66 | 68 |
67 IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest, StartAndStop) { | 69 IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest, StartAndStop) { |
68 MakeTypicalCall("testStartStopAndRecorderState();", kMediaRecorderHtmlFile); | 70 MakeTypicalCall("testStartStopAndRecorderState();", kMediaRecorderHtmlFile); |
69 } | 71 } |
70 | 72 |
71 IN_PROC_BROWSER_TEST_P(WebRtcMediaRecorderTest, StartAndDataAvailable) { | 73 IN_PROC_BROWSER_TEST_P(WebRtcMediaRecorderTest, StartAndDataAvailable) { |
72 MaybeForceDisableEncodeAccelerator(GetParam().disable_accelerator); | 74 MaybeForceDisableEncodeAccelerator(GetParam().disable_accelerator); |
73 MakeTypicalCall(base::StringPrintf("testStartAndDataAvailable(\"%s\");", | 75 MakeTypicalCall(base::StringPrintf("testStartAndDataAvailable(\"%s\");", |
74 GetParam().video_codec.c_str()), | 76 GetParam().mime_type.c_str()), |
75 kMediaRecorderHtmlFile); | 77 kMediaRecorderHtmlFile); |
76 } | 78 } |
77 | 79 |
78 IN_PROC_BROWSER_TEST_P(WebRtcMediaRecorderTest, StartWithTimeSlice) { | 80 IN_PROC_BROWSER_TEST_P(WebRtcMediaRecorderTest, StartWithTimeSlice) { |
79 MaybeForceDisableEncodeAccelerator(GetParam().disable_accelerator); | 81 MaybeForceDisableEncodeAccelerator(GetParam().disable_accelerator); |
80 MakeTypicalCall(base::StringPrintf("testStartWithTimeSlice(\"%s\");", | 82 MakeTypicalCall(base::StringPrintf("testStartWithTimeSlice(\"%s\");", |
81 GetParam().video_codec.c_str()), | 83 GetParam().mime_type.c_str()), |
82 kMediaRecorderHtmlFile); | 84 kMediaRecorderHtmlFile); |
83 } | 85 } |
84 | 86 |
85 IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest, Resume) { | 87 IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest, Resume) { |
86 MakeTypicalCall("testResumeAndRecorderState();", kMediaRecorderHtmlFile); | 88 MakeTypicalCall("testResumeAndRecorderState();", kMediaRecorderHtmlFile); |
87 } | 89 } |
88 | 90 |
89 IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest, NoResumeWhenRecorderInactive) { | 91 IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest, NoResumeWhenRecorderInactive) { |
90 MakeTypicalCall("testIllegalResumeThrowsDOMError();", kMediaRecorderHtmlFile); | 92 MakeTypicalCall("testIllegalResumeThrowsDOMError();", kMediaRecorderHtmlFile); |
91 } | 93 } |
92 | 94 |
93 IN_PROC_BROWSER_TEST_P(WebRtcMediaRecorderTest, ResumeAndDataAvailable) { | 95 IN_PROC_BROWSER_TEST_P(WebRtcMediaRecorderTest, ResumeAndDataAvailable) { |
94 MaybeForceDisableEncodeAccelerator(GetParam().disable_accelerator); | 96 MaybeForceDisableEncodeAccelerator(GetParam().disable_accelerator); |
95 MakeTypicalCall(base::StringPrintf("testResumeAndDataAvailable(\"%s\");", | 97 MakeTypicalCall(base::StringPrintf("testResumeAndDataAvailable(\"%s\");", |
96 GetParam().video_codec.c_str()), | 98 GetParam().mime_type.c_str()), |
97 kMediaRecorderHtmlFile); | 99 kMediaRecorderHtmlFile); |
98 } | 100 } |
99 | 101 |
100 IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest, Pause) { | 102 IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest, Pause) { |
101 MakeTypicalCall("testPauseAndRecorderState();", kMediaRecorderHtmlFile); | 103 MakeTypicalCall("testPauseAndRecorderState();", kMediaRecorderHtmlFile); |
102 } | 104 } |
103 | 105 |
104 IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest, PauseStop) { | 106 IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest, PauseStop) { |
105 MakeTypicalCall("testPauseStopAndRecorderState();", kMediaRecorderHtmlFile); | 107 MakeTypicalCall("testPauseStopAndRecorderState();", kMediaRecorderHtmlFile); |
106 } | 108 } |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 | 145 |
144 // http://crbug.com/673126, flaky on Android. | 146 // http://crbug.com/673126, flaky on Android. |
145 #if defined(OS_ANDROID) | 147 #if defined(OS_ANDROID) |
146 #define MAYBE_PeerConnection DISABLED_PeerConnection | 148 #define MAYBE_PeerConnection DISABLED_PeerConnection |
147 #else | 149 #else |
148 #define MAYBE_PeerConnection PeerConnection | 150 #define MAYBE_PeerConnection PeerConnection |
149 #endif | 151 #endif |
150 IN_PROC_BROWSER_TEST_P(WebRtcMediaRecorderTest, MAYBE_PeerConnection) { | 152 IN_PROC_BROWSER_TEST_P(WebRtcMediaRecorderTest, MAYBE_PeerConnection) { |
151 MaybeForceDisableEncodeAccelerator(GetParam().disable_accelerator); | 153 MaybeForceDisableEncodeAccelerator(GetParam().disable_accelerator); |
152 MakeTypicalCall(base::StringPrintf("testRecordRemotePeerConnection(\"%s\");", | 154 MakeTypicalCall(base::StringPrintf("testRecordRemotePeerConnection(\"%s\");", |
153 GetParam().video_codec.c_str()), | 155 GetParam().mime_type.c_str()), |
154 kMediaRecorderHtmlFile); | 156 kMediaRecorderHtmlFile); |
155 } | 157 } |
156 | 158 |
157 IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest, | 159 IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest, |
158 AddingTrackToMediaStreamFiresErrorEvent) { | 160 AddingTrackToMediaStreamFiresErrorEvent) { |
159 MakeTypicalCall("testAddingTrackToMediaStreamFiresErrorEvent();", | 161 MakeTypicalCall("testAddingTrackToMediaStreamFiresErrorEvent();", |
160 kMediaRecorderHtmlFile); | 162 kMediaRecorderHtmlFile); |
161 } | 163 } |
162 | 164 |
163 IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest, | 165 IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest, |
164 RemovingTrackFromMediaStreamFiresErrorEvent) { | 166 RemovingTrackFromMediaStreamFiresErrorEvent) { |
165 MakeTypicalCall("testRemovingTrackFromMediaStreamFiresErrorEvent();", | 167 MakeTypicalCall("testRemovingTrackFromMediaStreamFiresErrorEvent();", |
166 kMediaRecorderHtmlFile); | 168 kMediaRecorderHtmlFile); |
167 } | 169 } |
168 | 170 |
169 INSTANTIATE_TEST_CASE_P(, | 171 INSTANTIATE_TEST_CASE_P(, |
170 WebRtcMediaRecorderTest, | 172 WebRtcMediaRecorderTest, |
171 testing::ValuesIn(kEncodingParameters)); | 173 testing::ValuesIn(kEncodingParameters)); |
172 | 174 |
173 } // namespace content | 175 } // namespace content |
OLD | NEW |