| 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "chrome/browser/password_manager/password_store_factory.h" | 9 #include "chrome/browser/password_manager/password_store_factory.h" |
| 10 #include "chrome/browser/profiles/profile_info_cache.h" | 10 #include "chrome/browser/profiles/profile_info_cache.h" |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 profile_manager->GenerateNextProfileDirectoryPath(); | 312 profile_manager->GenerateNextProfileDirectoryPath(); |
| 313 base::RunLoop run_loop; | 313 base::RunLoop run_loop; |
| 314 profile_manager->CreateProfileAsync( | 314 profile_manager->CreateProfileAsync( |
| 315 path_profile2, base::Bind(&OnUnblockOnProfileCreation, &run_loop), | 315 path_profile2, base::Bind(&OnUnblockOnProfileCreation, &run_loop), |
| 316 base::string16(), base::string16(), std::string()); | 316 base::string16(), base::string16(), std::string()); |
| 317 | 317 |
| 318 // Run the message loop to allow profile creation to take place; the loop is | 318 // Run the message loop to allow profile creation to take place; the loop is |
| 319 // terminated by OnUnblockOnProfileCreation when the profile is created. | 319 // terminated by OnUnblockOnProfileCreation when the profile is created. |
| 320 run_loop.Run(); | 320 run_loop.Run(); |
| 321 | 321 |
| 322 chrome::HostDesktopType desktop_type = chrome::GetActiveDesktop(); | 322 ui::HostDesktopType desktop_type = chrome::GetActiveDesktop(); |
| 323 BrowserList* browser_list = BrowserList::GetInstance(desktop_type); | 323 BrowserList* browser_list = BrowserList::GetInstance(desktop_type); |
| 324 ASSERT_EQ(initial_profile_count + 1, cache.GetNumberOfProfiles()); | 324 ASSERT_EQ(initial_profile_count + 1, cache.GetNumberOfProfiles()); |
| 325 EXPECT_EQ(1U, browser_list->size()); | 325 EXPECT_EQ(1U, browser_list->size()); |
| 326 | 326 |
| 327 // Open a browser window for the first profile. | 327 // Open a browser window for the first profile. |
| 328 profiles::SwitchToProfile(path_profile1, desktop_type, false, | 328 profiles::SwitchToProfile(path_profile1, desktop_type, false, |
| 329 kOnProfileSwitchDoNothing, | 329 kOnProfileSwitchDoNothing, |
| 330 ProfileMetrics::SWITCH_PROFILE_ICON); | 330 ProfileMetrics::SWITCH_PROFILE_ICON); |
| 331 EXPECT_EQ(1U, chrome::GetTotalBrowserCount()); | 331 EXPECT_EQ(1U, chrome::GetTotalBrowserCount()); |
| 332 EXPECT_EQ(1U, browser_list->size()); | 332 EXPECT_EQ(1U, browser_list->size()); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 base::FilePath path_profile2 = | 381 base::FilePath path_profile2 = |
| 382 profile_manager->GenerateNextProfileDirectoryPath(); | 382 profile_manager->GenerateNextProfileDirectoryPath(); |
| 383 profile_manager->CreateProfileAsync( | 383 profile_manager->CreateProfileAsync( |
| 384 path_profile2, | 384 path_profile2, |
| 385 base::Bind(&EphemeralProfileCreationComplete), | 385 base::Bind(&EphemeralProfileCreationComplete), |
| 386 base::string16(), base::string16(), std::string()); | 386 base::string16(), base::string16(), std::string()); |
| 387 | 387 |
| 388 // Spin to allow profile creation to take place. | 388 // Spin to allow profile creation to take place. |
| 389 content::RunMessageLoop(); | 389 content::RunMessageLoop(); |
| 390 | 390 |
| 391 chrome::HostDesktopType desktop_type = chrome::GetActiveDesktop(); | 391 ui::HostDesktopType desktop_type = chrome::GetActiveDesktop(); |
| 392 BrowserList* browser_list = BrowserList::GetInstance(desktop_type); | 392 BrowserList* browser_list = BrowserList::GetInstance(desktop_type); |
| 393 ASSERT_EQ(initial_profile_count + 1, cache.GetNumberOfProfiles()); | 393 ASSERT_EQ(initial_profile_count + 1, cache.GetNumberOfProfiles()); |
| 394 EXPECT_EQ(1U, browser_list->size()); | 394 EXPECT_EQ(1U, browser_list->size()); |
| 395 | 395 |
| 396 // Open a browser window for the second profile. | 396 // Open a browser window for the second profile. |
| 397 profiles::SwitchToProfile(path_profile2, desktop_type, false, | 397 profiles::SwitchToProfile(path_profile2, desktop_type, false, |
| 398 kOnProfileSwitchDoNothing, | 398 kOnProfileSwitchDoNothing, |
| 399 ProfileMetrics::SWITCH_PROFILE_ICON); | 399 ProfileMetrics::SWITCH_PROFILE_ICON); |
| 400 EXPECT_EQ(2U, chrome::GetTotalBrowserCount()); | 400 EXPECT_EQ(2U, chrome::GetTotalBrowserCount()); |
| 401 EXPECT_EQ(2U, browser_list->size()); | 401 EXPECT_EQ(2U, browser_list->size()); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 profile_manager->ScheduleProfileForDeletion( | 455 profile_manager->ScheduleProfileForDeletion( |
| 456 profile->GetPath(), base::Bind(&OnUnblockOnProfileCreation, &run_loop)); | 456 profile->GetPath(), base::Bind(&OnUnblockOnProfileCreation, &run_loop)); |
| 457 run_loop.Run(); | 457 run_loop.Run(); |
| 458 | 458 |
| 459 PasswordStoreConsumerVerifier verify_delete; | 459 PasswordStoreConsumerVerifier verify_delete; |
| 460 password_store->GetAutofillableLogins(&verify_delete); | 460 password_store->GetAutofillableLogins(&verify_delete); |
| 461 verify_delete.Wait(); | 461 verify_delete.Wait(); |
| 462 EXPECT_EQ(0u, verify_delete.GetPasswords().size()); | 462 EXPECT_EQ(0u, verify_delete.GetPasswords().size()); |
| 463 } | 463 } |
| 464 #endif // !defined(OS_WIN) && !defined(OS_ANDROID) && !defined(OS_CHROMEOS) | 464 #endif // !defined(OS_WIN) && !defined(OS_ANDROID) && !defined(OS_CHROMEOS) |
| OLD | NEW |