Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(126)

Side by Side Diff: chrome/browser/lifetime/browser_close_manager_browsertest.cc

Issue 2248873002: Convert WindowOpenDisposition to an enum class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/lifetime/browser_close_manager.h" 5 #include "chrome/browser/lifetime/browser_close_manager.h"
6 6
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 #if defined(OS_CHROMEOS) 238 #if defined(OS_CHROMEOS)
239 command_line->AppendSwitch( 239 command_line->AppendSwitch(
240 chromeos::switches::kIgnoreUserProfileMappingForTests); 240 chromeos::switches::kIgnoreUserProfileMappingForTests);
241 #endif 241 #endif
242 } 242 }
243 243
244 void CreateStalledDownload(Browser* browser) { 244 void CreateStalledDownload(Browser* browser) {
245 content::DownloadTestObserverInProgress observer( 245 content::DownloadTestObserverInProgress observer(
246 content::BrowserContext::GetDownloadManager(browser->profile()), 1); 246 content::BrowserContext::GetDownloadManager(browser->profile()), 1);
247 ui_test_utils::NavigateToURLWithDisposition( 247 ui_test_utils::NavigateToURLWithDisposition(
248 browser, 248 browser, GURL(net::URLRequestSlowDownloadJob::kKnownSizeUrl),
249 GURL(net::URLRequestSlowDownloadJob::kKnownSizeUrl), 249 WindowOpenDisposition::NEW_BACKGROUND_TAB,
250 NEW_BACKGROUND_TAB,
251 ui_test_utils::BROWSER_TEST_NONE); 250 ui_test_utils::BROWSER_TEST_NONE);
252 observer.WaitForFinished(); 251 observer.WaitForFinished();
253 EXPECT_EQ( 252 EXPECT_EQ(
254 1UL, 253 1UL,
255 observer.NumDownloadsSeenInState(content::DownloadItem::IN_PROGRESS)); 254 observer.NumDownloadsSeenInState(content::DownloadItem::IN_PROGRESS));
256 } 255 }
257 256
258 // Makes sure that hang monitor will not trigger RendererUnresponsive 257 // Makes sure that hang monitor will not trigger RendererUnresponsive
259 // for that web content or browser. That must be called before close action 258 // for that web content or browser. That must be called before close action
260 // when using |AcceptClose| or |CancelClose|, to ensure the timeout does not 259 // when using |AcceptClose| or |CancelClose|, to ensure the timeout does not
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 chrome::NOTIFICATION_BROWSER_CLOSE_CANCELLED, 1); 335 chrome::NOTIFICATION_BROWSER_CLOSE_CANCELLED, 1);
337 chrome::CloseAllBrowsersAndQuit(); 336 chrome::CloseAllBrowsersAndQuit();
338 ASSERT_NO_FATAL_FAILURE(CancelClose()); 337 ASSERT_NO_FATAL_FAILURE(CancelClose());
339 cancel_observer.Wait(); 338 cancel_observer.Wait();
340 EXPECT_FALSE(browser_shutdown::IsTryingToQuit()); 339 EXPECT_FALSE(browser_shutdown::IsTryingToQuit());
341 340
342 browser()->tab_strip_model() 341 browser()->tab_strip_model()
343 ->CloseWebContentsAt(1, TabStripModel::CLOSE_USER_GESTURE); 342 ->CloseWebContentsAt(1, TabStripModel::CLOSE_USER_GESTURE);
344 content::TestNavigationObserver navigation_observer( 343 content::TestNavigationObserver navigation_observer(
345 browser()->tab_strip_model()->GetActiveWebContents(), 1); 344 browser()->tab_strip_model()->GetActiveWebContents(), 1);
346 ASSERT_NO_FATAL_FAILURE( 345 ASSERT_NO_FATAL_FAILURE(NavigateToURLWithDisposition(
347 NavigateToURLWithDisposition(browser(), 346 browser(), GURL(chrome::kChromeUIVersionURL),
348 GURL(chrome::kChromeUIVersionURL), 347 WindowOpenDisposition::CURRENT_TAB, ui_test_utils::BROWSER_TEST_NONE));
349 CURRENT_TAB,
350 ui_test_utils::BROWSER_TEST_NONE));
351 ASSERT_NO_FATAL_FAILURE(AcceptClose()); 348 ASSERT_NO_FATAL_FAILURE(AcceptClose());
352 navigation_observer.Wait(); 349 navigation_observer.Wait();
353 350
354 RepeatedNotificationObserver close_observer( 351 RepeatedNotificationObserver close_observer(
355 chrome::NOTIFICATION_BROWSER_CLOSED, 1); 352 chrome::NOTIFICATION_BROWSER_CLOSED, 1);
356 chrome::CloseAllBrowsersAndQuit(); 353 chrome::CloseAllBrowsersAndQuit();
357 close_observer.Wait(); 354 close_observer.Wait();
358 EXPECT_TRUE(browser_shutdown::IsTryingToQuit()); 355 EXPECT_TRUE(browser_shutdown::IsTryingToQuit());
359 EXPECT_TRUE(BrowserList::GetInstance()->empty()); 356 EXPECT_TRUE(BrowserList::GetInstance()->empty());
360 } 357 }
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
883 // Run a dangerous download, but the user doesn't make a decision. 880 // Run a dangerous download, but the user doesn't make a decision.
884 // This .swf normally would be categorized as DANGEROUS_FILE, but 881 // This .swf normally would be categorized as DANGEROUS_FILE, but
885 // TestDownloadManagerDelegate turns it into DANGEROUS_URL. 882 // TestDownloadManagerDelegate turns it into DANGEROUS_URL.
886 GURL download_url(net::URLRequestMockHTTPJob::GetMockUrl( 883 GURL download_url(net::URLRequestMockHTTPJob::GetMockUrl(
887 "downloads/dangerous/dangerous.swf")); 884 "downloads/dangerous/dangerous.swf"));
888 content::DownloadTestObserverInterrupted observer( 885 content::DownloadTestObserverInterrupted observer(
889 content::BrowserContext::GetDownloadManager(browser()->profile()), 886 content::BrowserContext::GetDownloadManager(browser()->profile()),
890 1, 887 1,
891 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_QUIT); 888 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_QUIT);
892 ui_test_utils::NavigateToURLWithDisposition( 889 ui_test_utils::NavigateToURLWithDisposition(
893 browser(), 890 browser(), GURL(download_url), WindowOpenDisposition::NEW_BACKGROUND_TAB,
894 GURL(download_url),
895 NEW_BACKGROUND_TAB,
896 ui_test_utils::BROWSER_TEST_NONE); 891 ui_test_utils::BROWSER_TEST_NONE);
897 observer.WaitForFinished(); 892 observer.WaitForFinished();
898 893
899 // Check that the download manager has the expected state. 894 // Check that the download manager has the expected state.
900 EXPECT_EQ(1, content::BrowserContext::GetDownloadManager( 895 EXPECT_EQ(1, content::BrowserContext::GetDownloadManager(
901 browser()->profile())->InProgressCount()); 896 browser()->profile())->InProgressCount());
902 EXPECT_EQ(0, content::BrowserContext::GetDownloadManager( 897 EXPECT_EQ(0, content::BrowserContext::GetDownloadManager(
903 browser()->profile())->NonMaliciousInProgressCount()); 898 browser()->profile())->NonMaliciousInProgressCount());
904 899
905 // Close the browser with no user action. 900 // Close the browser with no user action.
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
1152 1147
1153 chrome::CloseAllBrowsers(); 1148 chrome::CloseAllBrowsers();
1154 EXPECT_FALSE(browser_shutdown::IsTryingToQuit()); 1149 EXPECT_FALSE(browser_shutdown::IsTryingToQuit());
1155 EXPECT_TRUE(BrowserList::GetInstance()->empty()); 1150 EXPECT_TRUE(BrowserList::GetInstance()->empty());
1156 EXPECT_TRUE(IsBackgroundModeSuspended()); 1151 EXPECT_TRUE(IsBackgroundModeSuspended());
1157 } 1152 }
1158 1153
1159 INSTANTIATE_TEST_CASE_P(BrowserCloseManagerWithBackgroundModeBrowserTest, 1154 INSTANTIATE_TEST_CASE_P(BrowserCloseManagerWithBackgroundModeBrowserTest,
1160 BrowserCloseManagerWithBackgroundModeBrowserTest, 1155 BrowserCloseManagerWithBackgroundModeBrowserTest,
1161 testing::Bool()); 1156 testing::Bool());
OLDNEW
« no previous file with comments | « chrome/browser/interstitials/chrome_controller_client.cc ('k') | chrome/browser/media/defer_background_media_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698