| 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 <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/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 ->SetLocalState(0); | 77 ->SetLocalState(0); |
| 78 | 78 |
| 79 // Restore the real DeviceSettingsProvider. | 79 // Restore the real DeviceSettingsProvider. |
| 80 EXPECT_TRUE( | 80 EXPECT_TRUE( |
| 81 cros_settings_->RemoveSettingsProvider(&stub_settings_provider_)); | 81 cros_settings_->RemoveSettingsProvider(&stub_settings_provider_)); |
| 82 cros_settings_->AddSettingsProvider(device_settings_provider_); | 82 cros_settings_->AddSettingsProvider(device_settings_provider_); |
| 83 | 83 |
| 84 UserManager::Set(old_user_manager_); | 84 UserManager::Set(old_user_manager_); |
| 85 | 85 |
| 86 // Shut down the DeviceSettingsService. | 86 // Shut down the DeviceSettingsService. |
| 87 DeviceSettingsService::Get()->Shutdown(); | 87 DeviceSettingsService::Get()->ShutdownSessionManager(); |
| 88 | 88 |
| 89 // Shut down the remaining UserManager instances. | 89 // Shut down the remaining UserManager instances. |
| 90 if (user_manager_impl) | 90 if (user_manager_impl) |
| 91 user_manager_impl->Shutdown(); | 91 user_manager_impl->Shutdown(); |
| 92 UserManager::Get()->Shutdown(); | 92 UserManager::Get()->Shutdown(); |
| 93 | 93 |
| 94 base::RunLoop().RunUntilIdle(); | 94 base::RunLoop().RunUntilIdle(); |
| 95 } | 95 } |
| 96 | 96 |
| 97 bool GetUserManagerEphemeralUsersEnabled() const { | 97 bool GetUserManagerEphemeralUsersEnabled() const { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 protected: | 139 protected: |
| 140 MessageLoop message_loop_; | 140 MessageLoop message_loop_; |
| 141 content::TestBrowserThread ui_thread_; | 141 content::TestBrowserThread ui_thread_; |
| 142 content::TestBrowserThread file_thread_; | 142 content::TestBrowserThread file_thread_; |
| 143 | 143 |
| 144 CrosSettings* cros_settings_; | 144 CrosSettings* cros_settings_; |
| 145 CrosSettingsProvider* device_settings_provider_; | 145 CrosSettingsProvider* device_settings_provider_; |
| 146 StubCrosSettingsProvider stub_settings_provider_; | 146 StubCrosSettingsProvider stub_settings_provider_; |
| 147 scoped_ptr<TestingPrefServiceSimple> local_state_; | 147 scoped_ptr<TestingPrefServiceSimple> local_state_; |
| 148 | 148 |
| 149 // Initializes / shuts down a stub CrosLibrary. | 149 ScopedStubCrosEnabler stub_cros_enabler_; |
| 150 chromeos::ScopedStubCrosEnabler stub_cros_enabler_; | 150 ScopedTestCrosSettings test_cros_settings_; |
| 151 | 151 |
| 152 scoped_ptr<UserManagerImpl> user_manager_impl; | 152 scoped_ptr<UserManagerImpl> user_manager_impl; |
| 153 UserManager* old_user_manager_; | 153 UserManager* old_user_manager_; |
| 154 }; | 154 }; |
| 155 | 155 |
| 156 TEST_F(UserManagerTest, RetrieveTrustedDevicePolicies) { | 156 TEST_F(UserManagerTest, RetrieveTrustedDevicePolicies) { |
| 157 SetUserManagerEphemeralUsersEnabled(true); | 157 SetUserManagerEphemeralUsersEnabled(true); |
| 158 SetUserManagerOwnerEmail(""); | 158 SetUserManagerOwnerEmail(""); |
| 159 | 159 |
| 160 SetDeviceSettings(false, "owner@invalid.domain"); | 160 SetDeviceSettings(false, "owner@invalid.domain"); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 UserManager::Get()->UserLoggedIn( | 199 UserManager::Get()->UserLoggedIn( |
| 200 "user0@invalid.domain", "user0@invalid.domain", false); | 200 "user0@invalid.domain", "user0@invalid.domain", false); |
| 201 ResetUserManager(); | 201 ResetUserManager(); |
| 202 | 202 |
| 203 const UserList* users = &UserManager::Get()->GetUsers(); | 203 const UserList* users = &UserManager::Get()->GetUsers(); |
| 204 EXPECT_EQ(1U, users->size()); | 204 EXPECT_EQ(1U, users->size()); |
| 205 EXPECT_EQ((*users)[0]->email(), "owner@invalid.domain"); | 205 EXPECT_EQ((*users)[0]->email(), "owner@invalid.domain"); |
| 206 } | 206 } |
| 207 | 207 |
| 208 } // namespace chromeos | 208 } // namespace chromeos |
| OLD | NEW |