| 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" |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 return AppWindowRegistry::Get(browser()->profile())->app_windows().size(); | 188 return AppWindowRegistry::Get(browser()->profile())->app_windows().size(); |
| 189 } | 189 } |
| 190 | 190 |
| 191 size_t PlatformAppBrowserTest::GetAppWindowCountForApp( | 191 size_t PlatformAppBrowserTest::GetAppWindowCountForApp( |
| 192 const std::string& app_id) { | 192 const std::string& app_id) { |
| 193 return AppWindowRegistry::Get(browser()->profile()) | 193 return AppWindowRegistry::Get(browser()->profile()) |
| 194 ->GetAppWindowsForApp(app_id) | 194 ->GetAppWindowsForApp(app_id) |
| 195 .size(); | 195 .size(); |
| 196 } | 196 } |
| 197 | 197 |
| 198 AppWindow* PlatformAppBrowserTest::CreateAppWindow(const Extension* extension) { | 198 AppWindow* PlatformAppBrowserTest::CreateAppWindow( |
| 199 return CreateAppWindowFromParams(extension, AppWindow::CreateParams()); | 199 const Extension* extension, |
| 200 content::WebContents* creator_contents) { |
| 201 return CreateAppWindowFromParams(extension, creator_contents, |
| 202 AppWindow::CreateParams()); |
| 200 } | 203 } |
| 201 | 204 |
| 202 AppWindow* PlatformAppBrowserTest::CreateAppWindowFromParams( | 205 AppWindow* PlatformAppBrowserTest::CreateAppWindowFromParams( |
| 203 const Extension* extension, | 206 const Extension* extension, |
| 207 content::WebContents* creator_contents, |
| 204 const AppWindow::CreateParams& params) { | 208 const AppWindow::CreateParams& params) { |
| 205 AppWindow* window = | 209 AppWindow* window = new AppWindow( |
| 206 new AppWindow(browser()->profile(), | 210 browser()->profile(), |
| 207 new ChromeAppDelegate(make_scoped_ptr(new ScopedKeepAlive)), | 211 new ChromeAppDelegate(make_scoped_ptr(new ScopedKeepAlive)), extension); |
| 208 extension); | 212 window->Init(GURL(std::string()), new AppWindowContentsImpl(window), |
| 209 window->Init(GURL(std::string()), new AppWindowContentsImpl(window), params); | 213 creator_contents->GetMainFrame(), params); |
| 210 return window; | 214 return window; |
| 211 } | 215 } |
| 212 | 216 |
| 213 void PlatformAppBrowserTest::CloseAppWindow(AppWindow* window) { | 217 void PlatformAppBrowserTest::CloseAppWindow(AppWindow* window) { |
| 214 content::WebContentsDestroyedWatcher destroyed_watcher( | 218 content::WebContentsDestroyedWatcher destroyed_watcher( |
| 215 window->web_contents()); | 219 window->web_contents()); |
| 216 window->GetBaseWindow()->Close(); | 220 window->GetBaseWindow()->Close(); |
| 217 destroyed_watcher.Wait(); | 221 destroyed_watcher.Wait(); |
| 218 } | 222 } |
| 219 | 223 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 return app_window; | 257 return app_window; |
| 254 } | 258 } |
| 255 | 259 |
| 256 void ExperimentalPlatformAppBrowserTest::SetUpCommandLine( | 260 void ExperimentalPlatformAppBrowserTest::SetUpCommandLine( |
| 257 base::CommandLine* command_line) { | 261 base::CommandLine* command_line) { |
| 258 PlatformAppBrowserTest::SetUpCommandLine(command_line); | 262 PlatformAppBrowserTest::SetUpCommandLine(command_line); |
| 259 command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis); | 263 command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis); |
| 260 } | 264 } |
| 261 | 265 |
| 262 } // namespace extensions | 266 } // namespace extensions |
| OLD | NEW |