| 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 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 ~WebRtcCaptureFromElementBrowserTest() override {} | 56 ~WebRtcCaptureFromElementBrowserTest() override {} |
| 57 | 57 |
| 58 void SetUpCommandLine(base::CommandLine* command_line) override { | 58 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 59 WebRtcContentBrowserTestBase::SetUpCommandLine(command_line); | 59 WebRtcContentBrowserTestBase::SetUpCommandLine(command_line); |
| 60 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( | 60 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( |
| 61 switches::kEnableBlinkFeatures, "MediaCaptureFromVideo"); | 61 switches::kEnableBlinkFeatures, "MediaCaptureFromVideo"); |
| 62 | 62 |
| 63 // Allow <video>/<audio>.play() when not initiated by user gesture. | 63 // Allow <video>/<audio>.play() when not initiated by user gesture. |
| 64 base::CommandLine::ForCurrentProcess()->AppendSwitch( | 64 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| 65 switches::kDisableGestureRequirementForMediaPlayback); | 65 switches::kDisableGestureRequirementForMediaPlayback); |
| 66 // Allow experimental canvas features. |
| 67 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| 68 switches::kEnableExperimentalCanvasFeatures); |
| 66 } | 69 } |
| 67 | 70 |
| 68 private: | 71 private: |
| 69 DISALLOW_COPY_AND_ASSIGN(WebRtcCaptureFromElementBrowserTest); | 72 DISALLOW_COPY_AND_ASSIGN(WebRtcCaptureFromElementBrowserTest); |
| 70 }; | 73 }; |
| 71 | 74 |
| 72 IN_PROC_BROWSER_TEST_F(WebRtcCaptureFromElementBrowserTest, | 75 IN_PROC_BROWSER_TEST_F(WebRtcCaptureFromElementBrowserTest, |
| 73 VerifyCanvasCaptureColor) { | 76 VerifyCanvasCaptureColor) { |
| 74 MakeTypicalCall("testCanvasCaptureColors();", | 77 MakeTypicalCall("testCanvasCaptureColors();", |
| 75 kCanvasCaptureColorTestHtmlFile); | 78 kCanvasCaptureColorTestHtmlFile); |
| 76 } | 79 } |
| 77 | 80 |
| 78 IN_PROC_BROWSER_TEST_F(WebRtcCaptureFromElementBrowserTest, | 81 IN_PROC_BROWSER_TEST_F(WebRtcCaptureFromElementBrowserTest, |
| 79 VerifyCanvasCaptureFrames) { | 82 VerifyCanvasCaptureFrames) { |
| 80 MakeTypicalCall("testCanvasCapture(draw2d);", kCanvasCaptureTestHtmlFile); | 83 MakeTypicalCall("testCanvasCapture(draw2d);", kCanvasCaptureTestHtmlFile); |
| 81 } | 84 } |
| 82 | 85 |
| 83 IN_PROC_BROWSER_TEST_F(WebRtcCaptureFromElementBrowserTest, | 86 IN_PROC_BROWSER_TEST_F(WebRtcCaptureFromElementBrowserTest, |
| 84 VerifyCanvasCaptureWebGLFrames) { | 87 VerifyCanvasCaptureWebGLFrames) { |
| 85 MakeTypicalCall("testCanvasCapture(drawWebGL);", kCanvasCaptureTestHtmlFile); | 88 MakeTypicalCall("testCanvasCapture(drawWebGL);", kCanvasCaptureTestHtmlFile); |
| 86 } | 89 } |
| 87 | 90 |
| 91 IN_PROC_BROWSER_TEST_F(WebRtcCaptureFromElementBrowserTest, |
| 92 VerifyCanvasCaptureOffscreenCanvasCommitFrames) { |
| 93 MakeTypicalCall("testCanvasCapture(drawOffscreenCanvasCommit);", |
| 94 kCanvasCaptureTestHtmlFile); |
| 95 } |
| 96 |
| 88 IN_PROC_BROWSER_TEST_P(WebRtcCaptureFromElementBrowserTest, | 97 IN_PROC_BROWSER_TEST_P(WebRtcCaptureFromElementBrowserTest, |
| 89 MAYBE_CaptureFromMediaElement) { | 98 MAYBE_CaptureFromMediaElement) { |
| 90 #if defined(OS_ANDROID) | 99 #if defined(OS_ANDROID) |
| 91 // TODO(mcasas): flaky on Lollipop Low-End devices, investigate and reconnect | 100 // TODO(mcasas): flaky on Lollipop Low-End devices, investigate and reconnect |
| 92 // https://crbug.com/626299 | 101 // https://crbug.com/626299 |
| 93 if (base::SysInfo::IsLowEndDevice() && | 102 if (base::SysInfo::IsLowEndDevice() && |
| 94 base::android::BuildInfo::GetInstance()->sdk_int() < | 103 base::android::BuildInfo::GetInstance()->sdk_int() < |
| 95 base::android::SDK_VERSION_MARSHMALLOW) { | 104 base::android::SDK_VERSION_MARSHMALLOW) { |
| 96 return; | 105 return; |
| 97 } | 106 } |
| 98 #endif | 107 #endif |
| 99 | 108 |
| 100 MakeTypicalCall( | 109 MakeTypicalCall( |
| 101 base::StringPrintf("testCaptureFromMediaElement(\"%s\", %d, %d, %d);", | 110 base::StringPrintf("testCaptureFromMediaElement(\"%s\", %d, %d, %d);", |
| 102 GetParam().filename.c_str(), | 111 GetParam().filename.c_str(), |
| 103 GetParam().has_video, | 112 GetParam().has_video, |
| 104 GetParam().has_audio, | 113 GetParam().has_audio, |
| 105 GetParam().use_audio_tag), | 114 GetParam().use_audio_tag), |
| 106 kVideoAudioHtmlFile); | 115 kVideoAudioHtmlFile); |
| 107 } | 116 } |
| 108 | 117 |
| 109 INSTANTIATE_TEST_CASE_P(, | 118 INSTANTIATE_TEST_CASE_P(, |
| 110 WebRtcCaptureFromElementBrowserTest, | 119 WebRtcCaptureFromElementBrowserTest, |
| 111 testing::ValuesIn(kFileAndTypeParameters)); | 120 testing::ValuesIn(kFileAndTypeParameters)); |
| 112 } // namespace content | 121 } // namespace content |
| OLD | NEW |