| OLD | NEW |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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 <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/callback_list.h" | 9 #include "base/callback_list.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
| 13 #include "base/threading/thread_restrictions.h" |
| 13 #include "base/win/windows_version.h" | 14 #include "base/win/windows_version.h" |
| 14 #include "chrome/browser/browser_process.h" | 15 #include "chrome/browser/browser_process.h" |
| 15 #include "chrome/browser/lifetime/keep_alive_types.h" | 16 #include "chrome/browser/lifetime/keep_alive_types.h" |
| 16 #include "chrome/browser/lifetime/scoped_keep_alive.h" | 17 #include "chrome/browser/lifetime/scoped_keep_alive.h" |
| 17 #include "chrome/browser/profile_resetter/triggered_profile_resetter.h" | 18 #include "chrome/browser/profile_resetter/triggered_profile_resetter.h" |
| 18 #include "chrome/browser/profile_resetter/triggered_profile_resetter_factory.h" | 19 #include "chrome/browser/profile_resetter/triggered_profile_resetter_factory.h" |
| 19 #include "chrome/browser/profiles/profile_manager.h" | 20 #include "chrome/browser/profiles/profile_manager.h" |
| 20 #include "chrome/browser/signin/signin_promo.h" | 21 #include "chrome/browser/signin/signin_promo.h" |
| 21 #include "chrome/browser/ui/browser.h" | 22 #include "chrome/browser/ui/browser.h" |
| 22 #include "chrome/browser/ui/browser_finder.h" | 23 #include "chrome/browser/ui/browser_finder.h" |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 | 230 |
| 230 // This should have created a new browser window. |browser()| is still | 231 // This should have created a new browser window. |browser()| is still |
| 231 // around at this point, even though we've closed its window. | 232 // around at this point, even though we've closed its window. |
| 232 Browser* new_browser = FindOneOtherBrowser(browser()); | 233 Browser* new_browser = FindOneOtherBrowser(browser()); |
| 233 ASSERT_TRUE(new_browser); | 234 ASSERT_TRUE(new_browser); |
| 234 | 235 |
| 235 // Now create a second browser instance pointing to a different profile. | 236 // Now create a second browser instance pointing to a different profile. |
| 236 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 237 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
| 237 base::FilePath path = | 238 base::FilePath path = |
| 238 profile_manager->user_data_dir().AppendASCII("test_profile"); | 239 profile_manager->user_data_dir().AppendASCII("test_profile"); |
| 239 Profile* other_profile = | 240 Profile* other_profile = nullptr; |
| 240 Profile::CreateProfile(path, nullptr, Profile::CREATE_MODE_SYNCHRONOUS); | 241 { |
| 242 base::ThreadRestrictions::ScopedAllowIO allow_io; |
| 243 other_profile = |
| 244 Profile::CreateProfile(path, nullptr, Profile::CREATE_MODE_SYNCHRONOUS); |
| 245 } |
| 241 profile_manager->RegisterTestingProfile(other_profile, true, false); | 246 profile_manager->RegisterTestingProfile(other_profile, true, false); |
| 242 | 247 |
| 243 // Use a couple same-site HTTP URLs. | 248 // Use a couple same-site HTTP URLs. |
| 244 ASSERT_TRUE(embedded_test_server()->Start()); | 249 ASSERT_TRUE(embedded_test_server()->Start()); |
| 245 std::vector<GURL> urls; | 250 std::vector<GURL> urls; |
| 246 urls.push_back(embedded_test_server()->GetURL("/title1.html")); | 251 urls.push_back(embedded_test_server()->GetURL("/title1.html")); |
| 247 urls.push_back(embedded_test_server()->GetURL("/title2.html")); | 252 urls.push_back(embedded_test_server()->GetURL("/title2.html")); |
| 248 | 253 |
| 249 // Set the startup preference to open these URLs. | 254 // Set the startup preference to open these URLs. |
| 250 SessionStartupPref other_prefs(SessionStartupPref::URLS); | 255 SessionStartupPref other_prefs(SessionStartupPref::URLS); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 264 Browser* other_profile_browser = | 269 Browser* other_profile_browser = |
| 265 chrome::FindBrowserWithProfile(other_profile); | 270 chrome::FindBrowserWithProfile(other_profile); |
| 266 ASSERT_NE(nullptr, other_profile_browser); | 271 ASSERT_NE(nullptr, other_profile_browser); |
| 267 | 272 |
| 268 // Check for the expected reset dialog in the second browser too. | 273 // Check for the expected reset dialog in the second browser too. |
| 269 TabStripModel* other_tab_strip = other_profile_browser->tab_strip_model(); | 274 TabStripModel* other_tab_strip = other_profile_browser->tab_strip_model(); |
| 270 ASSERT_LT(0, other_tab_strip->count()); | 275 ASSERT_LT(0, other_tab_strip->count()); |
| 271 EXPECT_EQ(internals::GetTriggeredResetSettingsURL(), | 276 EXPECT_EQ(internals::GetTriggeredResetSettingsURL(), |
| 272 other_tab_strip->GetActiveWebContents()->GetURL()); | 277 other_tab_strip->GetActiveWebContents()->GetURL()); |
| 273 } | 278 } |
| OLD | NEW |