| 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" | |
| 10 #include "chrome/browser/extensions/api/tabs/tabs_api.h" | 9 #include "chrome/browser/extensions/api/tabs/tabs_api.h" |
| 11 #include "chrome/browser/extensions/extension_function_test_utils.h" | 10 #include "chrome/browser/extensions/extension_function_test_utils.h" |
| 11 #include "chrome/browser/lifetime/browser_keep_alive.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/app_launch_params.h" |
| 15 #include "chrome/browser/ui/extensions/application_launch.h" | 15 #include "chrome/browser/ui/extensions/application_launch.h" |
| 16 #include "content/public/browser/notification_service.h" | 16 #include "content/public/browser/notification_service.h" |
| 17 #include "content/public/test/browser_test_utils.h" | 17 #include "content/public/test/browser_test_utils.h" |
| 18 #include "content/public/test/test_utils.h" | 18 #include "content/public/test/test_utils.h" |
| 19 #include "extensions/browser/app_window/app_window_contents.h" | 19 #include "extensions/browser/app_window/app_window_contents.h" |
| 20 #include "extensions/browser/app_window/app_window_registry.h" | 20 #include "extensions/browser/app_window/app_window_registry.h" |
| 21 #include "extensions/browser/app_window/native_app_window.h" | 21 #include "extensions/browser/app_window/native_app_window.h" |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 .size(); | 195 .size(); |
| 196 } | 196 } |
| 197 | 197 |
| 198 AppWindow* PlatformAppBrowserTest::CreateAppWindow(const Extension* extension) { | 198 AppWindow* PlatformAppBrowserTest::CreateAppWindow(const Extension* extension) { |
| 199 return CreateAppWindowFromParams(extension, AppWindow::CreateParams()); | 199 return CreateAppWindowFromParams(extension, AppWindow::CreateParams()); |
| 200 } | 200 } |
| 201 | 201 |
| 202 AppWindow* PlatformAppBrowserTest::CreateAppWindowFromParams( | 202 AppWindow* PlatformAppBrowserTest::CreateAppWindowFromParams( |
| 203 const Extension* extension, | 203 const Extension* extension, |
| 204 const AppWindow::CreateParams& params) { | 204 const AppWindow::CreateParams& params) { |
| 205 AppWindow* window = | 205 AppWindow* window = new AppWindow( |
| 206 new AppWindow(browser()->profile(), | 206 browser()->profile(), |
| 207 new ChromeAppDelegate(make_scoped_ptr(new ScopedKeepAlive)), | 207 new ChromeAppDelegate( |
| 208 extension); | 208 make_scoped_ptr(new browser_lifetime::ScopedKeepAlive)), |
| 209 extension); |
| 209 window->Init(GURL(std::string()), new AppWindowContentsImpl(window), params); | 210 window->Init(GURL(std::string()), new AppWindowContentsImpl(window), params); |
| 210 return window; | 211 return window; |
| 211 } | 212 } |
| 212 | 213 |
| 213 void PlatformAppBrowserTest::CloseAppWindow(AppWindow* window) { | 214 void PlatformAppBrowserTest::CloseAppWindow(AppWindow* window) { |
| 214 content::WebContentsDestroyedWatcher destroyed_watcher( | 215 content::WebContentsDestroyedWatcher destroyed_watcher( |
| 215 window->web_contents()); | 216 window->web_contents()); |
| 216 window->GetBaseWindow()->Close(); | 217 window->GetBaseWindow()->Close(); |
| 217 destroyed_watcher.Wait(); | 218 destroyed_watcher.Wait(); |
| 218 } | 219 } |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 return app_window; | 254 return app_window; |
| 254 } | 255 } |
| 255 | 256 |
| 256 void ExperimentalPlatformAppBrowserTest::SetUpCommandLine( | 257 void ExperimentalPlatformAppBrowserTest::SetUpCommandLine( |
| 257 base::CommandLine* command_line) { | 258 base::CommandLine* command_line) { |
| 258 PlatformAppBrowserTest::SetUpCommandLine(command_line); | 259 PlatformAppBrowserTest::SetUpCommandLine(command_line); |
| 259 command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis); | 260 command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis); |
| 260 } | 261 } |
| 261 | 262 |
| 262 } // namespace extensions | 263 } // namespace extensions |
| OLD | NEW |