OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "base/command_line.h" | |
6 #include "base/files/file_path.h" | |
7 #include "base/path_service.h" | |
8 #include "build/build_config.h" | |
9 #include "chrome/browser/ui/browser.h" | |
10 #include "chrome/browser/ui/browser_tabstrip.h" | |
11 #include "chrome/browser/ui/tabs/tab_strip_model.h" | |
12 #include "chrome/common/chrome_switches.h" | |
13 #include "chrome/test/base/in_process_browser_test.h" | |
14 #include "chrome/test/base/ui_test_utils.h" | |
15 #include "content/public/browser/notification_service.h" | |
16 #include "content/public/browser/render_process_host.h" | |
mcasas
2016/03/04 22:30:33
I'm not sure all these includes are needed. There'
cpaulin (no longer in chrome)
2016/03/10 22:21:24
I pruned the not needed includes. Done.
| |
17 #include "content/public/common/content_switches.h" | |
18 #include "content/public/test/browser_test_utils.h" | |
19 #include "media/base/media_switches.h" | |
20 #include "net/test/embedded_test_server/embedded_test_server.h" | |
21 #include "testing/perf/perf_test.h" | |
22 #include "ui/gl/gl_switches.h" | |
23 | |
24 static const char kCanvasTestHtmlPage[] = "/media/canvas_capture_test.html"; | |
25 | |
26 #if defined(OS_MACOSX) | |
27 // TODO(cpaulin): when http://crbug.com/591529 is fixed on MAC OS, enable this | |
28 // test. | |
29 #define MAYBE_WebRtcCanvasCaptureBrowserTest \ | |
30 DISABLED_WebRtcCanvasCaptureBrowserTest | |
31 #else | |
32 #define MAYBE_WebRtcCanvasCaptureBrowserTest WebRtcCanvasCaptureBrowserTest | |
33 #endif | |
34 | |
35 // Canvas Capture browser test. | |
36 // At this time this browser test verifies that the frame rate of a stream | |
mcasas
2016/03/04 22:30:33
I'm surprised to read "At this time". Maybe you co
cpaulin (no longer in chrome)
2016/03/10 22:21:24
That's fine, this was indeed not necessary info. D
| |
37 // originated from a captured canvas is as expected. | |
38 class MAYBE_WebRtcCanvasCaptureBrowserTest : public InProcessBrowserTest { | |
mcasas
2016/03/04 22:30:33
The name of the test does not match the file name.
cpaulin (no longer in chrome)
2016/03/10 22:21:24
OK, I follow your example CL now. Done
| |
39 public: | |
40 | |
41 void SetUpCommandLine(base::CommandLine* command_line) override { | |
42 // The video playback will not work without a GPU, so force its use here. | |
43 command_line->AppendSwitch(switches::kUseGpuInTests); | |
mcasas
2016/03/04 22:30:33
Someone else says:
// This test enables switches:
cpaulin (no longer in chrome)
2016/03/10 22:21:24
Thanks for the heads up.
Done.
| |
44 | |
45 command_line->AppendSwitch( | |
46 switches::kEnableExperimentalWebPlatformFeatures); | |
47 } | |
48 | |
49 protected: | |
50 MAYBE_WebRtcCanvasCaptureBrowserTest() {} | |
51 ~MAYBE_WebRtcCanvasCaptureBrowserTest() override {}; | |
52 | |
53 std::string ExecuteJavascript( | |
54 const std::string& javascript, | |
55 content::WebContents* tab_contents) const { | |
56 std::string result; | |
57 EXPECT_TRUE(content::ExecuteScriptAndExtractString( | |
58 tab_contents, javascript, &result)); | |
59 return result; | |
60 } | |
mcasas
2016/03/04 22:30:33
I was thinking this looks strangely indented and r
cpaulin (no longer in chrome)
2016/03/10 22:21:24
Done.
| |
61 | |
62 private: | |
63 DISALLOW_COPY_AND_ASSIGN(MAYBE_WebRtcCanvasCaptureBrowserTest); | |
mcasas
2016/03/04 22:30:33
nit: this is one space too far right.
cpaulin (no longer in chrome)
2016/03/10 22:21:24
Done.
| |
64 }; | |
65 | |
66 // Tests that the frame rate of the canvas capture is as expected. | |
67 IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcCanvasCaptureBrowserTest, | |
68 VerifyCanvasCaptureFrameRate) { | |
69 ASSERT_TRUE(embedded_test_server()->Start()); | |
70 | |
71 ui_test_utils::NavigateToURL( | |
72 browser(), embedded_test_server()->GetURL(kCanvasTestHtmlPage)); | |
73 | |
74 content::WebContents* tab_contents = | |
75 browser()->tab_strip_model()->GetActiveWebContents(); | |
76 | |
77 ASSERT_EQ("OK", ExecuteJavascript("testFrameRateOfCanvasCapture();", | |
78 tab_contents)); | |
79 } | |
OLD | NEW |