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 "apps/app_window_contents.h" | 7 #include "apps/app_window_contents.h" |
8 #include "apps/native_app_window.h" | 8 #include "apps/native_app_window.h" |
9 #include "apps/shell_window_registry.h" | 9 #include "apps/shell_window_registry.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "base/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
12 #include "chrome/browser/extensions/api/tabs/tabs_api.h" | 12 #include "chrome/browser/extensions/api/tabs/tabs_api.h" |
13 #include "chrome/browser/extensions/extension_function_test_utils.h" | 13 #include "chrome/browser/extensions/extension_function_test_utils.h" |
14 #include "chrome/browser/ui/apps/chrome_shell_window_delegate.h" | 14 #include "chrome/browser/ui/apps/chrome_shell_window_delegate.h" |
15 #include "chrome/browser/ui/browser.h" | 15 #include "chrome/browser/ui/browser.h" |
16 #include "chrome/browser/ui/extensions/application_launch.h" | 16 #include "chrome/browser/ui/extensions/application_launch.h" |
17 #include "chrome/common/chrome_switches.h" | 17 #include "chrome/common/chrome_switches.h" |
18 #include "content/public/browser/notification_service.h" | 18 #include "content/public/browser/notification_service.h" |
| 19 #include "content/public/test/browser_test_utils.h" |
19 #include "content/public/test/test_utils.h" | 20 #include "content/public/test/test_utils.h" |
20 #include "extensions/common/switches.h" | 21 #include "extensions/common/switches.h" |
21 | 22 |
22 using apps::ShellWindow; | 23 using apps::ShellWindow; |
23 using apps::ShellWindowRegistry; | 24 using apps::ShellWindowRegistry; |
24 using content::WebContents; | 25 using content::WebContents; |
25 | 26 |
26 namespace utils = extension_function_test_utils; | 27 namespace utils = extension_function_test_utils; |
27 | 28 |
28 namespace extensions { | 29 namespace extensions { |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 ShellWindow* window = new ShellWindow(browser()->profile(), | 165 ShellWindow* window = new ShellWindow(browser()->profile(), |
165 new ChromeShellWindowDelegate(), | 166 new ChromeShellWindowDelegate(), |
166 extension); | 167 extension); |
167 window->Init(GURL(std::string()), | 168 window->Init(GURL(std::string()), |
168 new apps::AppWindowContents(window), | 169 new apps::AppWindowContents(window), |
169 params); | 170 params); |
170 return window; | 171 return window; |
171 } | 172 } |
172 | 173 |
173 void PlatformAppBrowserTest::CloseShellWindow(ShellWindow* window) { | 174 void PlatformAppBrowserTest::CloseShellWindow(ShellWindow* window) { |
174 content::WindowedNotificationObserver destroyed_observer( | 175 content::WebContentsDestroyedWatcher destroyed_watcher( |
175 content::NOTIFICATION_WEB_CONTENTS_DESTROYED, | 176 window->web_contents()); |
176 content::NotificationService::AllSources()); | |
177 window->GetBaseWindow()->Close(); | 177 window->GetBaseWindow()->Close(); |
178 destroyed_observer.Wait(); | 178 destroyed_watcher.Wait(); |
179 } | 179 } |
180 | 180 |
181 void PlatformAppBrowserTest::CallAdjustBoundsToBeVisibleOnScreenForShellWindow( | 181 void PlatformAppBrowserTest::CallAdjustBoundsToBeVisibleOnScreenForShellWindow( |
182 ShellWindow* window, | 182 ShellWindow* window, |
183 const gfx::Rect& cached_bounds, | 183 const gfx::Rect& cached_bounds, |
184 const gfx::Rect& cached_screen_bounds, | 184 const gfx::Rect& cached_screen_bounds, |
185 const gfx::Rect& current_screen_bounds, | 185 const gfx::Rect& current_screen_bounds, |
186 const gfx::Size& minimum_size, | 186 const gfx::Size& minimum_size, |
187 gfx::Rect* bounds) { | 187 gfx::Rect* bounds) { |
188 window->AdjustBoundsToBeVisibleOnScreen(cached_bounds, | 188 window->AdjustBoundsToBeVisibleOnScreen(cached_bounds, |
189 cached_screen_bounds, | 189 cached_screen_bounds, |
190 current_screen_bounds, | 190 current_screen_bounds, |
191 minimum_size, | 191 minimum_size, |
192 bounds); | 192 bounds); |
193 } | 193 } |
194 | 194 |
195 void ExperimentalPlatformAppBrowserTest::SetUpCommandLine( | 195 void ExperimentalPlatformAppBrowserTest::SetUpCommandLine( |
196 CommandLine* command_line) { | 196 CommandLine* command_line) { |
197 PlatformAppBrowserTest::SetUpCommandLine(command_line); | 197 PlatformAppBrowserTest::SetUpCommandLine(command_line); |
198 command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis); | 198 command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis); |
199 } | 199 } |
200 | 200 |
201 } // namespace extensions | 201 } // namespace extensions |
OLD | NEW |