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

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

Issue 1551503002: Convert Pass()→std::move() in //chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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"
6
7 #include <utility>
5 #include <vector> 8 #include <vector>
6 9
7 #include "base/command_line.h" 10 #include "base/command_line.h"
8 #include "base/files/scoped_temp_dir.h" 11 #include "base/files/scoped_temp_dir.h"
9 #include "base/macros.h" 12 #include "base/macros.h"
10 #include "build/build_config.h" 13 #include "build/build_config.h"
11 #include "chrome/browser/background/background_mode_manager.h" 14 #include "chrome/browser/background/background_mode_manager.h"
12 #include "chrome/browser/browser_process.h" 15 #include "chrome/browser/browser_process.h"
13 #include "chrome/browser/browser_shutdown.h" 16 #include "chrome/browser/browser_shutdown.h"
14 #include "chrome/browser/chrome_notification_types.h" 17 #include "chrome/browser/chrome_notification_types.h"
15 #include "chrome/browser/defaults.h" 18 #include "chrome/browser/defaults.h"
16 #include "chrome/browser/download/chrome_download_manager_delegate.h" 19 #include "chrome/browser/download/chrome_download_manager_delegate.h"
17 #include "chrome/browser/download/download_prefs.h" 20 #include "chrome/browser/download/download_prefs.h"
18 #include "chrome/browser/download/download_service.h" 21 #include "chrome/browser/download/download_service.h"
19 #include "chrome/browser/download/download_service_factory.h" 22 #include "chrome/browser/download/download_service_factory.h"
20 #include "chrome/browser/lifetime/application_lifetime.h" 23 #include "chrome/browser/lifetime/application_lifetime.h"
21 #include "chrome/browser/lifetime/browser_close_manager.h"
22 #include "chrome/browser/net/url_request_mock_util.h" 24 #include "chrome/browser/net/url_request_mock_util.h"
23 #include "chrome/browser/prefs/session_startup_pref.h" 25 #include "chrome/browser/prefs/session_startup_pref.h"
24 #include "chrome/browser/profiles/profile.h" 26 #include "chrome/browser/profiles/profile.h"
25 #include "chrome/browser/profiles/profile_manager.h" 27 #include "chrome/browser/profiles/profile_manager.h"
26 #include "chrome/browser/ui/browser.h" 28 #include "chrome/browser/ui/browser.h"
27 #include "chrome/browser/ui/browser_commands.h" 29 #include "chrome/browser/ui/browser_commands.h"
28 #include "chrome/browser/ui/browser_iterator.h" 30 #include "chrome/browser/ui/browser_iterator.h"
29 #include "chrome/browser/ui/browser_window.h" 31 #include "chrome/browser/ui/browser_window.h"
30 #include "chrome/browser/ui/tabs/tab_strip_model.h" 32 #include "chrome/browser/ui/tabs/tab_strip_model.h"
31 #include "chrome/common/chrome_switches.h" 33 #include "chrome/common/chrome_switches.h"
(...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after
755 // Test shutdown with a DANGEROUS_URL download undecided. 757 // Test shutdown with a DANGEROUS_URL download undecided.
756 IN_PROC_BROWSER_TEST_P(BrowserCloseManagerWithDownloadsBrowserTest, 758 IN_PROC_BROWSER_TEST_P(BrowserCloseManagerWithDownloadsBrowserTest,
757 TestWithDangerousUrlDownload) { 759 TestWithDangerousUrlDownload) {
758 ASSERT_TRUE(embedded_test_server()->Start()); 760 ASSERT_TRUE(embedded_test_server()->Start());
759 SetDownloadPathForProfile(browser()->profile()); 761 SetDownloadPathForProfile(browser()->profile());
760 762
761 // Set up the fake delegate that forces the download to be malicious. 763 // Set up the fake delegate that forces the download to be malicious.
762 scoped_ptr<TestDownloadManagerDelegate> test_delegate( 764 scoped_ptr<TestDownloadManagerDelegate> test_delegate(
763 new TestDownloadManagerDelegate(browser()->profile())); 765 new TestDownloadManagerDelegate(browser()->profile()));
764 DownloadServiceFactory::GetForBrowserContext(browser()->profile()) 766 DownloadServiceFactory::GetForBrowserContext(browser()->profile())
765 ->SetDownloadManagerDelegateForTesting(test_delegate.Pass()); 767 ->SetDownloadManagerDelegateForTesting(std::move(test_delegate));
766 768
767 // Run a dangerous download, but the user doesn't make a decision. 769 // Run a dangerous download, but the user doesn't make a decision.
768 // This .swf normally would be categorized as DANGEROUS_FILE, but 770 // This .swf normally would be categorized as DANGEROUS_FILE, but
769 // TestDownloadManagerDelegate turns it into DANGEROUS_URL. 771 // TestDownloadManagerDelegate turns it into DANGEROUS_URL.
770 GURL download_url(net::URLRequestMockHTTPJob::GetMockUrl( 772 GURL download_url(net::URLRequestMockHTTPJob::GetMockUrl(
771 "downloads/dangerous/dangerous.swf")); 773 "downloads/dangerous/dangerous.swf"));
772 content::DownloadTestObserverInterrupted observer( 774 content::DownloadTestObserverInterrupted observer(
773 content::BrowserContext::GetDownloadManager(browser()->profile()), 775 content::BrowserContext::GetDownloadManager(browser()->profile()),
774 1, 776 1,
775 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_QUIT); 777 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_QUIT);
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
1034 1036
1035 chrome::CloseAllBrowsers(); 1037 chrome::CloseAllBrowsers();
1036 EXPECT_FALSE(browser_shutdown::IsTryingToQuit()); 1038 EXPECT_FALSE(browser_shutdown::IsTryingToQuit());
1037 EXPECT_TRUE(chrome::BrowserIterator().done()); 1039 EXPECT_TRUE(chrome::BrowserIterator().done());
1038 EXPECT_TRUE(IsBackgroundModeSuspended()); 1040 EXPECT_TRUE(IsBackgroundModeSuspended());
1039 } 1041 }
1040 1042
1041 INSTANTIATE_TEST_CASE_P(BrowserCloseManagerWithBackgroundModeBrowserTest, 1043 INSTANTIATE_TEST_CASE_P(BrowserCloseManagerWithBackgroundModeBrowserTest,
1042 BrowserCloseManagerWithBackgroundModeBrowserTest, 1044 BrowserCloseManagerWithBackgroundModeBrowserTest,
1043 testing::Bool()); 1045 testing::Bool());
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698