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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 run_loop->Quit(); | 47 run_loop->Quit(); |
48 } | 48 } |
49 | 49 |
50 void ProfileCreationComplete(Profile* profile, Profile::CreateStatus status) { | 50 void ProfileCreationComplete(Profile* profile, Profile::CreateStatus status) { |
51 ASSERT_NE(status, Profile::CREATE_STATUS_LOCAL_FAIL); | 51 ASSERT_NE(status, Profile::CREATE_STATUS_LOCAL_FAIL); |
52 ASSERT_NE(status, Profile::CREATE_STATUS_REMOTE_FAIL); | 52 ASSERT_NE(status, Profile::CREATE_STATUS_REMOTE_FAIL); |
53 // No browser should have been created for this profile yet. | 53 // No browser should have been created for this profile yet. |
54 EXPECT_EQ(chrome::GetTotalBrowserCountForProfile(profile), 0U); | 54 EXPECT_EQ(chrome::GetTotalBrowserCountForProfile(profile), 0U); |
55 EXPECT_EQ(chrome::GetTotalBrowserCount(), 1U); | 55 EXPECT_EQ(chrome::GetTotalBrowserCount(), 1U); |
56 if (status == Profile::CREATE_STATUS_INITIALIZED) | 56 if (status == Profile::CREATE_STATUS_INITIALIZED) |
57 base::MessageLoop::current()->Quit(); | 57 base::MessageLoop::current()->QuitWhenIdle(); |
58 } | 58 } |
59 | 59 |
60 void EphemeralProfileCreationComplete(Profile* profile, | 60 void EphemeralProfileCreationComplete(Profile* profile, |
61 Profile::CreateStatus status) { | 61 Profile::CreateStatus status) { |
62 if (status == Profile::CREATE_STATUS_INITIALIZED) | 62 if (status == Profile::CREATE_STATUS_INITIALIZED) |
63 profile->GetPrefs()->SetBoolean(prefs::kForceEphemeralProfiles, true); | 63 profile->GetPrefs()->SetBoolean(prefs::kForceEphemeralProfiles, true); |
64 ProfileCreationComplete(profile, status); | 64 ProfileCreationComplete(profile, status); |
65 } | 65 } |
66 | 66 |
67 class ProfileRemovalObserver : public ProfileInfoCacheObserver { | 67 class ProfileRemovalObserver : public ProfileInfoCacheObserver { |
(...skipping 387 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 |