| 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 "apps/app_window_contents.h" | 7 #include "apps/app_window_contents.h" |
| 8 #include "apps/app_window_registry.h" | 8 #include "apps/app_window_registry.h" |
| 9 #include "apps/ui/native_app_window.h" | 9 #include "apps/ui/native_app_window.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
| 12 #include "chrome/browser/extensions/api/tabs/tabs_api.h" | 12 #include "chrome/browser/extensions/api/tabs/tabs_api.h" |
| 13 #include "chrome/browser/extensions/extension_function_test_utils.h" | 13 #include "chrome/browser/extensions/extension_function_test_utils.h" |
| 14 #include "chrome/browser/ui/apps/chrome_shell_window_delegate.h" | 14 #include "chrome/browser/ui/apps/chrome_app_window_delegate.h" |
| 15 #include "chrome/browser/ui/browser.h" | 15 #include "chrome/browser/ui/browser.h" |
| 16 #include "chrome/browser/ui/extensions/application_launch.h" | 16 #include "chrome/browser/ui/extensions/application_launch.h" |
| 17 #include "content/public/browser/notification_service.h" | 17 #include "content/public/browser/notification_service.h" |
| 18 #include "content/public/test/browser_test_utils.h" | 18 #include "content/public/test/browser_test_utils.h" |
| 19 #include "content/public/test/test_utils.h" | 19 #include "content/public/test/test_utils.h" |
| 20 #include "extensions/common/switches.h" | 20 #include "extensions/common/switches.h" |
| 21 | 21 |
| 22 using apps::AppWindow; | 22 using apps::AppWindow; |
| 23 using apps::AppWindowRegistry; | 23 using apps::AppWindowRegistry; |
| 24 using content::WebContents; | 24 using content::WebContents; |
| 25 | 25 |
| 26 namespace utils = extension_function_test_utils; | 26 namespace utils = extension_function_test_utils; |
| 27 | 27 |
| 28 namespace extensions { | 28 namespace extensions { |
| 29 | 29 |
| 30 PlatformAppBrowserTest::PlatformAppBrowserTest() { | 30 PlatformAppBrowserTest::PlatformAppBrowserTest() { |
| 31 ChromeShellWindowDelegate::DisableExternalOpenForTesting(); | 31 ChromeAppWindowDelegate::DisableExternalOpenForTesting(); |
| 32 } | 32 } |
| 33 | 33 |
| 34 void PlatformAppBrowserTest::SetUpCommandLine(CommandLine* command_line) { | 34 void PlatformAppBrowserTest::SetUpCommandLine(CommandLine* command_line) { |
| 35 // Skips ExtensionApiTest::SetUpCommandLine. | 35 // Skips ExtensionApiTest::SetUpCommandLine. |
| 36 ExtensionBrowserTest::SetUpCommandLine(command_line); | 36 ExtensionBrowserTest::SetUpCommandLine(command_line); |
| 37 | 37 |
| 38 // Make event pages get suspended quicker. | 38 // Make event pages get suspended quicker. |
| 39 command_line->AppendSwitchASCII(switches::kEventPageIdleTime, "1000"); | 39 command_line->AppendSwitchASCII(switches::kEventPageIdleTime, "1000"); |
| 40 command_line->AppendSwitchASCII(switches::kEventPageSuspendingTime, "1000"); | 40 command_line->AppendSwitchASCII(switches::kEventPageSuspendingTime, "1000"); |
| 41 } | 41 } |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 } | 179 } |
| 180 | 180 |
| 181 AppWindow* PlatformAppBrowserTest::CreateAppWindow(const Extension* extension) { | 181 AppWindow* PlatformAppBrowserTest::CreateAppWindow(const Extension* extension) { |
| 182 return CreateAppWindowFromParams(extension, AppWindow::CreateParams()); | 182 return CreateAppWindowFromParams(extension, AppWindow::CreateParams()); |
| 183 } | 183 } |
| 184 | 184 |
| 185 AppWindow* PlatformAppBrowserTest::CreateAppWindowFromParams( | 185 AppWindow* PlatformAppBrowserTest::CreateAppWindowFromParams( |
| 186 const Extension* extension, | 186 const Extension* extension, |
| 187 const AppWindow::CreateParams& params) { | 187 const AppWindow::CreateParams& params) { |
| 188 AppWindow* window = new AppWindow( | 188 AppWindow* window = new AppWindow( |
| 189 browser()->profile(), new ChromeShellWindowDelegate(), extension); | 189 browser()->profile(), new ChromeAppWindowDelegate(), extension); |
| 190 window->Init( | 190 window->Init( |
| 191 GURL(std::string()), new apps::AppWindowContentsImpl(window), params); | 191 GURL(std::string()), new apps::AppWindowContentsImpl(window), params); |
| 192 return window; | 192 return window; |
| 193 } | 193 } |
| 194 | 194 |
| 195 void PlatformAppBrowserTest::CloseAppWindow(AppWindow* window) { | 195 void PlatformAppBrowserTest::CloseAppWindow(AppWindow* window) { |
| 196 content::WebContentsDestroyedWatcher destroyed_watcher( | 196 content::WebContentsDestroyedWatcher destroyed_watcher( |
| 197 window->web_contents()); | 197 window->web_contents()); |
| 198 window->GetBaseWindow()->Close(); | 198 window->GetBaseWindow()->Close(); |
| 199 destroyed_watcher.Wait(); | 199 destroyed_watcher.Wait(); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 213 bounds); | 213 bounds); |
| 214 } | 214 } |
| 215 | 215 |
| 216 void ExperimentalPlatformAppBrowserTest::SetUpCommandLine( | 216 void ExperimentalPlatformAppBrowserTest::SetUpCommandLine( |
| 217 CommandLine* command_line) { | 217 CommandLine* command_line) { |
| 218 PlatformAppBrowserTest::SetUpCommandLine(command_line); | 218 PlatformAppBrowserTest::SetUpCommandLine(command_line); |
| 219 command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis); | 219 command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis); |
| 220 } | 220 } |
| 221 | 221 |
| 222 } // namespace extensions | 222 } // namespace extensions |
| OLD | NEW |