| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
| 8 #include "chrome/browser/extensions/extension_apitest.h" | 8 #include "chrome/browser/extensions/extension_apitest.h" |
| 9 #include "chrome/browser/extensions/tab_helper.h" | 9 #include "chrome/browser/extensions/tab_helper.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| 11 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" | 11 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" |
| 12 #include "chrome/common/chrome_switches.h" |
| 12 #include "chrome/common/chrome_version_info.h" | 13 #include "chrome/common/chrome_version_info.h" |
| 13 #include "content/public/browser/render_frame_host.h" | 14 #include "content/public/browser/render_frame_host.h" |
| 14 #include "content/public/browser/render_process_host.h" | 15 #include "content/public/browser/render_process_host.h" |
| 15 #include "extensions/browser/extension_registry.h" | 16 #include "extensions/browser/extension_registry.h" |
| 16 #include "extensions/common/switches.h" | 17 #include "extensions/common/switches.h" |
| 17 #include "extensions/test/extension_test_message_listener.h" | 18 #include "extensions/test/extension_test_message_listener.h" |
| 18 #include "extensions/test/result_catcher.h" | 19 #include "extensions/test/result_catcher.h" |
| 19 | 20 |
| 20 #if defined(OS_WIN) | 21 #if defined(OS_WIN) |
| 21 #include "base/win/windows_version.h" | 22 #include "base/win/windows_version.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 34 class TabCaptureApiTest : public ExtensionApiTest { | 35 class TabCaptureApiTest : public ExtensionApiTest { |
| 35 public: | 36 public: |
| 36 void AddExtensionToCommandLineWhitelist() { | 37 void AddExtensionToCommandLineWhitelist() { |
| 37 CommandLine::ForCurrentProcess()->AppendSwitchASCII( | 38 CommandLine::ForCurrentProcess()->AppendSwitchASCII( |
| 38 switches::kWhitelistedExtensionID, kExtensionId); | 39 switches::kWhitelistedExtensionID, kExtensionId); |
| 39 } | 40 } |
| 40 }; | 41 }; |
| 41 | 42 |
| 42 class TabCaptureApiPixelTest : public TabCaptureApiTest { | 43 class TabCaptureApiPixelTest : public TabCaptureApiTest { |
| 43 public: | 44 public: |
| 45 void SetUpCommandLine(CommandLine* command_line) override { |
| 46 TabCaptureApiTest::SetUpCommandLine(command_line); |
| 47 command_line->AppendSwitchASCII(::switches::kWindowSize, "300,300"); |
| 48 } |
| 49 |
| 44 void SetUp() override { | 50 void SetUp() override { |
| 45 EnablePixelOutput(); | 51 if (!IsTooIntensiveForThisPlatform()) |
| 52 EnablePixelOutput(); |
| 46 TabCaptureApiTest::SetUp(); | 53 TabCaptureApiTest::SetUp(); |
| 47 } | 54 } |
| 55 |
| 56 protected: |
| 57 bool IsTooIntensiveForThisPlatform() const { |
| 58 #if defined(OS_WIN) |
| 59 if (base::win::GetVersion() < base::win::VERSION_VISTA) |
| 60 return true; |
| 61 #endif |
| 62 |
| 63 // The tests are too slow to succeed with OSMesa on the bots. |
| 64 if (UsingOSMesa()) |
| 65 return true; |
| 66 |
| 67 #if defined(NDEBUG) |
| 68 return false; |
| 69 #else |
| 70 // TODO(miu): Look into enabling these tests for the Debug build bots once |
| 71 // they prove to be stable again on the Release bots. |
| 72 // http://crbug.com/396413 |
| 73 return !CommandLine::ForCurrentProcess()->HasSwitch( |
| 74 "run-tab-capture-api-pixel-tests"); |
| 75 #endif |
| 76 } |
| 48 }; | 77 }; |
| 49 | 78 |
| 50 IN_PROC_BROWSER_TEST_F(TabCaptureApiTest, ApiTests) { | 79 IN_PROC_BROWSER_TEST_F(TabCaptureApiTest, ApiTests) { |
| 51 #if defined(OS_WIN) && defined(USE_ASH) | 80 #if defined(OS_WIN) && defined(USE_ASH) |
| 52 // Disable this test in Metro+Ash for now (http://crbug.com/262796). | 81 // Disable this test in Metro+Ash for now (http://crbug.com/262796). |
| 53 if (CommandLine::ForCurrentProcess()->HasSwitch(::switches::kAshBrowserTests)) | 82 if (CommandLine::ForCurrentProcess()->HasSwitch(::switches::kAshBrowserTests)) |
| 54 return; | 83 return; |
| 55 #endif | 84 #endif |
| 56 | 85 |
| 57 #if defined(OS_WIN) | 86 #if defined(OS_WIN) |
| (...skipping 13 matching lines...) Expand all Loading... |
| 71 if (base::win::GetVersion() < base::win::VERSION_VISTA) { | 100 if (base::win::GetVersion() < base::win::VERSION_VISTA) { |
| 72 return; | 101 return; |
| 73 } | 102 } |
| 74 #endif | 103 #endif |
| 75 | 104 |
| 76 AddExtensionToCommandLineWhitelist(); | 105 AddExtensionToCommandLineWhitelist(); |
| 77 ASSERT_TRUE(RunExtensionSubtest("tab_capture", "api_tests_audio.html")) | 106 ASSERT_TRUE(RunExtensionSubtest("tab_capture", "api_tests_audio.html")) |
| 78 << message_; | 107 << message_; |
| 79 } | 108 } |
| 80 | 109 |
| 81 // Disabled on ChromeOS for http://crbug.com/406051 | 110 // Tests that tab capture video frames can be received in a VIDEO element. |
| 82 // Disabled on other platforms for http://crbug.com/177163 | 111 IN_PROC_BROWSER_TEST_F(TabCaptureApiPixelTest, EndToEndWithoutRemoting) { |
| 83 // Disabled http://crbug.com/367349 | 112 if (IsTooIntensiveForThisPlatform()) { |
| 84 IN_PROC_BROWSER_TEST_F(TabCaptureApiPixelTest, DISABLED_EndToEnd) { | 113 LOG(WARNING) << "Skipping this CPU-intensive test on this platform/build."; |
| 85 #if defined(OS_WIN) | |
| 86 // TODO(justinlin): Disabled for WinXP due to timeout issues. | |
| 87 if (base::win::GetVersion() < base::win::VERSION_VISTA) { | |
| 88 return; | 114 return; |
| 89 } | 115 } |
| 90 #endif | |
| 91 // This test is too slow to succeed with OSMesa on the bots. | |
| 92 if (UsingOSMesa()) | |
| 93 return; | |
| 94 | |
| 95 AddExtensionToCommandLineWhitelist(); | 116 AddExtensionToCommandLineWhitelist(); |
| 96 ASSERT_TRUE(RunExtensionSubtest("tab_capture", "end_to_end.html")) | 117 ASSERT_TRUE(RunExtensionSubtest( |
| 118 "tab_capture", "end_to_end.html?method=local&colorDeviation=10")) |
| 97 << message_; | 119 << message_; |
| 98 } | 120 } |
| 99 | 121 |
| 122 // Tests that video frames are captured, transported via WebRTC, and finally |
| 123 // received in a VIDEO element. More allowance is provided for color deviation |
| 124 // because of the additional layers of video processing performed within |
| 125 // WebRTC. |
| 126 IN_PROC_BROWSER_TEST_F(TabCaptureApiPixelTest, EndToEndThroughWebRTC) { |
| 127 if (IsTooIntensiveForThisPlatform()) { |
| 128 LOG(WARNING) << "Skipping this CPU-intensive test on this platform/build."; |
| 129 return; |
| 130 } |
| 131 AddExtensionToCommandLineWhitelist(); |
| 132 ASSERT_TRUE(RunExtensionSubtest( |
| 133 "tab_capture", "end_to_end.html?method=webrtc&colorDeviation=50")) |
| 134 << message_; |
| 135 } |
| 136 |
| 100 // http://crbug.com/177163 | 137 // http://crbug.com/177163 |
| 101 #if defined(OS_WIN) && !defined(NDEBUG) | 138 #if defined(OS_WIN) && !defined(NDEBUG) |
| 102 #define MAYBE_GetUserMediaTest DISABLED_GetUserMediaTest | 139 #define MAYBE_GetUserMediaTest DISABLED_GetUserMediaTest |
| 103 #else | 140 #else |
| 104 #define MAYBE_GetUserMediaTest GetUserMediaTest | 141 #define MAYBE_GetUserMediaTest GetUserMediaTest |
| 105 #endif | 142 #endif |
| 106 // Test that we can't get tabCapture streams using GetUserMedia directly. | 143 // Test that we can't get tabCapture streams using GetUserMedia directly. |
| 107 IN_PROC_BROWSER_TEST_F(TabCaptureApiTest, MAYBE_GetUserMediaTest) { | 144 IN_PROC_BROWSER_TEST_F(TabCaptureApiTest, MAYBE_GetUserMediaTest) { |
| 108 ExtensionTestMessageListener listener("ready", true); | 145 ExtensionTestMessageListener listener("ready", true); |
| 109 | 146 |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 #endif | 321 #endif |
| 285 IN_PROC_BROWSER_TEST_F(TabCaptureApiTest, MAYBE_Constraints) { | 322 IN_PROC_BROWSER_TEST_F(TabCaptureApiTest, MAYBE_Constraints) { |
| 286 AddExtensionToCommandLineWhitelist(); | 323 AddExtensionToCommandLineWhitelist(); |
| 287 ASSERT_TRUE(RunExtensionSubtest("tab_capture", "constraints.html")) | 324 ASSERT_TRUE(RunExtensionSubtest("tab_capture", "constraints.html")) |
| 288 << message_; | 325 << message_; |
| 289 } | 326 } |
| 290 | 327 |
| 291 } // namespace | 328 } // namespace |
| 292 | 329 |
| 293 } // namespace extensions | 330 } // namespace extensions |
| OLD | NEW |