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

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: Unit Test Fixes 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 void SetUp() override { 110 void SetUp() override {
107 // Create a new temporary directory, and store the path 111 // Create a new temporary directory, and store the path
108 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); 112 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
109 TestingBrowserProcess::GetGlobal()->SetProfileManager( 113 TestingBrowserProcess::GetGlobal()->SetProfileManager(
110 new UnittestProfileManager(temp_dir_.path())); 114 new UnittestProfileManager(temp_dir_.path()));
111 115
112 #if defined(OS_CHROMEOS) 116 #if defined(OS_CHROMEOS)
113 base::CommandLine* cl = base::CommandLine::ForCurrentProcess(); 117 base::CommandLine* cl = base::CommandLine::ForCurrentProcess();
114 cl->AppendSwitch(switches::kTestType); 118 cl->AppendSwitch(switches::kTestType);
115 #endif 119 #endif
120
121 #if defined(OS_WIN)
122 IncognitoModePrefs::InitializePlatformParentalControls();
gab 2015/02/25 20:23:52 Consider putting this in SetUpTestCase() as it's o
robliao 2015/02/26 21:03:52 Done.
123 #endif // defined(OS_WIN)
116 } 124 }
117 125
118 void TearDown() override { 126 void TearDown() override {
119 TestingBrowserProcess::GetGlobal()->SetProfileManager(NULL); 127 TestingBrowserProcess::GetGlobal()->SetProfileManager(NULL);
120 base::RunLoop().RunUntilIdle(); 128 base::RunLoop().RunUntilIdle();
121 } 129 }
122 130
123 // Helper function to create a profile with |name| for a profile |manager|. 131 // Helper function to create a profile with |name| for a profile |manager|.
124 void CreateProfileAsync(ProfileManager* manager, 132 void CreateProfileAsync(ProfileManager* manager,
125 const std::string& name, 133 const std::string& name,
(...skipping 1173 matching lines...) Expand 10 before | Expand all | Expand 10 after
1299 dest_path2.BaseName().MaybeAsASCII()); 1307 dest_path2.BaseName().MaybeAsASCII());
1300 profile_manager->ScheduleProfileForDeletion(dest_path2, 1308 profile_manager->ScheduleProfileForDeletion(dest_path2,
1301 ProfileManager::CreateCallback()); 1309 ProfileManager::CreateCallback());
1302 // Spin the message loop so that all the callbacks can finish running. 1310 // Spin the message loop so that all the callbacks can finish running.
1303 base::RunLoop().RunUntilIdle(); 1311 base::RunLoop().RunUntilIdle();
1304 1312
1305 EXPECT_EQ(dest_path3, profile_manager->GetLastUsedProfile()->GetPath()); 1313 EXPECT_EQ(dest_path3, profile_manager->GetLastUsedProfile()->GetPath());
1306 EXPECT_EQ(profile_name3, local_state->GetString(prefs::kProfileLastUsed)); 1314 EXPECT_EQ(profile_name3, local_state->GetString(prefs::kProfileLastUsed));
1307 } 1315 }
1308 #endif // !defined(OS_MACOSX) 1316 #endif // !defined(OS_MACOSX)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698