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

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

Issue 2104643002: MediaCaptureFromElement: add content_browsertests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/strings/stringprintf.h"
7 #include "build/build_config.h" 7 #include "content/public/common/content_switches.h"
8 #include "content/public/test/browser_test_utils.h"
9 #include "content/public/test/content_browser_test_utils.h"
10 #include "content/test/webrtc_content_browsertest_base.h" 8 #include "content/test/webrtc_content_browsertest_base.h"
9 #include "media/base/test_data_util.h"
11 10
12 namespace { 11 namespace {
13 12
14 static const char kCanvasTestHtmlPage[] = "/media/canvas_capture_color.html"; 13 static const char kCanvasTestHtmlPage[] = "/media/canvas_capture_color.html";
15 14
15 static const char kVideoAudioHtmlFile[] =
16 "/media/video_audio_element_capture_test.html";
17
18 static struct FileAndTypeParameters {
19 bool has_video;
20 bool has_audio;
21 bool use_audio_tag;
22 std::string filename;
23 } const kFileAndTypeParameters[] = {
24 {true, false, false, "bear-320x240-video-only.webm"},
25 {false, true, false, "bear-320x240-audio-only.webm"},
26 {true, true, false, "bear-320x240.webm"},
27 {false, true, true, "bear-320x240-audio-only.webm"},
28
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
29 };
30
16 } // namespace 31 } // namespace
17 32
18 namespace content { 33 namespace content {
19 34
20 // This class tests the rgba color values produced by canvas capture. 35 // This class is the browser tests for Media Capture from DOM Elements API,
21 class WebRtcCanvasCaptureTest : public WebRtcContentBrowserTest { 36 // which allows for creation of a MediaStream out of a <canvas>, <video> or
37 // <audio> element.
38 class WebRtcCaptureFromElementBrowserTest
39 : public WebRtcContentBrowserTest,
40 public testing::WithParamInterface<struct FileAndTypeParameters> {
22 public: 41 public:
23 WebRtcCanvasCaptureTest() {} 42 WebRtcCaptureFromElementBrowserTest() {}
24 ~WebRtcCanvasCaptureTest() override {} 43 ~WebRtcCaptureFromElementBrowserTest() override {}
44
45 void SetUpCommandLine(base::CommandLine* command_line) override {
46 WebRtcContentBrowserTest::SetUpCommandLine(command_line);
47 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
48 switches::kEnableBlinkFeatures, "MediaCaptureFromVideo");
49 }
25 50
26 private: 51 private:
27 DISALLOW_COPY_AND_ASSIGN(WebRtcCanvasCaptureTest); 52 DISALLOW_COPY_AND_ASSIGN(WebRtcCaptureFromElementBrowserTest);
28 }; 53 };
29 54
30 IN_PROC_BROWSER_TEST_F(WebRtcCanvasCaptureTest, 55 IN_PROC_BROWSER_TEST_F(WebRtcCaptureFromElementBrowserTest,
31 VerifyCanvasCaptureColor) { 56 VerifyCanvasCaptureColor) {
32 MakeTypicalCall("testCanvasCaptureColors();", kCanvasTestHtmlPage); 57 MakeTypicalCall("testCanvasCaptureColors();", kCanvasTestHtmlPage);
33 } 58 }
34 59
60 IN_PROC_BROWSER_TEST_P(WebRtcCaptureFromElementBrowserTest,
61 CaptureFromMediaElement) {
62 MakeTypicalCall(
63 base::StringPrintf("testCaptureFromMediaElement(\"%s\", %d, %d, %d);",
64 GetParam().filename.c_str(),
65 GetParam().has_video,
66 GetParam().has_audio,
67 GetParam().use_audio_tag),
68 kVideoAudioHtmlFile);
69 }
70
71 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
72 WebRtcCaptureFromElementBrowserTest,
73 testing::ValuesIn(kFileAndTypeParameters));
35 } // namespace content 74 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698