Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: chrome/browser/profiles/profile_manager_unittest.cc

Issue 950053002: Cache the Windows Parental Controls Platform Answer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Synced and All Unit Tests Fixed Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 #include "chrome/browser/chromeos/login/users/scoped_test_user_manager.h" 48 #include "chrome/browser/chromeos/login/users/scoped_test_user_manager.h"
49 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" 49 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h"
50 #include "chrome/browser/chromeos/profiles/profile_helper.h" 50 #include "chrome/browser/chromeos/profiles/profile_helper.h"
51 #include "chrome/browser/chromeos/settings/cros_settings.h" 51 #include "chrome/browser/chromeos/settings/cros_settings.h"
52 #include "chrome/browser/chromeos/settings/device_settings_service.h" 52 #include "chrome/browser/chromeos/settings/device_settings_service.h"
53 #include "chromeos/chromeos_switches.h" 53 #include "chromeos/chromeos_switches.h"
54 #include "chromeos/login/user_names.h" 54 #include "chromeos/login/user_names.h"
55 #include "components/user_manager/user_manager.h" 55 #include "components/user_manager/user_manager.h"
56 #endif // defined(OS_CHROMEOS) 56 #endif // defined(OS_CHROMEOS)
57 57
58 #if defined(OS_WIN)
59 #include "chrome/browser/prefs/incognito_mode_prefs.h"
60 #endif // defined(OS_WIN)
61
58 using base::ASCIIToUTF16; 62 using base::ASCIIToUTF16;
59 using content::BrowserThread; 63 using content::BrowserThread;
60 64
61 namespace { 65 namespace {
62 66
63 // This global variable is used to check that value returned to different 67 // This global variable is used to check that value returned to different
64 // observers is the same. 68 // observers is the same.
65 Profile* g_created_profile; 69 Profile* g_created_profile;
66 70
67 class UnittestProfileManager : public ::ProfileManagerWithoutInit { 71 class UnittestProfileManager : public ::ProfileManagerWithoutInit {
(...skipping 28 matching lines...) Expand all
96 class MockObserver { 100 class MockObserver {
97 public: 101 public:
98 MOCK_METHOD2(OnProfileCreated, 102 MOCK_METHOD2(OnProfileCreated,
99 void(Profile* profile, Profile::CreateStatus status)); 103 void(Profile* profile, Profile::CreateStatus status));
100 }; 104 };
101 105
102 ProfileManagerTest() 106 ProfileManagerTest()
103 : local_state_(TestingBrowserProcess::GetGlobal()) { 107 : local_state_(TestingBrowserProcess::GetGlobal()) {
104 } 108 }
105 109
110 #if defined(OS_WIN)
111 static void SetUpTestCase() {
112 IncognitoModePrefs::InitializePlatformParentalControls();
113 }
114 #endif // defined(OS_WIN)
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
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)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698