| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 544 | 544 |
| 545 EXPECT_TRUE(last_used_profile->IsSameProfile(active_profile)); | 545 EXPECT_TRUE(last_used_profile->IsSameProfile(active_profile)); |
| 546 } | 546 } |
| 547 #endif | 547 #endif |
| 548 | 548 |
| 549 TEST_F(ProfileManagerTest, AutoloadProfilesWithBackgroundApps) { | 549 TEST_F(ProfileManagerTest, AutoloadProfilesWithBackgroundApps) { |
| 550 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 550 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
| 551 ProfileAttributesStorage& storage = | 551 ProfileAttributesStorage& storage = |
| 552 profile_manager->GetProfileAttributesStorage(); | 552 profile_manager->GetProfileAttributesStorage(); |
| 553 local_state_.Get()->SetUserPref(prefs::kBackgroundModeEnabled, | 553 local_state_.Get()->SetUserPref(prefs::kBackgroundModeEnabled, |
| 554 new base::FundamentalValue(true)); | 554 new base::Value(true)); |
| 555 | 555 |
| 556 // Setting a pref which is not applicable to a system (i.e., Android in this | 556 // Setting a pref which is not applicable to a system (i.e., Android in this |
| 557 // case) does not necessarily create it. Don't bother continuing with the | 557 // case) does not necessarily create it. Don't bother continuing with the |
| 558 // test if this pref doesn't exist because it will not load the profiles if | 558 // test if this pref doesn't exist because it will not load the profiles if |
| 559 // it cannot verify that the pref for background mode is enabled. | 559 // it cannot verify that the pref for background mode is enabled. |
| 560 if (!local_state_.Get()->HasPrefPath(prefs::kBackgroundModeEnabled)) | 560 if (!local_state_.Get()->HasPrefPath(prefs::kBackgroundModeEnabled)) |
| 561 return; | 561 return; |
| 562 | 562 |
| 563 EXPECT_EQ(0u, storage.GetNumberOfProfiles()); | 563 EXPECT_EQ(0u, storage.GetNumberOfProfiles()); |
| 564 | 564 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 579 profile_manager->AutoloadProfiles(); | 579 profile_manager->AutoloadProfiles(); |
| 580 | 580 |
| 581 EXPECT_EQ(2u, profile_manager->GetLoadedProfiles().size()); | 581 EXPECT_EQ(2u, profile_manager->GetLoadedProfiles().size()); |
| 582 } | 582 } |
| 583 | 583 |
| 584 TEST_F(ProfileManagerTest, DoNotAutoloadProfilesIfBackgroundModeOff) { | 584 TEST_F(ProfileManagerTest, DoNotAutoloadProfilesIfBackgroundModeOff) { |
| 585 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 585 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
| 586 ProfileAttributesStorage& storage = | 586 ProfileAttributesStorage& storage = |
| 587 profile_manager->GetProfileAttributesStorage(); | 587 profile_manager->GetProfileAttributesStorage(); |
| 588 local_state_.Get()->SetUserPref(prefs::kBackgroundModeEnabled, | 588 local_state_.Get()->SetUserPref(prefs::kBackgroundModeEnabled, |
| 589 new base::FundamentalValue(false)); | 589 new base::Value(false)); |
| 590 | 590 |
| 591 EXPECT_EQ(0u, storage.GetNumberOfProfiles()); | 591 EXPECT_EQ(0u, storage.GetNumberOfProfiles()); |
| 592 | 592 |
| 593 storage.AddProfile(profile_manager->user_data_dir().AppendASCII("path_1"), | 593 storage.AddProfile(profile_manager->user_data_dir().AppendASCII("path_1"), |
| 594 ASCIIToUTF16("name_1"), "12345", base::string16(), 0, std::string()); | 594 ASCIIToUTF16("name_1"), "12345", base::string16(), 0, std::string()); |
| 595 storage.AddProfile(profile_manager->user_data_dir().AppendASCII("path_2"), | 595 storage.AddProfile(profile_manager->user_data_dir().AppendASCII("path_2"), |
| 596 ASCIIToUTF16("name_2"), "23456", base::string16(), 0, std::string()); | 596 ASCIIToUTF16("name_2"), "23456", base::string16(), 0, std::string()); |
| 597 | 597 |
| 598 EXPECT_EQ(2u, storage.GetNumberOfProfiles()); | 598 EXPECT_EQ(2u, storage.GetNumberOfProfiles()); |
| 599 | 599 |
| (...skipping 843 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1443 dest_path2.BaseName().MaybeAsASCII()); | 1443 dest_path2.BaseName().MaybeAsASCII()); |
| 1444 profile_manager->ScheduleProfileForDeletion(dest_path2, | 1444 profile_manager->ScheduleProfileForDeletion(dest_path2, |
| 1445 ProfileManager::CreateCallback()); | 1445 ProfileManager::CreateCallback()); |
| 1446 // Spin the message loop so that all the callbacks can finish running. | 1446 // Spin the message loop so that all the callbacks can finish running. |
| 1447 base::RunLoop().RunUntilIdle(); | 1447 base::RunLoop().RunUntilIdle(); |
| 1448 | 1448 |
| 1449 EXPECT_EQ(dest_path3, profile_manager->GetLastUsedProfile()->GetPath()); | 1449 EXPECT_EQ(dest_path3, profile_manager->GetLastUsedProfile()->GetPath()); |
| 1450 EXPECT_EQ(profile_name3, local_state->GetString(prefs::kProfileLastUsed)); | 1450 EXPECT_EQ(profile_name3, local_state->GetString(prefs::kProfileLastUsed)); |
| 1451 } | 1451 } |
| 1452 #endif // !defined(OS_MACOSX) | 1452 #endif // !defined(OS_MACOSX) |
| OLD | NEW |