| 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
| 9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 class MockObserver { | 96 class MockObserver { |
| 97 public: | 97 public: |
| 98 MOCK_METHOD2(OnProfileCreated, | 98 MOCK_METHOD2(OnProfileCreated, |
| 99 void(Profile* profile, Profile::CreateStatus status)); | 99 void(Profile* profile, Profile::CreateStatus status)); |
| 100 }; | 100 }; |
| 101 | 101 |
| 102 ProfileManagerTest() | 102 ProfileManagerTest() |
| 103 : local_state_(TestingBrowserProcess::GetGlobal()) { | 103 : local_state_(TestingBrowserProcess::GetGlobal()) { |
| 104 } | 104 } |
| 105 | 105 |
| 106 static void SetUpTestCase() { |
| 107 // Checking last used profile checks for incognito, requiring platform |
| 108 // parental controls initialization. |
| 109 IncognitoModePrefs::InitializePlatformParentalControls(); |
| 110 } |
| 111 |
| 112 static void TearDownTestCase() { |
| 113 IncognitoModePrefs::UninitializePlatformParentalControls(); |
| 114 } |
| 115 |
| 106 void SetUp() override { | 116 void SetUp() override { |
| 107 // Create a new temporary directory, and store the path | 117 // Create a new temporary directory, and store the path |
| 108 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 118 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
| 109 TestingBrowserProcess::GetGlobal()->SetProfileManager( | 119 TestingBrowserProcess::GetGlobal()->SetProfileManager( |
| 110 new UnittestProfileManager(temp_dir_.path())); | 120 new UnittestProfileManager(temp_dir_.path())); |
| 111 | 121 |
| 112 #if defined(OS_CHROMEOS) | 122 #if defined(OS_CHROMEOS) |
| 113 base::CommandLine* cl = base::CommandLine::ForCurrentProcess(); | 123 base::CommandLine* cl = base::CommandLine::ForCurrentProcess(); |
| 114 cl->AppendSwitch(switches::kTestType); | 124 cl->AppendSwitch(switches::kTestType); |
| 115 #endif | 125 #endif |
| (...skipping 1183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1299 dest_path2.BaseName().MaybeAsASCII()); | 1309 dest_path2.BaseName().MaybeAsASCII()); |
| 1300 profile_manager->ScheduleProfileForDeletion(dest_path2, | 1310 profile_manager->ScheduleProfileForDeletion(dest_path2, |
| 1301 ProfileManager::CreateCallback()); | 1311 ProfileManager::CreateCallback()); |
| 1302 // Spin the message loop so that all the callbacks can finish running. | 1312 // Spin the message loop so that all the callbacks can finish running. |
| 1303 base::RunLoop().RunUntilIdle(); | 1313 base::RunLoop().RunUntilIdle(); |
| 1304 | 1314 |
| 1305 EXPECT_EQ(dest_path3, profile_manager->GetLastUsedProfile()->GetPath()); | 1315 EXPECT_EQ(dest_path3, profile_manager->GetLastUsedProfile()->GetPath()); |
| 1306 EXPECT_EQ(profile_name3, local_state->GetString(prefs::kProfileLastUsed)); | 1316 EXPECT_EQ(profile_name3, local_state->GetString(prefs::kProfileLastUsed)); |
| 1307 } | 1317 } |
| 1308 #endif // !defined(OS_MACOSX) | 1318 #endif // !defined(OS_MACOSX) |
| OLD | NEW |