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