| 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 12 matching lines...) Expand all Loading... |
| 23 #include "chrome/browser/chromeos/settings/stub_cros_settings_provider.h" | 23 #include "chrome/browser/chromeos/settings/stub_cros_settings_provider.h" |
| 24 #include "chrome/test/base/testing_browser_process.h" | 24 #include "chrome/test/base/testing_browser_process.h" |
| 25 #include "content/public/test/test_browser_thread.h" | 25 #include "content/public/test/test_browser_thread.h" |
| 26 #include "testing/gtest/include/gtest/gtest.h" | 26 #include "testing/gtest/include/gtest/gtest.h" |
| 27 | 27 |
| 28 namespace chromeos { | 28 namespace chromeos { |
| 29 | 29 |
| 30 class UserManagerTest : public testing::Test { | 30 class UserManagerTest : public testing::Test { |
| 31 public: | 31 public: |
| 32 UserManagerTest() | 32 UserManagerTest() |
| 33 : message_loop_(MessageLoop::TYPE_UI), | 33 : message_loop_(base::MessageLoop::TYPE_UI), |
| 34 ui_thread_(content::BrowserThread::UI, &message_loop_), | 34 ui_thread_(content::BrowserThread::UI, &message_loop_), |
| 35 file_thread_(content::BrowserThread::FILE, &message_loop_) { | 35 file_thread_(content::BrowserThread::FILE, &message_loop_) { |
| 36 } | 36 } |
| 37 | 37 |
| 38 virtual void SetUp() OVERRIDE { | 38 virtual void SetUp() OVERRIDE { |
| 39 cros_settings_ = CrosSettings::Get(); | 39 cros_settings_ = CrosSettings::Get(); |
| 40 | 40 |
| 41 // Replace the real DeviceSettingsProvider with a stub. | 41 // Replace the real DeviceSettingsProvider with a stub. |
| 42 device_settings_provider_ = | 42 device_settings_provider_ = |
| 43 cros_settings_->GetProvider(chromeos::kReportDeviceVersionInfo); | 43 cros_settings_->GetProvider(chromeos::kReportDeviceVersionInfo); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 base::StringValue owner_value(owner); | 115 base::StringValue owner_value(owner); |
| 116 stub_settings_provider_.Set(kDeviceOwner, owner_value); | 116 stub_settings_provider_.Set(kDeviceOwner, owner_value); |
| 117 } | 117 } |
| 118 | 118 |
| 119 void RetrieveTrustedDevicePolicies() { | 119 void RetrieveTrustedDevicePolicies() { |
| 120 reinterpret_cast<UserManagerImpl*>(UserManager::Get())-> | 120 reinterpret_cast<UserManagerImpl*>(UserManager::Get())-> |
| 121 RetrieveTrustedDevicePolicies(); | 121 RetrieveTrustedDevicePolicies(); |
| 122 } | 122 } |
| 123 | 123 |
| 124 protected: | 124 protected: |
| 125 MessageLoop message_loop_; | 125 base::MessageLoop message_loop_; |
| 126 content::TestBrowserThread ui_thread_; | 126 content::TestBrowserThread ui_thread_; |
| 127 content::TestBrowserThread file_thread_; | 127 content::TestBrowserThread file_thread_; |
| 128 | 128 |
| 129 CrosSettings* cros_settings_; | 129 CrosSettings* cros_settings_; |
| 130 CrosSettingsProvider* device_settings_provider_; | 130 CrosSettingsProvider* device_settings_provider_; |
| 131 StubCrosSettingsProvider stub_settings_provider_; | 131 StubCrosSettingsProvider stub_settings_provider_; |
| 132 scoped_ptr<TestingPrefServiceSimple> local_state_; | 132 scoped_ptr<TestingPrefServiceSimple> local_state_; |
| 133 | 133 |
| 134 ScopedTestDeviceSettingsService test_device_settings_service_; | 134 ScopedTestDeviceSettingsService test_device_settings_service_; |
| 135 ScopedStubCrosEnabler stub_cros_enabler_; | 135 ScopedStubCrosEnabler stub_cros_enabler_; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 184 UserManager::Get()->UserLoggedIn( | 184 UserManager::Get()->UserLoggedIn( |
| 185 "user0@invalid.domain", "user0@invalid.domain", false); | 185 "user0@invalid.domain", "user0@invalid.domain", false); |
| 186 ResetUserManager(); | 186 ResetUserManager(); |
| 187 | 187 |
| 188 const UserList* users = &UserManager::Get()->GetUsers(); | 188 const UserList* users = &UserManager::Get()->GetUsers(); |
| 189 EXPECT_EQ(1U, users->size()); | 189 EXPECT_EQ(1U, users->size()); |
| 190 EXPECT_EQ((*users)[0]->email(), "owner@invalid.domain"); | 190 EXPECT_EQ((*users)[0]->email(), "owner@invalid.domain"); |
| 191 } | 191 } |
| 192 | 192 |
| 193 } // namespace chromeos | 193 } // namespace chromeos |
| OLD | NEW |