OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 ++result; | 156 ++result; |
157 return result; | 157 return result; |
158 } | 158 } |
159 | 159 |
160 class MockTabStripModelObserver : public TabStripModelObserver { | 160 class MockTabStripModelObserver : public TabStripModelObserver { |
161 public: | 161 public: |
162 MockTabStripModelObserver() : closing_count_(0) {} | 162 MockTabStripModelObserver() : closing_count_(0) {} |
163 | 163 |
164 virtual void TabClosingAt(TabStripModel* tab_strip_model, | 164 virtual void TabClosingAt(TabStripModel* tab_strip_model, |
165 WebContents* contents, | 165 WebContents* contents, |
166 int index) OVERRIDE { | 166 int index) override { |
167 ++closing_count_; | 167 ++closing_count_; |
168 } | 168 } |
169 | 169 |
170 int closing_count() const { return closing_count_; } | 170 int closing_count() const { return closing_count_; } |
171 | 171 |
172 private: | 172 private: |
173 int closing_count_; | 173 int closing_count_; |
174 | 174 |
175 DISALLOW_COPY_AND_ASSIGN(MockTabStripModelObserver); | 175 DISALLOW_COPY_AND_ASSIGN(MockTabStripModelObserver); |
176 }; | 176 }; |
177 | 177 |
178 class InterstitialObserver : public content::WebContentsObserver { | 178 class InterstitialObserver : public content::WebContentsObserver { |
179 public: | 179 public: |
180 InterstitialObserver(content::WebContents* web_contents, | 180 InterstitialObserver(content::WebContents* web_contents, |
181 const base::Closure& attach_callback, | 181 const base::Closure& attach_callback, |
182 const base::Closure& detach_callback) | 182 const base::Closure& detach_callback) |
183 : WebContentsObserver(web_contents), | 183 : WebContentsObserver(web_contents), |
184 attach_callback_(attach_callback), | 184 attach_callback_(attach_callback), |
185 detach_callback_(detach_callback) { | 185 detach_callback_(detach_callback) { |
186 } | 186 } |
187 | 187 |
188 virtual void DidAttachInterstitialPage() OVERRIDE { | 188 virtual void DidAttachInterstitialPage() override { |
189 attach_callback_.Run(); | 189 attach_callback_.Run(); |
190 } | 190 } |
191 | 191 |
192 virtual void DidDetachInterstitialPage() OVERRIDE { | 192 virtual void DidDetachInterstitialPage() override { |
193 detach_callback_.Run(); | 193 detach_callback_.Run(); |
194 } | 194 } |
195 | 195 |
196 private: | 196 private: |
197 base::Closure attach_callback_; | 197 base::Closure attach_callback_; |
198 base::Closure detach_callback_; | 198 base::Closure detach_callback_; |
199 | 199 |
200 DISALLOW_COPY_AND_ASSIGN(InterstitialObserver); | 200 DISALLOW_COPY_AND_ASSIGN(InterstitialObserver); |
201 }; | 201 }; |
202 | 202 |
203 // Causes the browser to swap processes on a redirect to an HTTPS URL. | 203 // Causes the browser to swap processes on a redirect to an HTTPS URL. |
204 class TransferHttpsRedirectsContentBrowserClient | 204 class TransferHttpsRedirectsContentBrowserClient |
205 : public chrome::ChromeContentBrowserClient { | 205 : public chrome::ChromeContentBrowserClient { |
206 public: | 206 public: |
207 virtual bool ShouldSwapProcessesForRedirect( | 207 virtual bool ShouldSwapProcessesForRedirect( |
208 content::ResourceContext* resource_context, | 208 content::ResourceContext* resource_context, |
209 const GURL& current_url, | 209 const GURL& current_url, |
210 const GURL& new_url) OVERRIDE { | 210 const GURL& new_url) override { |
211 return new_url.SchemeIs(url::kHttpsScheme); | 211 return new_url.SchemeIs(url::kHttpsScheme); |
212 } | 212 } |
213 }; | 213 }; |
214 | 214 |
215 // Used by CloseWithAppMenuOpen. Invokes CloseWindow on the supplied browser. | 215 // Used by CloseWithAppMenuOpen. Invokes CloseWindow on the supplied browser. |
216 void CloseWindowCallback(Browser* browser) { | 216 void CloseWindowCallback(Browser* browser) { |
217 chrome::CloseWindow(browser); | 217 chrome::CloseWindow(browser); |
218 } | 218 } |
219 | 219 |
220 // Used by CloseWithAppMenuOpen. Posts a CloseWindowCallback and shows the app | 220 // Used by CloseWithAppMenuOpen. Posts a CloseWindowCallback and shows the app |
(...skipping 16 matching lines...) Expand all Loading... |
237 interstitial_page_->Show(); | 237 interstitial_page_->Show(); |
238 } | 238 } |
239 virtual ~TestInterstitialPage() { } | 239 virtual ~TestInterstitialPage() { } |
240 void Proceed() { | 240 void Proceed() { |
241 interstitial_page_->Proceed(); | 241 interstitial_page_->Proceed(); |
242 } | 242 } |
243 void DontProceed() { | 243 void DontProceed() { |
244 interstitial_page_->DontProceed(); | 244 interstitial_page_->DontProceed(); |
245 } | 245 } |
246 | 246 |
247 virtual std::string GetHTMLContents() OVERRIDE { | 247 virtual std::string GetHTMLContents() override { |
248 return "<h1>INTERSTITIAL</h1>"; | 248 return "<h1>INTERSTITIAL</h1>"; |
249 } | 249 } |
250 | 250 |
251 private: | 251 private: |
252 InterstitialPage* interstitial_page_; // Owns us. | 252 InterstitialPage* interstitial_page_; // Owns us. |
253 }; | 253 }; |
254 | 254 |
255 class RenderViewSizeObserver : public content::WebContentsObserver { | 255 class RenderViewSizeObserver : public content::WebContentsObserver { |
256 public: | 256 public: |
257 RenderViewSizeObserver(content::WebContents* web_contents, | 257 RenderViewSizeObserver(content::WebContents* web_contents, |
(...skipping 15 matching lines...) Expand all Loading... |
273 *wcv_commit_size = result->second.wcv_commit_size; | 273 *wcv_commit_size = result->second.wcv_commit_size; |
274 } | 274 } |
275 } | 275 } |
276 | 276 |
277 void set_wcv_resize_insets(const gfx::Size& wcv_resize_insets) { | 277 void set_wcv_resize_insets(const gfx::Size& wcv_resize_insets) { |
278 wcv_resize_insets_ = wcv_resize_insets; | 278 wcv_resize_insets_ = wcv_resize_insets; |
279 } | 279 } |
280 | 280 |
281 // Cache the size when RenderViewHost is first created. | 281 // Cache the size when RenderViewHost is first created. |
282 virtual void RenderViewCreated( | 282 virtual void RenderViewCreated( |
283 content::RenderViewHost* render_view_host) OVERRIDE { | 283 content::RenderViewHost* render_view_host) override { |
284 render_view_sizes_[render_view_host].rwhv_create_size = | 284 render_view_sizes_[render_view_host].rwhv_create_size = |
285 render_view_host->GetView()->GetViewBounds().size(); | 285 render_view_host->GetView()->GetViewBounds().size(); |
286 } | 286 } |
287 | 287 |
288 // Enlarge WebContentsView by |wcv_resize_insets_| while the navigation entry | 288 // Enlarge WebContentsView by |wcv_resize_insets_| while the navigation entry |
289 // is pending. | 289 // is pending. |
290 virtual void DidStartNavigationToPendingEntry( | 290 virtual void DidStartNavigationToPendingEntry( |
291 const GURL& url, | 291 const GURL& url, |
292 NavigationController::ReloadType reload_type) OVERRIDE { | 292 NavigationController::ReloadType reload_type) override { |
293 if (wcv_resize_insets_.IsEmpty()) | 293 if (wcv_resize_insets_.IsEmpty()) |
294 return; | 294 return; |
295 // Resizing the main browser window by |wcv_resize_insets_| will | 295 // Resizing the main browser window by |wcv_resize_insets_| will |
296 // automatically resize the WebContentsView by the same amount. | 296 // automatically resize the WebContentsView by the same amount. |
297 // Just resizing WebContentsView directly doesn't work on Linux, because the | 297 // Just resizing WebContentsView directly doesn't work on Linux, because the |
298 // next automatic layout of the browser window will resize WebContentsView | 298 // next automatic layout of the browser window will resize WebContentsView |
299 // back to the previous size. To make it consistent, resize main browser | 299 // back to the previous size. To make it consistent, resize main browser |
300 // window on all platforms. | 300 // window on all platforms. |
301 gfx::Rect bounds(browser_window_->GetBounds()); | 301 gfx::Rect bounds(browser_window_->GetBounds()); |
302 gfx::Size size(bounds.size()); | 302 gfx::Size size(bounds.size()); |
303 size.Enlarge(wcv_resize_insets_.width(), wcv_resize_insets_.height()); | 303 size.Enlarge(wcv_resize_insets_.width(), wcv_resize_insets_.height()); |
304 bounds.set_size(size); | 304 bounds.set_size(size); |
305 browser_window_->SetBounds(bounds); | 305 browser_window_->SetBounds(bounds); |
306 // Let the message loop run so that resize actually takes effect. | 306 // Let the message loop run so that resize actually takes effect. |
307 content::RunAllPendingInMessageLoop(); | 307 content::RunAllPendingInMessageLoop(); |
308 } | 308 } |
309 | 309 |
310 // Cache the sizes of RenderWidgetHostView and WebContentsView when the | 310 // Cache the sizes of RenderWidgetHostView and WebContentsView when the |
311 // navigation entry is committed, which is before | 311 // navigation entry is committed, which is before |
312 // WebContentsDelegate::DidNavigateMainFramePostCommit is called. | 312 // WebContentsDelegate::DidNavigateMainFramePostCommit is called. |
313 virtual void NavigationEntryCommitted( | 313 virtual void NavigationEntryCommitted( |
314 const content::LoadCommittedDetails& details) OVERRIDE { | 314 const content::LoadCommittedDetails& details) override { |
315 content::RenderViewHost* rvh = web_contents()->GetRenderViewHost(); | 315 content::RenderViewHost* rvh = web_contents()->GetRenderViewHost(); |
316 render_view_sizes_[rvh].rwhv_commit_size = | 316 render_view_sizes_[rvh].rwhv_commit_size = |
317 web_contents()->GetRenderWidgetHostView()->GetViewBounds().size(); | 317 web_contents()->GetRenderWidgetHostView()->GetViewBounds().size(); |
318 render_view_sizes_[rvh].wcv_commit_size = | 318 render_view_sizes_[rvh].wcv_commit_size = |
319 web_contents()->GetContainerBounds().size(); | 319 web_contents()->GetContainerBounds().size(); |
320 } | 320 } |
321 | 321 |
322 private: | 322 private: |
323 struct Sizes { | 323 struct Sizes { |
324 gfx::Size rwhv_create_size; // Size of RenderWidgetHostView when created. | 324 gfx::Size rwhv_create_size; // Size of RenderWidgetHostView when created. |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
624 } | 624 } |
625 | 625 |
626 class RedirectObserver : public content::WebContentsObserver { | 626 class RedirectObserver : public content::WebContentsObserver { |
627 public: | 627 public: |
628 explicit RedirectObserver(content::WebContents* web_contents) | 628 explicit RedirectObserver(content::WebContents* web_contents) |
629 : WebContentsObserver(web_contents) { | 629 : WebContentsObserver(web_contents) { |
630 } | 630 } |
631 | 631 |
632 virtual void DidNavigateAnyFrame( | 632 virtual void DidNavigateAnyFrame( |
633 const content::LoadCommittedDetails& details, | 633 const content::LoadCommittedDetails& details, |
634 const content::FrameNavigateParams& params) OVERRIDE { | 634 const content::FrameNavigateParams& params) override { |
635 params_ = params; | 635 params_ = params; |
636 } | 636 } |
637 | 637 |
638 virtual void WebContentsDestroyed() OVERRIDE { | 638 virtual void WebContentsDestroyed() override { |
639 // Make sure we don't close the tab while the observer is in scope. | 639 // Make sure we don't close the tab while the observer is in scope. |
640 // See http://crbug.com/314036. | 640 // See http://crbug.com/314036. |
641 FAIL() << "WebContents closed during navigation (http://crbug.com/314036)."; | 641 FAIL() << "WebContents closed during navigation (http://crbug.com/314036)."; |
642 } | 642 } |
643 | 643 |
644 const content::FrameNavigateParams& params() const { | 644 const content::FrameNavigateParams& params() const { |
645 return params_; | 645 return params_; |
646 } | 646 } |
647 | 647 |
648 private: | 648 private: |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
840 } | 840 } |
841 | 841 |
842 // BeforeUnloadAtQuitWithTwoWindows is a regression test for | 842 // BeforeUnloadAtQuitWithTwoWindows is a regression test for |
843 // http://crbug.com/11842. It opens two windows, one of which has a | 843 // http://crbug.com/11842. It opens two windows, one of which has a |
844 // beforeunload handler and attempts to exit cleanly. | 844 // beforeunload handler and attempts to exit cleanly. |
845 class BeforeUnloadAtQuitWithTwoWindows : public InProcessBrowserTest { | 845 class BeforeUnloadAtQuitWithTwoWindows : public InProcessBrowserTest { |
846 public: | 846 public: |
847 // This test is for testing a specific shutdown behavior. This mimics what | 847 // This test is for testing a specific shutdown behavior. This mimics what |
848 // happens in InProcessBrowserTest::RunTestOnMainThread and QuitBrowsers, but | 848 // happens in InProcessBrowserTest::RunTestOnMainThread and QuitBrowsers, but |
849 // ensures that it happens through the single IDC_EXIT of the test. | 849 // ensures that it happens through the single IDC_EXIT of the test. |
850 virtual void TearDownOnMainThread() OVERRIDE { | 850 virtual void TearDownOnMainThread() override { |
851 // Cycle both the MessageLoop and the Cocoa runloop twice to flush out any | 851 // Cycle both the MessageLoop and the Cocoa runloop twice to flush out any |
852 // Chrome work that generates Cocoa work. Do this twice since there are two | 852 // Chrome work that generates Cocoa work. Do this twice since there are two |
853 // Browsers that must be closed. | 853 // Browsers that must be closed. |
854 CycleRunLoops(); | 854 CycleRunLoops(); |
855 CycleRunLoops(); | 855 CycleRunLoops(); |
856 | 856 |
857 // Run the application event loop to completion, which will cycle the | 857 // Run the application event loop to completion, which will cycle the |
858 // native MessagePump on all platforms. | 858 // native MessagePump on all platforms. |
859 base::MessageLoop::current()->PostTask(FROM_HERE, | 859 base::MessageLoop::current()->PostTask(FROM_HERE, |
860 base::MessageLoop::QuitClosure()); | 860 base::MessageLoop::QuitClosure()); |
(...skipping 1147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2008 } | 2008 } |
2009 } | 2009 } |
2010 | 2010 |
2011 class MockWebContentsObserver : public WebContentsObserver { | 2011 class MockWebContentsObserver : public WebContentsObserver { |
2012 public: | 2012 public: |
2013 explicit MockWebContentsObserver(WebContents* web_contents) | 2013 explicit MockWebContentsObserver(WebContents* web_contents) |
2014 : WebContentsObserver(web_contents), | 2014 : WebContentsObserver(web_contents), |
2015 got_user_gesture_(false) { | 2015 got_user_gesture_(false) { |
2016 } | 2016 } |
2017 | 2017 |
2018 virtual void DidGetUserGesture() OVERRIDE { | 2018 virtual void DidGetUserGesture() override { |
2019 got_user_gesture_ = true; | 2019 got_user_gesture_ = true; |
2020 } | 2020 } |
2021 | 2021 |
2022 bool got_user_gesture() const { | 2022 bool got_user_gesture() const { |
2023 return got_user_gesture_; | 2023 return got_user_gesture_; |
2024 } | 2024 } |
2025 | 2025 |
2026 void set_got_user_gesture(bool got_it) { | 2026 void set_got_user_gesture(bool got_it) { |
2027 got_user_gesture_ = got_it; | 2027 got_user_gesture_ = got_it; |
2028 } | 2028 } |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2187 browser()->tab_strip_model()->GetActiveWebContents(), expected_title); | 2187 browser()->tab_strip_model()->GetActiveWebContents(), expected_title); |
2188 title_watcher.AlsoWaitForTitle(ASCIIToUTF16("Allowed")); | 2188 title_watcher.AlsoWaitForTitle(ASCIIToUTF16("Allowed")); |
2189 ui_test_utils::NavigateToURL(browser(), url); | 2189 ui_test_utils::NavigateToURL(browser(), url); |
2190 ASSERT_EQ(expected_title, title_watcher.WaitAndGetTitle()); | 2190 ASSERT_EQ(expected_title, title_watcher.WaitAndGetTitle()); |
2191 } | 2191 } |
2192 | 2192 |
2193 class KioskModeTest : public BrowserTest { | 2193 class KioskModeTest : public BrowserTest { |
2194 public: | 2194 public: |
2195 KioskModeTest() {} | 2195 KioskModeTest() {} |
2196 | 2196 |
2197 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 2197 virtual void SetUpCommandLine(CommandLine* command_line) override { |
2198 command_line->AppendSwitch(switches::kKioskMode); | 2198 command_line->AppendSwitch(switches::kKioskMode); |
2199 } | 2199 } |
2200 }; | 2200 }; |
2201 | 2201 |
2202 #if defined(OS_MACOSX) || (defined(OS_LINUX) && !defined(OS_CHROMEOS)) | 2202 #if defined(OS_MACOSX) || (defined(OS_LINUX) && !defined(OS_CHROMEOS)) |
2203 // Mac: http://crbug.com/103912 | 2203 // Mac: http://crbug.com/103912 |
2204 // Linux: http://crbug.com/163931 | 2204 // Linux: http://crbug.com/163931 |
2205 #define MAYBE_EnableKioskModeTest DISABLED_EnableKioskModeTest | 2205 #define MAYBE_EnableKioskModeTest DISABLED_EnableKioskModeTest |
2206 #else | 2206 #else |
2207 #define MAYBE_EnableKioskModeTest EnableKioskModeTest | 2207 #define MAYBE_EnableKioskModeTest EnableKioskModeTest |
2208 #endif | 2208 #endif |
2209 IN_PROC_BROWSER_TEST_F(KioskModeTest, MAYBE_EnableKioskModeTest) { | 2209 IN_PROC_BROWSER_TEST_F(KioskModeTest, MAYBE_EnableKioskModeTest) { |
2210 // Check if browser is in fullscreen mode. | 2210 // Check if browser is in fullscreen mode. |
2211 ASSERT_TRUE(browser()->window()->IsFullscreen()); | 2211 ASSERT_TRUE(browser()->window()->IsFullscreen()); |
2212 ASSERT_FALSE(browser()->window()->IsFullscreenBubbleVisible()); | 2212 ASSERT_FALSE(browser()->window()->IsFullscreenBubbleVisible()); |
2213 } | 2213 } |
2214 | 2214 |
2215 #if defined(OS_WIN) | 2215 #if defined(OS_WIN) |
2216 // This test verifies that Chrome can be launched with a user-data-dir path | 2216 // This test verifies that Chrome can be launched with a user-data-dir path |
2217 // which contains non ASCII characters. | 2217 // which contains non ASCII characters. |
2218 class LaunchBrowserWithNonAsciiUserDatadir : public BrowserTest { | 2218 class LaunchBrowserWithNonAsciiUserDatadir : public BrowserTest { |
2219 public: | 2219 public: |
2220 LaunchBrowserWithNonAsciiUserDatadir() {} | 2220 LaunchBrowserWithNonAsciiUserDatadir() {} |
2221 | 2221 |
2222 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 2222 virtual void SetUpCommandLine(CommandLine* command_line) override { |
2223 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 2223 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
2224 base::FilePath tmp_profile = temp_dir_.path().AppendASCII("tmp_profile"); | 2224 base::FilePath tmp_profile = temp_dir_.path().AppendASCII("tmp_profile"); |
2225 tmp_profile = tmp_profile.Append(L"Test Chrome G\u00E9raldine"); | 2225 tmp_profile = tmp_profile.Append(L"Test Chrome G\u00E9raldine"); |
2226 | 2226 |
2227 ASSERT_TRUE(base::CreateDirectory(tmp_profile)); | 2227 ASSERT_TRUE(base::CreateDirectory(tmp_profile)); |
2228 command_line->AppendSwitchPath(switches::kUserDataDir, tmp_profile); | 2228 command_line->AppendSwitchPath(switches::kUserDataDir, tmp_profile); |
2229 } | 2229 } |
2230 | 2230 |
2231 base::ScopedTempDir temp_dir_; | 2231 base::ScopedTempDir temp_dir_; |
2232 }; | 2232 }; |
2233 | 2233 |
2234 IN_PROC_BROWSER_TEST_F(LaunchBrowserWithNonAsciiUserDatadir, | 2234 IN_PROC_BROWSER_TEST_F(LaunchBrowserWithNonAsciiUserDatadir, |
2235 TestNonAsciiUserDataDir) { | 2235 TestNonAsciiUserDataDir) { |
2236 // Verify that the window is present. | 2236 // Verify that the window is present. |
2237 ASSERT_TRUE(browser()); | 2237 ASSERT_TRUE(browser()); |
2238 } | 2238 } |
2239 #endif // defined(OS_WIN) | 2239 #endif // defined(OS_WIN) |
2240 | 2240 |
2241 // Tests to ensure that the browser continues running in the background after | 2241 // Tests to ensure that the browser continues running in the background after |
2242 // the last window closes. | 2242 // the last window closes. |
2243 class RunInBackgroundTest : public BrowserTest { | 2243 class RunInBackgroundTest : public BrowserTest { |
2244 public: | 2244 public: |
2245 RunInBackgroundTest() {} | 2245 RunInBackgroundTest() {} |
2246 | 2246 |
2247 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 2247 virtual void SetUpCommandLine(CommandLine* command_line) override { |
2248 command_line->AppendSwitch(switches::kKeepAliveForTest); | 2248 command_line->AppendSwitch(switches::kKeepAliveForTest); |
2249 } | 2249 } |
2250 }; | 2250 }; |
2251 | 2251 |
2252 IN_PROC_BROWSER_TEST_F(RunInBackgroundTest, RunInBackgroundBasicTest) { | 2252 IN_PROC_BROWSER_TEST_F(RunInBackgroundTest, RunInBackgroundBasicTest) { |
2253 // Close the browser window, then open a new one - the browser should keep | 2253 // Close the browser window, then open a new one - the browser should keep |
2254 // running. | 2254 // running. |
2255 Profile* profile = browser()->profile(); | 2255 Profile* profile = browser()->profile(); |
2256 EXPECT_EQ(1u, chrome::GetTotalBrowserCount()); | 2256 EXPECT_EQ(1u, chrome::GetTotalBrowserCount()); |
2257 content::WindowedNotificationObserver observer( | 2257 content::WindowedNotificationObserver observer( |
2258 chrome::NOTIFICATION_BROWSER_CLOSED, | 2258 chrome::NOTIFICATION_BROWSER_CLOSED, |
2259 content::Source<Browser>(browser())); | 2259 content::Source<Browser>(browser())); |
2260 chrome::CloseWindow(browser()); | 2260 chrome::CloseWindow(browser()); |
2261 observer.Wait(); | 2261 observer.Wait(); |
2262 EXPECT_EQ(0u, chrome::GetTotalBrowserCount()); | 2262 EXPECT_EQ(0u, chrome::GetTotalBrowserCount()); |
2263 | 2263 |
2264 ui_test_utils::BrowserAddedObserver browser_added_observer; | 2264 ui_test_utils::BrowserAddedObserver browser_added_observer; |
2265 chrome::NewEmptyWindow(profile, chrome::GetActiveDesktop()); | 2265 chrome::NewEmptyWindow(profile, chrome::GetActiveDesktop()); |
2266 browser_added_observer.WaitForSingleNewBrowser(); | 2266 browser_added_observer.WaitForSingleNewBrowser(); |
2267 | 2267 |
2268 EXPECT_EQ(1u, chrome::GetTotalBrowserCount()); | 2268 EXPECT_EQ(1u, chrome::GetTotalBrowserCount()); |
2269 } | 2269 } |
2270 | 2270 |
2271 // Tests to ensure that the browser continues running in the background after | 2271 // Tests to ensure that the browser continues running in the background after |
2272 // the last window closes. | 2272 // the last window closes. |
2273 class NoStartupWindowTest : public BrowserTest { | 2273 class NoStartupWindowTest : public BrowserTest { |
2274 public: | 2274 public: |
2275 NoStartupWindowTest() {} | 2275 NoStartupWindowTest() {} |
2276 | 2276 |
2277 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 2277 virtual void SetUpCommandLine(CommandLine* command_line) override { |
2278 command_line->AppendSwitch(switches::kNoStartupWindow); | 2278 command_line->AppendSwitch(switches::kNoStartupWindow); |
2279 command_line->AppendSwitch(switches::kKeepAliveForTest); | 2279 command_line->AppendSwitch(switches::kKeepAliveForTest); |
2280 } | 2280 } |
2281 }; | 2281 }; |
2282 | 2282 |
2283 IN_PROC_BROWSER_TEST_F(NoStartupWindowTest, NoStartupWindowBasicTest) { | 2283 IN_PROC_BROWSER_TEST_F(NoStartupWindowTest, NoStartupWindowBasicTest) { |
2284 #if defined(OS_WIN) && defined(USE_ASH) | 2284 #if defined(OS_WIN) && defined(USE_ASH) |
2285 // kNoStartupWindow doesn't make sense in Metro+Ash. | 2285 // kNoStartupWindow doesn't make sense in Metro+Ash. |
2286 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) | 2286 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) |
2287 return; | 2287 return; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2321 ASSERT_FALSE(session_service->processed_any_commands()); | 2321 ASSERT_FALSE(session_service->processed_any_commands()); |
2322 } | 2322 } |
2323 #endif // !defined(OS_CHROMEOS) | 2323 #endif // !defined(OS_CHROMEOS) |
2324 | 2324 |
2325 // This test needs to be placed outside the anonymous namespace because we | 2325 // This test needs to be placed outside the anonymous namespace because we |
2326 // need to access private type of Browser. | 2326 // need to access private type of Browser. |
2327 class AppModeTest : public BrowserTest { | 2327 class AppModeTest : public BrowserTest { |
2328 public: | 2328 public: |
2329 AppModeTest() {} | 2329 AppModeTest() {} |
2330 | 2330 |
2331 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 2331 virtual void SetUpCommandLine(CommandLine* command_line) override { |
2332 GURL url = ui_test_utils::GetTestUrl( | 2332 GURL url = ui_test_utils::GetTestUrl( |
2333 base::FilePath(), base::FilePath().AppendASCII("title1.html")); | 2333 base::FilePath(), base::FilePath().AppendASCII("title1.html")); |
2334 command_line->AppendSwitchASCII(switches::kApp, url.spec()); | 2334 command_line->AppendSwitchASCII(switches::kApp, url.spec()); |
2335 } | 2335 } |
2336 }; | 2336 }; |
2337 | 2337 |
2338 IN_PROC_BROWSER_TEST_F(AppModeTest, EnableAppModeTest) { | 2338 IN_PROC_BROWSER_TEST_F(AppModeTest, EnableAppModeTest) { |
2339 #if defined(OS_WIN) && defined(USE_ASH) | 2339 #if defined(OS_WIN) && defined(USE_ASH) |
2340 // Disable this test in Metro+Ash for now (http://crbug.com/262796). | 2340 // Disable this test in Metro+Ash for now (http://crbug.com/262796). |
2341 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) | 2341 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2713 #endif | 2713 #endif |
2714 EXPECT_EQ(exp_commit_size, rwhv_commit_size2); | 2714 EXPECT_EQ(exp_commit_size, rwhv_commit_size2); |
2715 EXPECT_EQ(exp_commit_size, wcv_commit_size2); | 2715 EXPECT_EQ(exp_commit_size, wcv_commit_size2); |
2716 gfx::Size exp_final_size(initial_wcv_size); | 2716 gfx::Size exp_final_size(initial_wcv_size); |
2717 exp_final_size.Enlarge(wcv_resize_insets.width(), | 2717 exp_final_size.Enlarge(wcv_resize_insets.width(), |
2718 wcv_resize_insets.height() + height_inset); | 2718 wcv_resize_insets.height() + height_inset); |
2719 EXPECT_EQ(exp_final_size, | 2719 EXPECT_EQ(exp_final_size, |
2720 web_contents->GetRenderWidgetHostView()->GetViewBounds().size()); | 2720 web_contents->GetRenderWidgetHostView()->GetViewBounds().size()); |
2721 EXPECT_EQ(exp_final_size, web_contents->GetContainerBounds().size()); | 2721 EXPECT_EQ(exp_final_size, web_contents->GetContainerBounds().size()); |
2722 } | 2722 } |
OLD | NEW |