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

Unified 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, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/test/data/media/mediarecorder_test.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/media/webrtc/webrtc_media_recorder_browsertest.cc
diff --git a/content/browser/media/webrtc/webrtc_media_recorder_browsertest.cc b/content/browser/media/webrtc/webrtc_media_recorder_browsertest.cc
index 0d1fcb66bdd5bd3c3509f9573316f08a38f1c57f..ce386582bd0d7f43f345c4805ee11306673a2be8 100644
--- a/content/browser/media/webrtc/webrtc_media_recorder_browsertest.cc
+++ b/content/browser/media/webrtc/webrtc_media_recorder_browsertest.cc
@@ -4,6 +4,7 @@
#include "base/command_line.h"
#include "base/macros.h"
+#include "base/strings/stringprintf.h"
#include "build/build_config.h"
#include "content/public/common/content_switches.h"
#include "content/public/test/browser_test_utils.h"
@@ -15,12 +16,22 @@ namespace {
static const char kMediaRecorderHtmlFile[] = "/media/mediarecorder_test.html";
+static struct EncodingParameters {
+ bool disable_accelerator;
+ std::string video_codec;
+} const kEncodingParameters[] = {
+ {true, "VP8"}, {true, "VP9"}, {true, "H264"},
+ {false, "VP8"}, {false, "VP9"}, {false, "H264"},
+};
+
} // namespace
namespace content {
// This class tests the recording of a media stream.
-class WebRtcMediaRecorderTest : public WebRtcContentBrowserTest {
+class WebRtcMediaRecorderTest
+ : public WebRtcContentBrowserTest,
+ public testing::WithParamInterface<struct EncodingParameters> {
public:
WebRtcMediaRecorderTest() {}
~WebRtcMediaRecorderTest() override {}
@@ -37,6 +48,14 @@ class WebRtcMediaRecorderTest : public WebRtcContentBrowserTest {
switches::kEnableBlinkFeatures, "GetUserMedia");
}
+ void MaybeForceDisableEncodeAccelerator(bool disable) {
+ 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
+ return;
+ // This flag is also used for encoding, https://crbug.com/616640.
+ base::CommandLine::ForCurrentProcess()->AppendSwitch(
+ switches::kDisableAcceleratedVideoDecode);
+ }
+
private:
DISALLOW_COPY_AND_ASSIGN(WebRtcMediaRecorderTest);
};
@@ -49,14 +68,20 @@ IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest, MediaRecorderStartAndStop) {
MakeTypicalCall("testStartStopAndRecorderState();", kMediaRecorderHtmlFile);
}
-IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest,
+IN_PROC_BROWSER_TEST_P(WebRtcMediaRecorderTest,
MediaRecorderStartAndDataAvailable) {
- MakeTypicalCall("testStartAndDataAvailable();", kMediaRecorderHtmlFile);
+ MaybeForceDisableEncodeAccelerator(GetParam().disable_accelerator);
+ MakeTypicalCall(base::StringPrintf("testStartAndDataAvailable(\"%s\");",
+ GetParam().video_codec.c_str()),
+ kMediaRecorderHtmlFile);
}
-IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest,
+IN_PROC_BROWSER_TEST_P(WebRtcMediaRecorderTest,
MediaRecorderStartWithTimeSlice) {
- MakeTypicalCall("testStartWithTimeSlice();", kMediaRecorderHtmlFile);
+ MaybeForceDisableEncodeAccelerator(GetParam().disable_accelerator);
+ MakeTypicalCall(base::StringPrintf("testStartWithTimeSlice(\"%s\");",
+ GetParam().video_codec.c_str()),
+ kMediaRecorderHtmlFile);
}
IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest, MediaRecorderResume) {
@@ -68,9 +93,12 @@ IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest,
MakeTypicalCall("testIllegalResumeThrowsDOMError();", kMediaRecorderHtmlFile);
}
-IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest,
+IN_PROC_BROWSER_TEST_P(WebRtcMediaRecorderTest,
MediaRecorderResumeAndDataAvailable) {
- MakeTypicalCall("testResumeAndDataAvailable();", kMediaRecorderHtmlFile);
+ MaybeForceDisableEncodeAccelerator(GetParam().disable_accelerator);
+ MakeTypicalCall(base::StringPrintf("testResumeAndDataAvailable(\"%s\");",
+ GetParam().video_codec.c_str()),
+ kMediaRecorderHtmlFile);
}
IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest, MediaRecorderPause) {
@@ -145,4 +173,8 @@ IN_PROC_BROWSER_TEST_F(WebRtcMediaRecorderTest,
kMediaRecorderHtmlFile);
}
+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.
+ WebRtcMediaRecorderTest,
+ testing::ValuesIn(kEncodingParameters));
+
} // namespace content
« 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