| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chrome/browser/apps/app_browsertest_util.h" | 5 #include "chrome/browser/apps/app_browsertest_util.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 9 #include "chrome/browser/extensions/api/tabs/tabs_api.h" | 9 #include "chrome/browser/extensions/api/tabs/tabs_api.h" |
| 10 #include "chrome/browser/extensions/extension_function_test_utils.h" | 10 #include "chrome/browser/extensions/extension_function_test_utils.h" |
| 11 #include "chrome/browser/extensions/extension_test_message_listener.h" | 11 #include "chrome/browser/extensions/extension_test_message_listener.h" |
| 12 #include "chrome/browser/ui/apps/chrome_app_delegate.h" | 12 #include "chrome/browser/ui/apps/chrome_app_delegate.h" |
| 13 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
| 14 #include "chrome/browser/ui/extensions/application_launch.h" | 14 #include "chrome/browser/ui/extensions/application_launch.h" |
| 15 #include "content/public/browser/notification_service.h" | 15 #include "content/public/browser/notification_service.h" |
| 16 #include "content/public/test/browser_test_utils.h" | 16 #include "content/public/test/browser_test_utils.h" |
| 17 #include "content/public/test/test_utils.h" | 17 #include "content/public/test/test_utils.h" |
| 18 #include "extensions/browser/app_window/app_window_contents.h" | 18 #include "extensions/browser/app_window/app_window_contents.h" |
| 19 #include "extensions/browser/app_window/app_window_registry.h" | 19 #include "extensions/browser/app_window/app_window_registry.h" |
| 20 #include "extensions/browser/app_window/native_app_window.h" | 20 #include "extensions/browser/app_window/native_app_window.h" |
| 21 #include "extensions/browser/process_manager.h" |
| 21 #include "extensions/common/switches.h" | 22 #include "extensions/common/switches.h" |
| 22 | 23 |
| 23 using content::WebContents; | 24 using content::WebContents; |
| 24 | 25 |
| 25 namespace { | 26 namespace { |
| 26 | 27 |
| 27 const char kAppWindowTestApp[] = "app_window/generic"; | 28 const char kAppWindowTestApp[] = "app_window/generic"; |
| 28 | 29 |
| 29 } // namespace | 30 } // namespace |
| 30 | 31 |
| 31 namespace utils = extension_function_test_utils; | 32 namespace utils = extension_function_test_utils; |
| 32 | 33 |
| 33 namespace extensions { | 34 namespace extensions { |
| 34 | 35 |
| 35 PlatformAppBrowserTest::PlatformAppBrowserTest() { | 36 PlatformAppBrowserTest::PlatformAppBrowserTest() { |
| 36 ChromeAppDelegate::DisableExternalOpenForTesting(); | 37 ChromeAppDelegate::DisableExternalOpenForTesting(); |
| 37 } | 38 } |
| 38 | 39 |
| 39 void PlatformAppBrowserTest::SetUpCommandLine(CommandLine* command_line) { | 40 void PlatformAppBrowserTest::SetUpCommandLine(CommandLine* command_line) { |
| 40 // Skips ExtensionApiTest::SetUpCommandLine. | 41 // Skips ExtensionApiTest::SetUpCommandLine. |
| 41 ExtensionBrowserTest::SetUpCommandLine(command_line); | 42 ExtensionBrowserTest::SetUpCommandLine(command_line); |
| 42 | 43 |
| 43 // Make event pages get suspended quicker. | 44 // Make event pages get suspended quicker. |
| 44 command_line->AppendSwitchASCII(switches::kEventPageIdleTime, "1000"); | 45 ProcessManager::SetEventPageIdleTimeForTesting(1000); |
| 45 command_line->AppendSwitchASCII(switches::kEventPageSuspendingTime, "1000"); | 46 ProcessManager::SetEventPageSuspendingTimeForTesting(1000); |
| 46 } | 47 } |
| 47 | 48 |
| 48 // static | 49 // static |
| 49 AppWindow* PlatformAppBrowserTest::GetFirstAppWindowForBrowser( | 50 AppWindow* PlatformAppBrowserTest::GetFirstAppWindowForBrowser( |
| 50 Browser* browser) { | 51 Browser* browser) { |
| 51 AppWindowRegistry* app_registry = AppWindowRegistry::Get(browser->profile()); | 52 AppWindowRegistry* app_registry = AppWindowRegistry::Get(browser->profile()); |
| 52 const AppWindowRegistry::AppWindowList& app_windows = | 53 const AppWindowRegistry::AppWindowList& app_windows = |
| 53 app_registry->app_windows(); | 54 app_registry->app_windows(); |
| 54 | 55 |
| 55 AppWindowRegistry::const_iterator iter = app_windows.begin(); | 56 AppWindowRegistry::const_iterator iter = app_windows.begin(); |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 return app_window; | 249 return app_window; |
| 249 } | 250 } |
| 250 | 251 |
| 251 void ExperimentalPlatformAppBrowserTest::SetUpCommandLine( | 252 void ExperimentalPlatformAppBrowserTest::SetUpCommandLine( |
| 252 CommandLine* command_line) { | 253 CommandLine* command_line) { |
| 253 PlatformAppBrowserTest::SetUpCommandLine(command_line); | 254 PlatformAppBrowserTest::SetUpCommandLine(command_line); |
| 254 command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis); | 255 command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis); |
| 255 } | 256 } |
| 256 | 257 |
| 257 } // namespace extensions | 258 } // namespace extensions |
| OLD | NEW |