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