| 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/apps/scoped_keep_alive.h" | 9 #include "chrome/browser/apps/scoped_keep_alive.h" |
| 10 #include "chrome/browser/extensions/api/tabs/tabs_api.h" | 10 #include "chrome/browser/extensions/api/tabs/tabs_api.h" |
| 11 #include "chrome/browser/extensions/extension_function_test_utils.h" | 11 #include "chrome/browser/extensions/extension_function_test_utils.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/app_launch_params.h" |
| 14 #include "chrome/browser/ui/extensions/application_launch.h" | 15 #include "chrome/browser/ui/extensions/application_launch.h" |
| 15 #include "content/public/browser/notification_service.h" | 16 #include "content/public/browser/notification_service.h" |
| 16 #include "content/public/test/browser_test_utils.h" | 17 #include "content/public/test/browser_test_utils.h" |
| 17 #include "content/public/test/test_utils.h" | 18 #include "content/public/test/test_utils.h" |
| 18 #include "extensions/browser/app_window/app_window_contents.h" | 19 #include "extensions/browser/app_window/app_window_contents.h" |
| 19 #include "extensions/browser/app_window/app_window_registry.h" | 20 #include "extensions/browser/app_window/app_window_registry.h" |
| 20 #include "extensions/browser/app_window/native_app_window.h" | 21 #include "extensions/browser/app_window/native_app_window.h" |
| 21 #include "extensions/browser/process_manager.h" | 22 #include "extensions/browser/process_manager.h" |
| 23 #include "extensions/common/constants.h" |
| 22 #include "extensions/common/switches.h" | 24 #include "extensions/common/switches.h" |
| 23 #include "extensions/test/extension_test_message_listener.h" | 25 #include "extensions/test/extension_test_message_listener.h" |
| 24 | 26 |
| 25 using content::WebContents; | 27 using content::WebContents; |
| 26 | 28 |
| 27 namespace { | 29 namespace { |
| 28 | 30 |
| 29 const char kAppWindowTestApp[] = "app_window/generic"; | 31 const char kAppWindowTestApp[] = "app_window/generic"; |
| 30 | 32 |
| 31 } // namespace | 33 } // namespace |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 const Extension* extension = InstallPlatformApp(name); | 107 const Extension* extension = InstallPlatformApp(name); |
| 106 | 108 |
| 107 LaunchPlatformApp(extension); | 109 LaunchPlatformApp(extension); |
| 108 | 110 |
| 109 app_loaded_observer.Wait(); | 111 app_loaded_observer.Wait(); |
| 110 | 112 |
| 111 return extension; | 113 return extension; |
| 112 } | 114 } |
| 113 | 115 |
| 114 void PlatformAppBrowserTest::LaunchPlatformApp(const Extension* extension) { | 116 void PlatformAppBrowserTest::LaunchPlatformApp(const Extension* extension) { |
| 115 OpenApplication(AppLaunchParams( | 117 OpenApplication(AppLaunchParams(browser()->profile(), extension, |
| 116 browser()->profile(), extension, LAUNCH_CONTAINER_NONE, NEW_WINDOW)); | 118 LAUNCH_CONTAINER_NONE, NEW_WINDOW, |
| 119 extensions::SOURCE_UNTRACKED)); |
| 117 } | 120 } |
| 118 | 121 |
| 119 WebContents* PlatformAppBrowserTest::GetFirstAppWindowWebContents() { | 122 WebContents* PlatformAppBrowserTest::GetFirstAppWindowWebContents() { |
| 120 AppWindow* window = GetFirstAppWindow(); | 123 AppWindow* window = GetFirstAppWindow(); |
| 121 if (window) | 124 if (window) |
| 122 return window->web_contents(); | 125 return window->web_contents(); |
| 123 | 126 |
| 124 return NULL; | 127 return NULL; |
| 125 } | 128 } |
| 126 | 129 |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 return app_window; | 255 return app_window; |
| 253 } | 256 } |
| 254 | 257 |
| 255 void ExperimentalPlatformAppBrowserTest::SetUpCommandLine( | 258 void ExperimentalPlatformAppBrowserTest::SetUpCommandLine( |
| 256 CommandLine* command_line) { | 259 CommandLine* command_line) { |
| 257 PlatformAppBrowserTest::SetUpCommandLine(command_line); | 260 PlatformAppBrowserTest::SetUpCommandLine(command_line); |
| 258 command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis); | 261 command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis); |
| 259 } | 262 } |
| 260 | 263 |
| 261 } // namespace extensions | 264 } // namespace extensions |
| OLD | NEW |