Chromium Code Reviews| Index: content/browser/media/webrtc/webrtc_capture_from_element_browsertest.cc |
| diff --git a/content/browser/media/webrtc/webrtc_canvas_capture_browsertest.cc b/content/browser/media/webrtc/webrtc_capture_from_element_browsertest.cc |
| similarity index 19% |
| rename from content/browser/media/webrtc/webrtc_canvas_capture_browsertest.cc |
| rename to content/browser/media/webrtc/webrtc_capture_from_element_browsertest.cc |
| index 107ead30aae23fea218eb65f5770a3249cc2f59c..d23617941d805fa0db6d0efc6b58c1078173a951 100644 |
| --- a/content/browser/media/webrtc/webrtc_canvas_capture_browsertest.cc |
| +++ b/content/browser/media/webrtc/webrtc_capture_from_element_browsertest.cc |
| @@ -3,33 +3,72 @@ |
| // found in the LICENSE file. |
| #include "base/command_line.h" |
| -#include "base/macros.h" |
| -#include "build/build_config.h" |
| -#include "content/public/test/browser_test_utils.h" |
| -#include "content/public/test/content_browser_test_utils.h" |
| +#include "base/strings/stringprintf.h" |
| +#include "content/public/common/content_switches.h" |
| #include "content/test/webrtc_content_browsertest_base.h" |
| +#include "media/base/test_data_util.h" |
| namespace { |
| static const char kCanvasTestHtmlPage[] = "/media/canvas_capture_color.html"; |
| +static const char kVideoAudioHtmlFile[] = |
| + "/media/video_audio_element_capture_test.html"; |
| + |
| +static struct FileAndTypeParameters { |
| + bool has_video; |
| + bool has_audio; |
| + bool use_audio_tag; |
| + std::string filename; |
| +} const kFileAndTypeParameters[] = { |
| + {true, false, false, "bear-320x240-video-only.webm"}, |
| + {false, true, false, "bear-320x240-audio-only.webm"}, |
| + {true, true, false, "bear-320x240.webm"}, |
| + {false, true, true, "bear-320x240-audio-only.webm"}, |
| + |
|
tommi (sloooow) - chröme
2016/06/29 07:52:37
fix whitespace (will "git cl format" fix this?)
mcasas
2016/06/29 18:22:24
I was curious: it didn't do it
(it only reindented
|
| +}; |
| + |
| } // namespace |
| namespace content { |
| -// This class tests the rgba color values produced by canvas capture. |
| -class WebRtcCanvasCaptureTest : public WebRtcContentBrowserTest { |
| +// This class is the browser tests for Media Capture from DOM Elements API, |
| +// which allows for creation of a MediaStream out of a <canvas>, <video> or |
| +// <audio> element. |
| +class WebRtcCaptureFromElementBrowserTest |
| + : public WebRtcContentBrowserTest, |
| + public testing::WithParamInterface<struct FileAndTypeParameters> { |
| public: |
| - WebRtcCanvasCaptureTest() {} |
| - ~WebRtcCanvasCaptureTest() override {} |
| + WebRtcCaptureFromElementBrowserTest() {} |
| + ~WebRtcCaptureFromElementBrowserTest() override {} |
| + |
| + void SetUpCommandLine(base::CommandLine* command_line) override { |
| + WebRtcContentBrowserTest::SetUpCommandLine(command_line); |
| + base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( |
| + switches::kEnableBlinkFeatures, "MediaCaptureFromVideo"); |
| + } |
| private: |
| - DISALLOW_COPY_AND_ASSIGN(WebRtcCanvasCaptureTest); |
| + DISALLOW_COPY_AND_ASSIGN(WebRtcCaptureFromElementBrowserTest); |
| }; |
| -IN_PROC_BROWSER_TEST_F(WebRtcCanvasCaptureTest, |
| - VerifyCanvasCaptureColor) { |
| +IN_PROC_BROWSER_TEST_F(WebRtcCaptureFromElementBrowserTest, |
| + VerifyCanvasCaptureColor) { |
| MakeTypicalCall("testCanvasCaptureColors();", kCanvasTestHtmlPage); |
| } |
| +IN_PROC_BROWSER_TEST_P(WebRtcCaptureFromElementBrowserTest, |
| + CaptureFromMediaElement) { |
| + MakeTypicalCall( |
| + base::StringPrintf("testCaptureFromMediaElement(\"%s\", %d, %d, %d);", |
| + GetParam().filename.c_str(), |
| + GetParam().has_video, |
| + GetParam().has_audio, |
| + GetParam().use_audio_tag), |
| + kVideoAudioHtmlFile); |
| +} |
| + |
| +INSTANTIATE_TEST_CASE_P(, |
|
tommi (sloooow) - chröme
2016/06/29 07:52:37
missing name?
mcasas
2016/06/29 18:22:24
The first argument is an optional prefix [1]
and o
|
| + WebRtcCaptureFromElementBrowserTest, |
| + testing::ValuesIn(kFileAndTypeParameters)); |
| } // namespace content |