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

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

Issue 2658973002: Add content_browsertest for checking canvas capture frame rate (Closed)
Patch Set: add content browsertest Created 3 years, 10 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
« no previous file with comments | « no previous file | content/test/data/media/canvas_capture.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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(OS_ANDROID) 11 #if defined(OS_ANDROID)
12 #include "base/android/build_info.h" 12 #include "base/android/build_info.h"
13 #include "base/sys_info.h" 13 #include "base/sys_info.h"
14 #endif 14 #endif
15 15
16 #if defined(ENABLE_MOJO_RENDERER) 16 #if defined(ENABLE_MOJO_RENDERER)
17 // Remote mojo renderer does not send audio/video frames back to the renderer 17 // Remote mojo renderer does not send audio/video frames back to the renderer
18 // process and hence does not support capture: https://crbug.com/641559. 18 // process and hence does not support capture: https://crbug.com/641559.
19 #define MAYBE_CaptureFromMediaElement DISABLED_CaptureFromMediaElement 19 #define MAYBE_CaptureFromMediaElement DISABLED_CaptureFromMediaElement
20 #else 20 #else
21 #define MAYBE_CaptureFromMediaElement CaptureFromMediaElement 21 #define MAYBE_CaptureFromMediaElement CaptureFromMediaElement
22 #endif 22 #endif
23 23
24 namespace { 24 namespace {
25 25
26 static const char kCanvasTestHtmlPage[] = "/media/canvas_capture_color.html"; 26 static const char kCanvasCaptureTestHtmlFile[] = "/media/canvas_capture.html";
27 27 static const char kCanvasCaptureColorTestHtmlFile[] =
28 "/media/canvas_capture_color.html";
28 static const char kVideoAudioHtmlFile[] = 29 static const char kVideoAudioHtmlFile[] =
29 "/media/video_audio_element_capture_test.html"; 30 "/media/video_audio_element_capture_test.html";
30 31
31 static struct FileAndTypeParameters { 32 static struct FileAndTypeParameters {
32 bool has_video; 33 bool has_video;
33 bool has_audio; 34 bool has_audio;
34 bool use_audio_tag; 35 bool use_audio_tag;
35 std::string filename; 36 std::string filename;
36 } const kFileAndTypeParameters[] = { 37 } const kFileAndTypeParameters[] = {
37 {true, false, false, "bear-320x240-video-only.webm"}, 38 {true, false, false, "bear-320x240-video-only.webm"},
(...skipping 25 matching lines...) Expand all
63 base::CommandLine::ForCurrentProcess()->AppendSwitch( 64 base::CommandLine::ForCurrentProcess()->AppendSwitch(
64 switches::kDisableGestureRequirementForMediaPlayback); 65 switches::kDisableGestureRequirementForMediaPlayback);
65 } 66 }
66 67
67 private: 68 private:
68 DISALLOW_COPY_AND_ASSIGN(WebRtcCaptureFromElementBrowserTest); 69 DISALLOW_COPY_AND_ASSIGN(WebRtcCaptureFromElementBrowserTest);
69 }; 70 };
70 71
71 IN_PROC_BROWSER_TEST_F(WebRtcCaptureFromElementBrowserTest, 72 IN_PROC_BROWSER_TEST_F(WebRtcCaptureFromElementBrowserTest,
72 VerifyCanvasCaptureColor) { 73 VerifyCanvasCaptureColor) {
73 MakeTypicalCall("testCanvasCaptureColors();", kCanvasTestHtmlPage); 74 MakeTypicalCall("testCanvasCaptureColors();",
75 kCanvasCaptureColorTestHtmlFile);
76 }
77
78 IN_PROC_BROWSER_TEST_F(WebRtcCaptureFromElementBrowserTest,
79 VerifyCanvasCaptureFrames) {
80 MakeTypicalCall("testCanvasCapture(draw2d);", kCanvasCaptureTestHtmlFile);
81 }
82
83 IN_PROC_BROWSER_TEST_F(WebRtcCaptureFromElementBrowserTest,
84 VerifyCanvasCaptureWebGLFrames) {
85 MakeTypicalCall("testCanvasCapture(drawWebGL);", kCanvasCaptureTestHtmlFile);
74 } 86 }
75 87
76 IN_PROC_BROWSER_TEST_P(WebRtcCaptureFromElementBrowserTest, 88 IN_PROC_BROWSER_TEST_P(WebRtcCaptureFromElementBrowserTest,
77 MAYBE_CaptureFromMediaElement) { 89 MAYBE_CaptureFromMediaElement) {
78 #if defined(OS_ANDROID) 90 #if defined(OS_ANDROID)
79 // TODO(mcasas): flaky on Lollipop Low-End devices, investigate and reconnect 91 // TODO(mcasas): flaky on Lollipop Low-End devices, investigate and reconnect
80 // https://crbug.com/626299 92 // https://crbug.com/626299
81 if (base::SysInfo::IsLowEndDevice() && 93 if (base::SysInfo::IsLowEndDevice() &&
82 base::android::BuildInfo::GetInstance()->sdk_int() < 94 base::android::BuildInfo::GetInstance()->sdk_int() <
83 base::android::SDK_VERSION_MARSHMALLOW) { 95 base::android::SDK_VERSION_MARSHMALLOW) {
84 return; 96 return;
85 } 97 }
86 #endif 98 #endif
87 99
88 MakeTypicalCall( 100 MakeTypicalCall(
89 base::StringPrintf("testCaptureFromMediaElement(\"%s\", %d, %d, %d);", 101 base::StringPrintf("testCaptureFromMediaElement(\"%s\", %d, %d, %d);",
90 GetParam().filename.c_str(), 102 GetParam().filename.c_str(),
91 GetParam().has_video, 103 GetParam().has_video,
92 GetParam().has_audio, 104 GetParam().has_audio,
93 GetParam().use_audio_tag), 105 GetParam().use_audio_tag),
94 kVideoAudioHtmlFile); 106 kVideoAudioHtmlFile);
95 } 107 }
96 108
97 INSTANTIATE_TEST_CASE_P(, 109 INSTANTIATE_TEST_CASE_P(,
98 WebRtcCaptureFromElementBrowserTest, 110 WebRtcCaptureFromElementBrowserTest,
99 testing::ValuesIn(kFileAndTypeParameters)); 111 testing::ValuesIn(kFileAndTypeParameters));
100 } // namespace content 112 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/test/data/media/canvas_capture.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698