Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(302)

Side by Side Diff: content/browser/media/webrtc/webrtc_media_recorder_browsertest.cc

Issue 2027323003: MediaRecorder: parameterise certain browsertests by video codec and/or encode accelerator (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: adding parameterisation support for enable/disable encode accelerator Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | content/test/data/media/mediarecorder_test.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "build/build_config.h" 8 #include "build/build_config.h"
8 #include "content/public/common/content_switches.h" 9 #include "content/public/common/content_switches.h"
9 #include "content/public/test/browser_test_utils.h" 10 #include "content/public/test/browser_test_utils.h"
10 #include "content/public/test/content_browser_test_utils.h" 11 #include "content/public/test/content_browser_test_utils.h"
11 #include "content/test/webrtc_content_browsertest_base.h" 12 #include "content/test/webrtc_content_browsertest_base.h"
12 #include "media/base/media_switches.h" 13 #include "media/base/media_switches.h"
13 14
14 namespace { 15 namespace {
15 16
16 static const char kMediaRecorderHtmlFile[] = "/media/mediarecorder_test.html"; 17 static const char kMediaRecorderHtmlFile[] = "/media/mediarecorder_test.html";
17 18
19 static struct EncodingParameters {
20 bool disable_accelerator;
21 std::string video_codec;
22 } const kEncodingParameters[] = {
23 {true, "VP8"}, {true, "VP9"}, {true, "H264"},
24 {false, "VP8"}, {false, "VP9"}, {false, "H264"},
25 };
26
18 } // namespace 27 } // namespace
19 28
20 namespace content { 29 namespace content {
21 30
22 // This class tests the recording of a media stream. 31 // This class tests the recording of a media stream.
23 class WebRtcMediaRecorderTest : public WebRtcContentBrowserTest { 32 class WebRtcMediaRecorderTest
33 : public WebRtcContentBrowserTest,
34 public testing::WithParamInterface<struct EncodingParameters> {
24 public: 35 public:
25 WebRtcMediaRecorderTest() {} 36 WebRtcMediaRecorderTest() {}
26 ~WebRtcMediaRecorderTest() override {} 37 ~WebRtcMediaRecorderTest() override {}
27 38
28 void SetUpCommandLine(base::CommandLine* command_line) override { 39 void SetUpCommandLine(base::CommandLine* command_line) override {
29 WebRtcContentBrowserTest::SetUpCommandLine(command_line); 40 WebRtcContentBrowserTest::SetUpCommandLine(command_line);
30 41
31 AppendUseFakeUIForMediaStreamFlag(); 42 AppendUseFakeUIForMediaStreamFlag();
32 43
33 base::CommandLine::ForCurrentProcess()->AppendSwitch( 44 base::CommandLine::ForCurrentProcess()->AppendSwitch(
34 switches::kUseFakeDeviceForMediaStream); 45 switches::kUseFakeDeviceForMediaStream);
35 46
36 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( 47 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
37 switches::kEnableBlinkFeatures, "GetUserMedia"); 48 switches::kEnableBlinkFeatures, "GetUserMedia");
38 } 49 }
39 50
51 void MaybeForceDisableEncodeAccelerator(bool disable) {
52 if (!disable)
phoglund_chromium 2016/06/02 08:46:23 You may as well do the GetParam in here, no? Seems
mcasas 2016/06/02 14:57:29 GetParam() only works if the test case has been in
53 return;
54 // This flag is also used for encoding, https://crbug.com/616640.
55 base::CommandLine::ForCurrentProcess()->AppendSwitch(
56 switches::kDisableAcceleratedVideoDecode);
57 }
58
40 private: 59 private:
41 DISALLOW_COPY_AND_ASSIGN(WebRtcMediaRecorderTest); 60 DISALLOW_COPY_AND_ASSIGN(WebRtcMediaRecorderTest);
42 }; 61 };
43 62
44 IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest, MediaRecorderStart) { 63 IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest, MediaRecorderStart) {
45 MakeTypicalCall("testStartAndRecorderState();", kMediaRecorderHtmlFile); 64 MakeTypicalCall("testStartAndRecorderState();", kMediaRecorderHtmlFile);
46 } 65 }
47 66
48 IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest, MediaRecorderStartAndStop) { 67 IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest, MediaRecorderStartAndStop) {
49 MakeTypicalCall("testStartStopAndRecorderState();", kMediaRecorderHtmlFile); 68 MakeTypicalCall("testStartStopAndRecorderState();", kMediaRecorderHtmlFile);
50 } 69 }
51 70
52 IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest, 71 IN_PROC_BROWSER_TEST_P(WebRtcMediaRecorderTest,
53 MediaRecorderStartAndDataAvailable) { 72 MediaRecorderStartAndDataAvailable) {
54 MakeTypicalCall("testStartAndDataAvailable();", kMediaRecorderHtmlFile); 73 MaybeForceDisableEncodeAccelerator(GetParam().disable_accelerator);
74 MakeTypicalCall(base::StringPrintf("testStartAndDataAvailable(\"%s\");",
75 GetParam().video_codec.c_str()),
76 kMediaRecorderHtmlFile);
55 } 77 }
56 78
57 IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest, 79 IN_PROC_BROWSER_TEST_P(WebRtcMediaRecorderTest,
58 MediaRecorderStartWithTimeSlice) { 80 MediaRecorderStartWithTimeSlice) {
59 MakeTypicalCall("testStartWithTimeSlice();", kMediaRecorderHtmlFile); 81 MaybeForceDisableEncodeAccelerator(GetParam().disable_accelerator);
82 MakeTypicalCall(base::StringPrintf("testStartWithTimeSlice(\"%s\");",
83 GetParam().video_codec.c_str()),
84 kMediaRecorderHtmlFile);
60 } 85 }
61 86
62 IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest, MediaRecorderResume) { 87 IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest, MediaRecorderResume) {
63 MakeTypicalCall("testResumeAndRecorderState();", kMediaRecorderHtmlFile); 88 MakeTypicalCall("testResumeAndRecorderState();", kMediaRecorderHtmlFile);
64 } 89 }
65 90
66 IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest, 91 IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest,
67 MediaRecorderNoResumeWhenRecorderInactive) { 92 MediaRecorderNoResumeWhenRecorderInactive) {
68 MakeTypicalCall("testIllegalResumeThrowsDOMError();", kMediaRecorderHtmlFile); 93 MakeTypicalCall("testIllegalResumeThrowsDOMError();", kMediaRecorderHtmlFile);
69 } 94 }
70 95
71 IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest, 96 IN_PROC_BROWSER_TEST_P(WebRtcMediaRecorderTest,
72 MediaRecorderResumeAndDataAvailable) { 97 MediaRecorderResumeAndDataAvailable) {
73 MakeTypicalCall("testResumeAndDataAvailable();", kMediaRecorderHtmlFile); 98 MaybeForceDisableEncodeAccelerator(GetParam().disable_accelerator);
99 MakeTypicalCall(base::StringPrintf("testResumeAndDataAvailable(\"%s\");",
100 GetParam().video_codec.c_str()),
101 kMediaRecorderHtmlFile);
74 } 102 }
75 103
76 IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest, MediaRecorderPause) { 104 IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest, MediaRecorderPause) {
77 MakeTypicalCall("testPauseAndRecorderState();", kMediaRecorderHtmlFile); 105 MakeTypicalCall("testPauseAndRecorderState();", kMediaRecorderHtmlFile);
78 } 106 }
79 107
80 IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest, MediaRecorderPauseStop) { 108 IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest, MediaRecorderPauseStop) {
81 MakeTypicalCall("testPauseStopAndRecorderState();", kMediaRecorderHtmlFile); 109 MakeTypicalCall("testPauseStopAndRecorderState();", kMediaRecorderHtmlFile);
82 } 110 }
83 111
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 MakeTypicalCall("testAddingTrackToMediaStreamFiresErrorEvent();", 166 MakeTypicalCall("testAddingTrackToMediaStreamFiresErrorEvent();",
139 kMediaRecorderHtmlFile); 167 kMediaRecorderHtmlFile);
140 } 168 }
141 169
142 IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest, 170 IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest,
143 RemovingTrackFromMediaStreamFiresErrorEvent) { 171 RemovingTrackFromMediaStreamFiresErrorEvent) {
144 MakeTypicalCall("testRemovingTrackFromMediaStreamFiresErrorEvent();", 172 MakeTypicalCall("testRemovingTrackFromMediaStreamFiresErrorEvent();",
145 kMediaRecorderHtmlFile); 173 kMediaRecorderHtmlFile);
146 } 174 }
147 175
176 INSTANTIATE_TEST_CASE_P(,
phoglund_chromium 2016/06/02 08:46:23 Hmm, this looks strange, but if it works I'm ok wi
mcasas 2016/06/02 14:57:29 Acknowledged.
177 WebRtcMediaRecorderTest,
178 testing::ValuesIn(kEncodingParameters));
179
148 } // namespace content 180 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/test/data/media/mediarecorder_test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698