Chromium Code Reviews| 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" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 46 | 46 |
| 47 AppendUseFakeUIForMediaStreamFlag(); | 47 AppendUseFakeUIForMediaStreamFlag(); |
| 48 | 48 |
| 49 base::CommandLine::ForCurrentProcess()->AppendSwitch( | 49 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| 50 switches::kUseFakeDeviceForMediaStream); | 50 switches::kUseFakeDeviceForMediaStream); |
| 51 | 51 |
| 52 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( | 52 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( |
| 53 switches::kEnableBlinkFeatures, "GetUserMedia"); | 53 switches::kEnableBlinkFeatures, "GetUserMedia"); |
| 54 } | 54 } |
| 55 | 55 |
| 56 void MaybeForceDisableEncodeAccelerator(bool disable) { | 56 void MaybeForceDisableEncodeAccelerator(bool disable, std::string mime_type) { |
| 57 if (!disable) | 57 if (!disable) |
| 58 return; | 58 return; |
| 59 | |
| 60 bool disable_flag = true; | |
| 61 #if defined(OS_ANDROID) | |
| 62 // There is no SW H264 on Android. | |
|
emircan
2017/04/07 17:33:04
// OpenH264 encoder is not supported on Android.
braveyao
2017/04/08 00:56:26
Done.
| |
| 63 if (mime_type.find("AVC1")) | |
| 64 disable_flag = false; | |
| 65 #endif | |
| 66 | |
| 59 // This flag is also used for encoding, https://crbug.com/616640. | 67 // This flag is also used for encoding, https://crbug.com/616640. |
| 60 base::CommandLine::ForCurrentProcess()->AppendSwitch( | 68 if (disable_flag) |
|
emircan
2017/04/07 17:33:04
How was this test running and passing on android b
braveyao
2017/04/08 00:56:26
Done.
| |
| 61 switches::kDisableAcceleratedVideoDecode); | 69 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| 70 switches::kDisableAcceleratedVideoDecode); | |
| 62 } | 71 } |
| 63 | 72 |
| 64 private: | 73 private: |
| 65 DISALLOW_COPY_AND_ASSIGN(WebRtcMediaRecorderTest); | 74 DISALLOW_COPY_AND_ASSIGN(WebRtcMediaRecorderTest); |
| 66 }; | 75 }; |
| 67 | 76 |
| 68 IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest, Start) { | 77 IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest, Start) { |
| 69 MakeTypicalCall("testStartAndRecorderState();", kMediaRecorderHtmlFile); | 78 MakeTypicalCall("testStartAndRecorderState();", kMediaRecorderHtmlFile); |
| 70 } | 79 } |
| 71 | 80 |
| 72 IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest, StartAndStop) { | 81 IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest, StartAndStop) { |
| 73 MakeTypicalCall("testStartStopAndRecorderState();", kMediaRecorderHtmlFile); | 82 MakeTypicalCall("testStartStopAndRecorderState();", kMediaRecorderHtmlFile); |
| 74 } | 83 } |
| 75 | 84 |
| 76 IN_PROC_BROWSER_TEST_P(WebRtcMediaRecorderTest, StartAndDataAvailable) { | 85 IN_PROC_BROWSER_TEST_P(WebRtcMediaRecorderTest, StartAndDataAvailable) { |
| 77 MaybeForceDisableEncodeAccelerator(GetParam().disable_accelerator); | 86 MaybeForceDisableEncodeAccelerator(GetParam().disable_accelerator, |
| 87 GetParam().mime_type); | |
| 78 MakeTypicalCall(base::StringPrintf("testStartAndDataAvailable(\"%s\");", | 88 MakeTypicalCall(base::StringPrintf("testStartAndDataAvailable(\"%s\");", |
| 79 GetParam().mime_type.c_str()), | 89 GetParam().mime_type.c_str()), |
| 80 kMediaRecorderHtmlFile); | 90 kMediaRecorderHtmlFile); |
| 81 } | 91 } |
| 82 | 92 |
| 83 IN_PROC_BROWSER_TEST_P(WebRtcMediaRecorderTest, StartWithTimeSlice) { | 93 IN_PROC_BROWSER_TEST_P(WebRtcMediaRecorderTest, StartWithTimeSlice) { |
| 84 MaybeForceDisableEncodeAccelerator(GetParam().disable_accelerator); | 94 MaybeForceDisableEncodeAccelerator(GetParam().disable_accelerator, |
| 95 GetParam().mime_type); | |
| 85 MakeTypicalCall(base::StringPrintf("testStartWithTimeSlice(\"%s\");", | 96 MakeTypicalCall(base::StringPrintf("testStartWithTimeSlice(\"%s\");", |
| 86 GetParam().mime_type.c_str()), | 97 GetParam().mime_type.c_str()), |
| 87 kMediaRecorderHtmlFile); | 98 kMediaRecorderHtmlFile); |
| 88 } | 99 } |
| 89 | 100 |
| 90 IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest, Resume) { | 101 IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest, Resume) { |
| 91 MakeTypicalCall("testResumeAndRecorderState();", kMediaRecorderHtmlFile); | 102 MakeTypicalCall("testResumeAndRecorderState();", kMediaRecorderHtmlFile); |
| 92 } | 103 } |
| 93 | 104 |
| 94 IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest, NoResumeWhenRecorderInactive) { | 105 IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest, NoResumeWhenRecorderInactive) { |
| 95 MakeTypicalCall("testIllegalResumeThrowsDOMError();", kMediaRecorderHtmlFile); | 106 MakeTypicalCall("testIllegalResumeThrowsDOMError();", kMediaRecorderHtmlFile); |
| 96 } | 107 } |
| 97 | 108 |
| 98 IN_PROC_BROWSER_TEST_P(WebRtcMediaRecorderTest, ResumeAndDataAvailable) { | 109 IN_PROC_BROWSER_TEST_P(WebRtcMediaRecorderTest, ResumeAndDataAvailable) { |
| 99 MaybeForceDisableEncodeAccelerator(GetParam().disable_accelerator); | 110 MaybeForceDisableEncodeAccelerator(GetParam().disable_accelerator, |
| 111 GetParam().mime_type); | |
| 100 MakeTypicalCall(base::StringPrintf("testResumeAndDataAvailable(\"%s\");", | 112 MakeTypicalCall(base::StringPrintf("testResumeAndDataAvailable(\"%s\");", |
| 101 GetParam().mime_type.c_str()), | 113 GetParam().mime_type.c_str()), |
| 102 kMediaRecorderHtmlFile); | 114 kMediaRecorderHtmlFile); |
| 103 } | 115 } |
| 104 | 116 |
| 105 IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest, Pause) { | 117 IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest, Pause) { |
| 106 MakeTypicalCall("testPauseAndRecorderState();", kMediaRecorderHtmlFile); | 118 MakeTypicalCall("testPauseAndRecorderState();", kMediaRecorderHtmlFile); |
| 107 } | 119 } |
| 108 | 120 |
| 109 IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest, PauseStop) { | 121 IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest, PauseStop) { |
| 110 MakeTypicalCall("testPauseStopAndRecorderState();", kMediaRecorderHtmlFile); | 122 MakeTypicalCall("testPauseStopAndRecorderState();", kMediaRecorderHtmlFile); |
| 111 } | 123 } |
| 112 | 124 |
| 113 IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest, | 125 IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest, |
| 114 PausePreventsDataavailableFromBeingFired) { | 126 PausePreventsDataavailableFromBeingFired) { |
| 115 MakeTypicalCall("testPausePreventsDataavailableFromBeingFired();", | 127 MakeTypicalCall("testPausePreventsDataavailableFromBeingFired();", |
| 116 kMediaRecorderHtmlFile); | 128 kMediaRecorderHtmlFile); |
| 117 } | 129 } |
| 118 | 130 |
| 119 IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest, IllegalPauseThrowsDOMError) { | 131 IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest, IllegalPauseThrowsDOMError) { |
| 120 MakeTypicalCall("testIllegalPauseThrowsDOMError();", kMediaRecorderHtmlFile); | 132 MakeTypicalCall("testIllegalPauseThrowsDOMError();", kMediaRecorderHtmlFile); |
| 121 } | 133 } |
| 122 | 134 |
| 123 IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest, TwoChannelAudioRecording) { | 135 IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest, TwoChannelAudioRecording) { |
| 124 MakeTypicalCall("testTwoChannelAudio();", kMediaRecorderHtmlFile); | 136 MakeTypicalCall("testTwoChannelAudio();", kMediaRecorderHtmlFile); |
| 125 } | 137 } |
| 138 #if defined(OS_ANDROID) | |
| 139 // Basically HW codec is preferred on Android, which doesn't support alpha | |
| 140 // channel. And this test doesn't work on some old platforms. | |
|
emircan
2017/04/07 17:33:04
This test only inputs alpha channel video for reco
braveyao
2017/04/08 00:56:26
Emmm you are right. The failure of this case on N5
braveyao
2017/04/14 22:28:28
Done.
| |
| 141 #define MAYBE_RecordWithTransparency DISABLED_RecordWithTransparency | |
| 142 #else | |
| 143 #define MAYBE_RecordWithTransparency RecordWithTransparency | |
| 144 #endif | |
| 126 | 145 |
| 127 IN_PROC_BROWSER_TEST_P(WebRtcMediaRecorderTest, RecordWithTransparency) { | 146 IN_PROC_BROWSER_TEST_P(WebRtcMediaRecorderTest, MAYBE_RecordWithTransparency) { |
| 128 MaybeForceDisableEncodeAccelerator(GetParam().disable_accelerator); | 147 MaybeForceDisableEncodeAccelerator(GetParam().disable_accelerator, |
| 148 GetParam().mime_type); | |
| 129 MakeTypicalCall(base::StringPrintf("testRecordWithTransparency(\"%s\");", | 149 MakeTypicalCall(base::StringPrintf("testRecordWithTransparency(\"%s\");", |
| 130 GetParam().mime_type.c_str()), | 150 GetParam().mime_type.c_str()), |
| 131 kMediaRecorderHtmlFile); | 151 kMediaRecorderHtmlFile); |
| 132 } | 152 } |
| 133 | 153 |
| 134 IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest, IllegalStopThrowsDOMError) { | 154 IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest, IllegalStopThrowsDOMError) { |
| 135 MakeTypicalCall("testIllegalStopThrowsDOMError();", kMediaRecorderHtmlFile); | 155 MakeTypicalCall("testIllegalStopThrowsDOMError();", kMediaRecorderHtmlFile); |
| 136 } | 156 } |
| 137 | 157 |
| 138 IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest, | 158 IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest, |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 161 // Flaky on Linux TSan, https://crbug.com/694373. | 181 // Flaky on Linux TSan, https://crbug.com/694373. |
| 162 #define MAYBE_PeerConnection DISABLED_PeerConnection | 182 #define MAYBE_PeerConnection DISABLED_PeerConnection |
| 163 #elif defined(OS_WIN) && !defined(NDEBUG) | 183 #elif defined(OS_WIN) && !defined(NDEBUG) |
| 164 // Fails on Win7 debug, https://crbug.com/703844. | 184 // Fails on Win7 debug, https://crbug.com/703844. |
| 165 #define MAYBE_PeerConnection DISABLED_PeerConnection | 185 #define MAYBE_PeerConnection DISABLED_PeerConnection |
| 166 #else | 186 #else |
| 167 #define MAYBE_PeerConnection PeerConnection | 187 #define MAYBE_PeerConnection PeerConnection |
| 168 #endif | 188 #endif |
| 169 | 189 |
| 170 IN_PROC_BROWSER_TEST_P(WebRtcMediaRecorderTest, MAYBE_PeerConnection) { | 190 IN_PROC_BROWSER_TEST_P(WebRtcMediaRecorderTest, MAYBE_PeerConnection) { |
| 171 MaybeForceDisableEncodeAccelerator(GetParam().disable_accelerator); | 191 MaybeForceDisableEncodeAccelerator(GetParam().disable_accelerator, |
| 192 GetParam().mime_type); | |
| 172 MakeTypicalCall(base::StringPrintf("testRecordRemotePeerConnection(\"%s\");", | 193 MakeTypicalCall(base::StringPrintf("testRecordRemotePeerConnection(\"%s\");", |
| 173 GetParam().mime_type.c_str()), | 194 GetParam().mime_type.c_str()), |
| 174 kMediaRecorderHtmlFile); | 195 kMediaRecorderHtmlFile); |
| 175 } | 196 } |
| 176 | 197 |
| 177 IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest, | 198 IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest, |
| 178 AddingTrackToMediaStreamFiresErrorEvent) { | 199 AddingTrackToMediaStreamFiresErrorEvent) { |
| 179 MakeTypicalCall("testAddingTrackToMediaStreamFiresErrorEvent();", | 200 MakeTypicalCall("testAddingTrackToMediaStreamFiresErrorEvent();", |
| 180 kMediaRecorderHtmlFile); | 201 kMediaRecorderHtmlFile); |
| 181 } | 202 } |
| 182 | 203 |
| 183 IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest, | 204 IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest, |
| 184 RemovingTrackFromMediaStreamFiresErrorEvent) { | 205 RemovingTrackFromMediaStreamFiresErrorEvent) { |
| 185 MakeTypicalCall("testRemovingTrackFromMediaStreamFiresErrorEvent();", | 206 MakeTypicalCall("testRemovingTrackFromMediaStreamFiresErrorEvent();", |
| 186 kMediaRecorderHtmlFile); | 207 kMediaRecorderHtmlFile); |
| 187 } | 208 } |
| 188 | 209 |
| 189 INSTANTIATE_TEST_CASE_P(, | 210 INSTANTIATE_TEST_CASE_P(, |
| 190 WebRtcMediaRecorderTest, | 211 WebRtcMediaRecorderTest, |
| 191 testing::ValuesIn(kEncodingParameters)); | 212 testing::ValuesIn(kEncodingParameters)); |
| 192 | 213 |
| 193 } // namespace content | 214 } // namespace content |
| OLD | NEW |