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

Side by Side Diff: chrome/browser/chromeos/login/user_manager_unittest.cc

Issue 11570009: Split PrefService into PrefService, PrefServiceSimple and PrefServiceSyncable. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address review comments. Created 8 years 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 | Annotate | Revision Log
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 <cstdlib> 5 #include <cstdlib>
6 #include <cstring> 6 #include <cstring>
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 cros_settings_->GetProvider(chromeos::kReportDeviceVersionInfo); 50 cros_settings_->GetProvider(chromeos::kReportDeviceVersionInfo);
51 EXPECT_TRUE(device_settings_provider_); 51 EXPECT_TRUE(device_settings_provider_);
52 EXPECT_TRUE( 52 EXPECT_TRUE(
53 cros_settings_->RemoveSettingsProvider(device_settings_provider_)); 53 cros_settings_->RemoveSettingsProvider(device_settings_provider_));
54 cros_settings_->AddSettingsProvider(&stub_settings_provider_); 54 cros_settings_->AddSettingsProvider(&stub_settings_provider_);
55 55
56 // Populate the stub DeviceSettingsProvider with valid values. 56 // Populate the stub DeviceSettingsProvider with valid values.
57 SetDeviceSettings(false, ""); 57 SetDeviceSettings(false, "");
58 58
59 // Register an in-memory local settings instance. 59 // Register an in-memory local settings instance.
60 local_state_.reset(new TestingPrefService); 60 local_state_.reset(new TestingPrefServiceSimple);
61 reinterpret_cast<TestingBrowserProcess*>(g_browser_process) 61 reinterpret_cast<TestingBrowserProcess*>(g_browser_process)
62 ->SetLocalState(local_state_.get()); 62 ->SetLocalState(local_state_.get());
63 UserManager::RegisterPrefs(local_state_.get()); 63 UserManager::RegisterPrefs(local_state_.get());
64 // Wallpaper manager and user image managers prefs will be accessed by the 64 // Wallpaper manager and user image managers prefs will be accessed by the
65 // unit-test as well. 65 // unit-test as well.
66 UserImageManager::RegisterPrefs(local_state_.get()); 66 UserImageManager::RegisterPrefs(local_state_.get());
67 WallpaperManager::RegisterPrefs(local_state_.get()); 67 WallpaperManager::RegisterPrefs(local_state_.get());
68 68
69 old_user_manager_ = UserManager::Get(); 69 old_user_manager_ = UserManager::Get();
70 ResetUserManager(); 70 ResetUserManager();
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 } 134 }
135 135
136 protected: 136 protected:
137 MessageLoop message_loop_; 137 MessageLoop message_loop_;
138 content::TestBrowserThread ui_thread_; 138 content::TestBrowserThread ui_thread_;
139 content::TestBrowserThread file_thread_; 139 content::TestBrowserThread file_thread_;
140 140
141 CrosSettings* cros_settings_; 141 CrosSettings* cros_settings_;
142 CrosSettingsProvider* device_settings_provider_; 142 CrosSettingsProvider* device_settings_provider_;
143 StubCrosSettingsProvider stub_settings_provider_; 143 StubCrosSettingsProvider stub_settings_provider_;
144 scoped_ptr<TestingPrefService> local_state_; 144 scoped_ptr<TestingPrefServiceSimple> local_state_;
145 145
146 // Initializes / shuts down a stub CrosLibrary. 146 // Initializes / shuts down a stub CrosLibrary.
147 chromeos::ScopedStubCrosEnabler stub_cros_enabler_; 147 chromeos::ScopedStubCrosEnabler stub_cros_enabler_;
148 148
149 scoped_ptr<UserManagerImpl> user_manager_impl; 149 scoped_ptr<UserManagerImpl> user_manager_impl;
150 UserManager* old_user_manager_; 150 UserManager* old_user_manager_;
151 }; 151 };
152 152
153 TEST_F(UserManagerTest, RetrieveTrustedDevicePolicies) { 153 TEST_F(UserManagerTest, RetrieveTrustedDevicePolicies) {
154 SetUserManagerEphemeralUsersEnabled(true); 154 SetUserManagerEphemeralUsersEnabled(true);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 ResetUserManager(); 191 ResetUserManager();
192 UserManager::Get()->UserLoggedIn("user0@invalid.domain", false); 192 UserManager::Get()->UserLoggedIn("user0@invalid.domain", false);
193 ResetUserManager(); 193 ResetUserManager();
194 194
195 const UserList* users = &UserManager::Get()->GetUsers(); 195 const UserList* users = &UserManager::Get()->GetUsers();
196 EXPECT_EQ(1U, users->size()); 196 EXPECT_EQ(1U, users->size());
197 EXPECT_EQ((*users)[0]->email(), "owner@invalid.domain"); 197 EXPECT_EQ((*users)[0]->email(), "owner@invalid.domain");
198 } 198 }
199 199
200 } // namespace chromeos 200 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698