Chromium Code Reviews| 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) | |
| 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. | |
|
mcasas
2016/08/30 19:09:07
This should be https://crbug.com/641559
| |
| 14 #define DISABLE_CAPTURE_FROM_MEDIA_ELEMENT_TESTS 1 | |
| 15 #endif // ENABLE_MOJO_RENDERER | |
| 16 | |
| 11 namespace { | 17 namespace { |
| 12 | 18 |
| 13 static const char kCanvasTestHtmlPage[] = "/media/canvas_capture_color.html"; | 19 static const char kCanvasTestHtmlPage[] = "/media/canvas_capture_color.html"; |
| 14 | 20 |
| 21 #if !defined(DISABLE_CAPTURE_FROM_MEDIA_ELEMENT_TESTS) | |
|
mcasas
2016/08/30 19:09:07
This is not how tests are disabled. It should be
| |
| 15 static const char kVideoAudioHtmlFile[] = | 22 static const char kVideoAudioHtmlFile[] = |
| 16 "/media/video_audio_element_capture_test.html"; | 23 "/media/video_audio_element_capture_test.html"; |
| 17 | 24 |
| 18 static struct FileAndTypeParameters { | 25 static struct FileAndTypeParameters { |
| 19 bool has_video; | 26 bool has_video; |
| 20 bool has_audio; | 27 bool has_audio; |
| 21 bool use_audio_tag; | 28 bool use_audio_tag; |
| 22 std::string filename; | 29 std::string filename; |
| 23 } const kFileAndTypeParameters[] = { | 30 } const kFileAndTypeParameters[] = { |
| 24 {true, false, false, "bear-320x240-video-only.webm"}, | 31 {true, false, false, "bear-320x240-video-only.webm"}, |
| 25 {false, true, false, "bear-320x240-audio-only.webm"}, | 32 {false, true, false, "bear-320x240-audio-only.webm"}, |
| 26 {true, true, false, "bear-320x240.webm"}, | 33 {true, true, false, "bear-320x240.webm"}, |
| 27 {false, true, true, "bear-320x240-audio-only.webm"}, | 34 {false, true, true, "bear-320x240-audio-only.webm"}, |
| 28 }; | 35 }; |
| 36 #endif // DISABLE_CAPTURE_FROM_MEDIA_ELEMENT_TESTS | |
| 29 | 37 |
| 30 } // namespace | 38 } // namespace |
| 31 | 39 |
| 32 namespace content { | 40 namespace content { |
| 33 | 41 |
| 34 // 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, |
| 35 // 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 |
| 36 // <audio> element. | 44 // <audio> element. |
| 37 class WebRtcCaptureFromElementBrowserTest | 45 class WebRtcCaptureFromElementBrowserTest |
| 38 : public WebRtcContentBrowserTestBase, | 46 : public WebRtcContentBrowserTestBase, |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 53 | 61 |
| 54 private: | 62 private: |
| 55 DISALLOW_COPY_AND_ASSIGN(WebRtcCaptureFromElementBrowserTest); | 63 DISALLOW_COPY_AND_ASSIGN(WebRtcCaptureFromElementBrowserTest); |
| 56 }; | 64 }; |
| 57 | 65 |
| 58 IN_PROC_BROWSER_TEST_F(WebRtcCaptureFromElementBrowserTest, | 66 IN_PROC_BROWSER_TEST_F(WebRtcCaptureFromElementBrowserTest, |
| 59 VerifyCanvasCaptureColor) { | 67 VerifyCanvasCaptureColor) { |
| 60 MakeTypicalCall("testCanvasCaptureColors();", kCanvasTestHtmlPage); | 68 MakeTypicalCall("testCanvasCaptureColors();", kCanvasTestHtmlPage); |
| 61 } | 69 } |
| 62 | 70 |
| 71 #if !defined(DISABLE_CAPTURE_FROM_MEDIA_ELEMENT_TESTS) | |
| 63 IN_PROC_BROWSER_TEST_P(WebRtcCaptureFromElementBrowserTest, | 72 IN_PROC_BROWSER_TEST_P(WebRtcCaptureFromElementBrowserTest, |
| 64 CaptureFromMediaElement) { | 73 CaptureFromMediaElement) { |
| 65 MakeTypicalCall( | 74 MakeTypicalCall( |
| 66 base::StringPrintf("testCaptureFromMediaElement(\"%s\", %d, %d, %d);", | 75 base::StringPrintf("testCaptureFromMediaElement(\"%s\", %d, %d, %d);", |
| 67 GetParam().filename.c_str(), | 76 GetParam().filename.c_str(), |
| 68 GetParam().has_video, | 77 GetParam().has_video, |
| 69 GetParam().has_audio, | 78 GetParam().has_audio, |
| 70 GetParam().use_audio_tag), | 79 GetParam().use_audio_tag), |
| 71 kVideoAudioHtmlFile); | 80 kVideoAudioHtmlFile); |
| 72 } | 81 } |
| 73 | 82 |
| 74 INSTANTIATE_TEST_CASE_P(, | 83 INSTANTIATE_TEST_CASE_P(, |
| 75 WebRtcCaptureFromElementBrowserTest, | 84 WebRtcCaptureFromElementBrowserTest, |
| 76 testing::ValuesIn(kFileAndTypeParameters)); | 85 testing::ValuesIn(kFileAndTypeParameters)); |
| 86 #endif // !defined(DISABLE_CAPTURE_FROM_MEDIA_ELEMENT_TESTS) | |
| 77 } // namespace content | 87 } // namespace content |
| OLD | NEW |