Index: chrome/browser/media/chrome_webrtc_canvas_capture_browsertest.cc |
diff --git a/chrome/browser/media/chrome_webrtc_canvas_capture_browsertest.cc b/chrome/browser/media/chrome_webrtc_canvas_capture_browsertest.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..ff4159bf33a8c47b54cc68a318fd33975ec4fd13 |
--- /dev/null |
+++ b/chrome/browser/media/chrome_webrtc_canvas_capture_browsertest.cc |
@@ -0,0 +1,59 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "base/command_line.h" |
+#include "base/files/file_path.h" |
+#include "base/path_service.h" |
+#include "build/build_config.h" |
+#include "chrome/browser/media/webrtc_browsertest_base.h" |
+#include "chrome/browser/media/webrtc_browsertest_common.h" |
+#include "chrome/browser/ui/browser.h" |
+#include "chrome/browser/ui/browser_tabstrip.h" |
+#include "chrome/browser/ui/tabs/tab_strip_model.h" |
+#include "chrome/common/chrome_switches.h" |
+#include "chrome/test/base/in_process_browser_test.h" |
+#include "chrome/test/base/ui_test_utils.h" |
+#include "content/public/browser/notification_service.h" |
+#include "content/public/browser/render_process_host.h" |
+#include "content/public/common/content_switches.h" |
+#include "content/public/test/browser_test_utils.h" |
+#include "media/base/media_switches.h" |
+#include "net/test/embedded_test_server/embedded_test_server.h" |
+#include "testing/perf/perf_test.h" |
+#include "ui/gl/gl_switches.h" |
+ |
+static const char kCanvasTestHtmlPage[] = "/media/canvas_capture_test.html"; |
+ |
+// Canvas Capture browser test. |
+// At this time this browser test verifies that the frame rate of a stream |
+// originated from a captured canvas is as expected. |
+class WebRtcCanvasCaptureBrowserTest : public WebRtcTestBase { |
phoglund_chromium
2016/02/12 08:38:53
It doesn't make sense to inherit from WebRtcTestBa
cpaulin (no longer in chrome)
2016/02/12 20:14:32
Done.
|
+ public: |
+ void SetUpInProcessBrowserTestFixture() override { |
+ DetectErrorsInJavaScript(); // Look for errors in our rather complex js. |
+ } |
+ |
+ void SetUpCommandLine(base::CommandLine* command_line) override { |
+ // The video playback will not work without a GPU, so force its use here. |
+ command_line->AppendSwitch(switches::kUseGpuInTests); |
+ |
+ command_line->AppendSwitch( |
+ switches::kEnableExperimentalWebPlatformFeatures); |
+ } |
+}; |
+ |
+// Tests that the frame rate of the canvas capture is as expected. |
+IN_PROC_BROWSER_TEST_F(WebRtcCanvasCaptureBrowserTest, |
+ VerifyCanvasCaptureFrameRate) { |
+ ASSERT_TRUE(embedded_test_server()->Start()); |
+ |
+ ui_test_utils::NavigateToURL( |
+ browser(), embedded_test_server()->GetURL(kCanvasTestHtmlPage)); |
+ |
+ content::WebContents* tab_contents = |
+ browser()->tab_strip_model()->GetActiveWebContents(); |
+ |
+ ASSERT_EQ("OK", ExecuteJavascript("testFrameRateOfCanvasCapture();", |
+ tab_contents)); |
+} |