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

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

Issue 2835233002: Fix integration tests in src/chrome and src/extensions so that we can turn on IO thread checks wi... (Closed)
Patch Set: ready for review Created 3 years, 8 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"
11 #include "base/files/scoped_temp_dir.h" 11 #include "base/files/scoped_temp_dir.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/threading/thread_restrictions.h"
13 #include "build/build_config.h" 14 #include "build/build_config.h"
14 #include "chrome/browser/background/background_mode_manager.h" 15 #include "chrome/browser/background/background_mode_manager.h"
15 #include "chrome/browser/browser_process.h" 16 #include "chrome/browser/browser_process.h"
16 #include "chrome/browser/browser_shutdown.h" 17 #include "chrome/browser/browser_shutdown.h"
17 #include "chrome/browser/chrome_notification_types.h" 18 #include "chrome/browser/chrome_notification_types.h"
18 #include "chrome/browser/defaults.h" 19 #include "chrome/browser/defaults.h"
19 #include "chrome/browser/download/chrome_download_manager_delegate.h" 20 #include "chrome/browser/download/chrome_download_manager_delegate.h"
20 #include "chrome/browser/download/download_prefs.h" 21 #include "chrome/browser/download/download_prefs.h"
21 #include "chrome/browser/download/download_service.h" 22 #include "chrome/browser/download/download_service.h"
22 #include "chrome/browser/download/download_service_factory.h" 23 #include "chrome/browser/download/download_service_factory.h"
(...skipping 1133 matching lines...) Expand 10 before | Expand all | Expand 10 after
1156 EXPECT_EQ(1, DownloadService::NonMaliciousDownloadCountAllProfiles()); 1157 EXPECT_EQ(1, DownloadService::NonMaliciousDownloadCountAllProfiles());
1157 else 1158 else
1158 EXPECT_EQ(0, DownloadService::NonMaliciousDownloadCountAllProfiles()); 1159 EXPECT_EQ(0, DownloadService::NonMaliciousDownloadCountAllProfiles());
1159 } 1160 }
1160 1161
1161 // Test shutdown with a download in progress from one profile, where the only 1162 // Test shutdown with a download in progress from one profile, where the only
1162 // open windows are for another profile. 1163 // open windows are for another profile.
1163 IN_PROC_BROWSER_TEST_P(BrowserCloseManagerWithDownloadsBrowserTest, 1164 IN_PROC_BROWSER_TEST_P(BrowserCloseManagerWithDownloadsBrowserTest,
1164 TestWithDownloadsFromDifferentProfiles) { 1165 TestWithDownloadsFromDifferentProfiles) {
1165 ProfileManager* profile_manager = g_browser_process->profile_manager(); 1166 ProfileManager* profile_manager = g_browser_process->profile_manager();
1166 base::FilePath path = 1167 Profile* other_profile = nullptr;
1167 profile_manager->user_data_dir().AppendASCII("test_profile"); 1168 {
1168 if (!base::PathExists(path)) 1169 base::FilePath path =
1169 ASSERT_TRUE(base::CreateDirectory(path)); 1170 profile_manager->user_data_dir().AppendASCII("test_profile");
1170 Profile* other_profile = 1171 base::ThreadRestrictions::ScopedAllowIO allow_io;
1171 Profile::CreateProfile(path, NULL, Profile::CREATE_MODE_SYNCHRONOUS); 1172 if (!base::PathExists(path))
1173 ASSERT_TRUE(base::CreateDirectory(path));
1174 other_profile =
1175 Profile::CreateProfile(path, NULL, Profile::CREATE_MODE_SYNCHRONOUS);
1176 }
1172 profile_manager->RegisterTestingProfile(other_profile, true, false); 1177 profile_manager->RegisterTestingProfile(other_profile, true, false);
1173 Browser* other_profile_browser = CreateBrowser(other_profile); 1178 Browser* other_profile_browser = CreateBrowser(other_profile);
1174 1179
1175 ASSERT_TRUE(embedded_test_server()->Start()); 1180 ASSERT_TRUE(embedded_test_server()->Start());
1176 SetDownloadPathForProfile(browser()->profile()); 1181 SetDownloadPathForProfile(browser()->profile());
1177 SetDownloadPathForProfile(other_profile); 1182 SetDownloadPathForProfile(other_profile);
1178 ASSERT_NO_FATAL_FAILURE(CreateStalledDownload(browser())); 1183 ASSERT_NO_FATAL_FAILURE(CreateStalledDownload(browser()));
1179 { 1184 {
1180 RepeatedNotificationObserver close_observer( 1185 RepeatedNotificationObserver close_observer(
1181 chrome::NOTIFICATION_BROWSER_CLOSED, 1); 1186 chrome::NOTIFICATION_BROWSER_CLOSED, 1);
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
1335 1340
1336 chrome::CloseAllBrowsers(); 1341 chrome::CloseAllBrowsers();
1337 EXPECT_FALSE(browser_shutdown::IsTryingToQuit()); 1342 EXPECT_FALSE(browser_shutdown::IsTryingToQuit());
1338 EXPECT_TRUE(BrowserList::GetInstance()->empty()); 1343 EXPECT_TRUE(BrowserList::GetInstance()->empty());
1339 EXPECT_TRUE(IsBackgroundModeSuspended()); 1344 EXPECT_TRUE(IsBackgroundModeSuspended());
1340 } 1345 }
1341 1346
1342 INSTANTIATE_TEST_CASE_P(BrowserCloseManagerWithBackgroundModeBrowserTest, 1347 INSTANTIATE_TEST_CASE_P(BrowserCloseManagerWithBackgroundModeBrowserTest,
1343 BrowserCloseManagerWithBackgroundModeBrowserTest, 1348 BrowserCloseManagerWithBackgroundModeBrowserTest,
1344 testing::Bool()); 1349 testing::Bool());
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698