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

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

Issue 14113053: chrome: Use base::MessageLoop. (Part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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 | 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/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 15 matching lines...) Expand all
26 #include "content/public/test/test_browser_thread.h" 26 #include "content/public/test/test_browser_thread.h"
27 #include "testing/gtest/include/gtest/gtest.h" 27 #include "testing/gtest/include/gtest/gtest.h"
28 28
29 using ::testing::AnyNumber; 29 using ::testing::AnyNumber;
30 30
31 namespace chromeos { 31 namespace chromeos {
32 32
33 class UserManagerTest : public testing::Test { 33 class UserManagerTest : public testing::Test {
34 public: 34 public:
35 UserManagerTest() 35 UserManagerTest()
36 : message_loop_(MessageLoop::TYPE_UI), 36 : message_loop_(base::MessageLoop::TYPE_UI),
37 ui_thread_(content::BrowserThread::UI, &message_loop_), 37 ui_thread_(content::BrowserThread::UI, &message_loop_),
38 file_thread_(content::BrowserThread::FILE, &message_loop_) { 38 file_thread_(content::BrowserThread::FILE, &message_loop_) {}
39 }
40 39
41 virtual void SetUp() OVERRIDE { 40 virtual void SetUp() OVERRIDE {
42 MockCertLibrary* mock_cert_library = new MockCertLibrary(); 41 MockCertLibrary* mock_cert_library = new MockCertLibrary();
43 EXPECT_CALL(*mock_cert_library, LoadKeyStore()).Times(AnyNumber()); 42 EXPECT_CALL(*mock_cert_library, LoadKeyStore()).Times(AnyNumber());
44 chromeos::CrosLibrary::Get()->GetTestApi()->SetCertLibrary( 43 chromeos::CrosLibrary::Get()->GetTestApi()->SetCertLibrary(
45 mock_cert_library, true); 44 mock_cert_library, true);
46 45
47 cros_settings_ = CrosSettings::Get(); 46 cros_settings_ = CrosSettings::Get();
48 47
49 // Replace the real DeviceSettingsProvider with a stub. 48 // Replace the real DeviceSettingsProvider with a stub.
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 base::StringValue owner_value(owner); 122 base::StringValue owner_value(owner);
124 stub_settings_provider_.Set(kDeviceOwner, owner_value); 123 stub_settings_provider_.Set(kDeviceOwner, owner_value);
125 } 124 }
126 125
127 void RetrieveTrustedDevicePolicies() { 126 void RetrieveTrustedDevicePolicies() {
128 reinterpret_cast<UserManagerImpl*>(UserManager::Get())-> 127 reinterpret_cast<UserManagerImpl*>(UserManager::Get())->
129 RetrieveTrustedDevicePolicies(); 128 RetrieveTrustedDevicePolicies();
130 } 129 }
131 130
132 protected: 131 protected:
133 MessageLoop message_loop_; 132 base::MessageLoop message_loop_;
134 content::TestBrowserThread ui_thread_; 133 content::TestBrowserThread ui_thread_;
135 content::TestBrowserThread file_thread_; 134 content::TestBrowserThread file_thread_;
136 135
137 CrosSettings* cros_settings_; 136 CrosSettings* cros_settings_;
138 CrosSettingsProvider* device_settings_provider_; 137 CrosSettingsProvider* device_settings_provider_;
139 StubCrosSettingsProvider stub_settings_provider_; 138 StubCrosSettingsProvider stub_settings_provider_;
140 scoped_ptr<TestingPrefServiceSimple> local_state_; 139 scoped_ptr<TestingPrefServiceSimple> local_state_;
141 140
142 ScopedTestDeviceSettingsService test_device_settings_service_; 141 ScopedTestDeviceSettingsService test_device_settings_service_;
143 ScopedStubCrosEnabler stub_cros_enabler_; 142 ScopedStubCrosEnabler stub_cros_enabler_;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 UserManager::Get()->UserLoggedIn( 191 UserManager::Get()->UserLoggedIn(
193 "user0@invalid.domain", "user0@invalid.domain", false); 192 "user0@invalid.domain", "user0@invalid.domain", false);
194 ResetUserManager(); 193 ResetUserManager();
195 194
196 const UserList* users = &UserManager::Get()->GetUsers(); 195 const UserList* users = &UserManager::Get()->GetUsers();
197 EXPECT_EQ(1U, users->size()); 196 EXPECT_EQ(1U, users->size());
198 EXPECT_EQ((*users)[0]->email(), "owner@invalid.domain"); 197 EXPECT_EQ((*users)[0]->email(), "owner@invalid.domain");
199 } 198 }
200 199
201 } // namespace chromeos 200 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698