OLD | NEW |
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/strings/stringprintf.h" | 6 #include "base/strings/stringprintf.h" |
7 #include "content/browser/webrtc/webrtc_content_browsertest_base.h" | 7 #include "content/browser/webrtc/webrtc_content_browsertest_base.h" |
8 #include "content/public/common/content_switches.h" | 8 #include "content/public/common/content_switches.h" |
9 #include "media/base/test_data_util.h" | 9 #include "media/base/test_data_util.h" |
10 | 10 |
11 #if defined(ENABLE_MOJO_RENDERER) | 11 #if defined(ENABLE_MOJO_RENDERER) |
12 // Remote mojo renderer does not send audio/video frames back to the renderer | 12 // Remote mojo renderer does not send audio/video frames back to the renderer |
13 // process and hence does not support capture: crbug.com/641559. | 13 // process and hence does not support capture: https://crbug.com/641559. |
14 #define DISABLE_CAPTURE_FROM_MEDIA_ELEMENT_TESTS 1 | 14 #define MAYBE_CaptureFromMediaElement DISABLED_CaptureFromMediaElement |
15 #endif // ENABLE_MOJO_RENDERER | 15 #else |
| 16 #define MAYBE_CaptureFromMediaElement CaptureFromMediaElement |
| 17 #endif |
16 | 18 |
17 namespace { | 19 namespace { |
18 | 20 |
19 static const char kCanvasTestHtmlPage[] = "/media/canvas_capture_color.html"; | 21 static const char kCanvasTestHtmlPage[] = "/media/canvas_capture_color.html"; |
20 | 22 |
21 #if !defined(DISABLE_CAPTURE_FROM_MEDIA_ELEMENT_TESTS) | |
22 static const char kVideoAudioHtmlFile[] = | 23 static const char kVideoAudioHtmlFile[] = |
23 "/media/video_audio_element_capture_test.html"; | 24 "/media/video_audio_element_capture_test.html"; |
24 | 25 |
25 static struct FileAndTypeParameters { | 26 static struct FileAndTypeParameters { |
26 bool has_video; | 27 bool has_video; |
27 bool has_audio; | 28 bool has_audio; |
28 bool use_audio_tag; | 29 bool use_audio_tag; |
29 std::string filename; | 30 std::string filename; |
30 } const kFileAndTypeParameters[] = { | 31 } const kFileAndTypeParameters[] = { |
31 {true, false, false, "bear-320x240-video-only.webm"}, | 32 {true, false, false, "bear-320x240-video-only.webm"}, |
32 {false, true, false, "bear-320x240-audio-only.webm"}, | 33 {false, true, false, "bear-320x240-audio-only.webm"}, |
33 {true, true, false, "bear-320x240.webm"}, | 34 {true, true, false, "bear-320x240.webm"}, |
34 {false, true, true, "bear-320x240-audio-only.webm"}, | 35 {false, true, true, "bear-320x240-audio-only.webm"}, |
35 }; | 36 }; |
36 #endif // DISABLE_CAPTURE_FROM_MEDIA_ELEMENT_TESTS | |
37 | 37 |
38 } // namespace | 38 } // namespace |
39 | 39 |
40 namespace content { | 40 namespace content { |
41 | 41 |
42 // This class is the browser tests for Media Capture from DOM Elements API, | 42 // This class is the browser tests for Media Capture from DOM Elements API, |
43 // which allows for creation of a MediaStream out of a <canvas>, <video> or | 43 // which allows for creation of a MediaStream out of a <canvas>, <video> or |
44 // <audio> element. | 44 // <audio> element. |
45 class WebRtcCaptureFromElementBrowserTest | 45 class WebRtcCaptureFromElementBrowserTest |
46 : public WebRtcContentBrowserTestBase, | 46 : public WebRtcContentBrowserTestBase, |
(...skipping 14 matching lines...) Expand all Loading... |
61 | 61 |
62 private: | 62 private: |
63 DISALLOW_COPY_AND_ASSIGN(WebRtcCaptureFromElementBrowserTest); | 63 DISALLOW_COPY_AND_ASSIGN(WebRtcCaptureFromElementBrowserTest); |
64 }; | 64 }; |
65 | 65 |
66 IN_PROC_BROWSER_TEST_F(WebRtcCaptureFromElementBrowserTest, | 66 IN_PROC_BROWSER_TEST_F(WebRtcCaptureFromElementBrowserTest, |
67 VerifyCanvasCaptureColor) { | 67 VerifyCanvasCaptureColor) { |
68 MakeTypicalCall("testCanvasCaptureColors();", kCanvasTestHtmlPage); | 68 MakeTypicalCall("testCanvasCaptureColors();", kCanvasTestHtmlPage); |
69 } | 69 } |
70 | 70 |
71 #if !defined(DISABLE_CAPTURE_FROM_MEDIA_ELEMENT_TESTS) | |
72 IN_PROC_BROWSER_TEST_P(WebRtcCaptureFromElementBrowserTest, | 71 IN_PROC_BROWSER_TEST_P(WebRtcCaptureFromElementBrowserTest, |
73 CaptureFromMediaElement) { | 72 MAYBE_CaptureFromMediaElement) { |
74 MakeTypicalCall( | 73 MakeTypicalCall( |
75 base::StringPrintf("testCaptureFromMediaElement(\"%s\", %d, %d, %d);", | 74 base::StringPrintf("testCaptureFromMediaElement(\"%s\", %d, %d, %d);", |
76 GetParam().filename.c_str(), | 75 GetParam().filename.c_str(), |
77 GetParam().has_video, | 76 GetParam().has_video, |
78 GetParam().has_audio, | 77 GetParam().has_audio, |
79 GetParam().use_audio_tag), | 78 GetParam().use_audio_tag), |
80 kVideoAudioHtmlFile); | 79 kVideoAudioHtmlFile); |
81 } | 80 } |
82 | 81 |
83 INSTANTIATE_TEST_CASE_P(, | 82 INSTANTIATE_TEST_CASE_P(, |
84 WebRtcCaptureFromElementBrowserTest, | 83 WebRtcCaptureFromElementBrowserTest, |
85 testing::ValuesIn(kFileAndTypeParameters)); | 84 testing::ValuesIn(kFileAndTypeParameters)); |
86 #endif // !defined(DISABLE_CAPTURE_FROM_MEDIA_ELEMENT_TESTS) | |
87 } // namespace content | 85 } // namespace content |
OLD | NEW |