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

Side by Side Diff: chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos_unittest.cc

Issue 14927015: Translate device-local account IDs to user IDs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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 "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" 5 #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 55
56 class DeviceCloudPolicyManagerChromeOSTest 56 class DeviceCloudPolicyManagerChromeOSTest
57 : public chromeos::DeviceSettingsTestBase { 57 : public chromeos::DeviceSettingsTestBase {
58 protected: 58 protected:
59 DeviceCloudPolicyManagerChromeOSTest() 59 DeviceCloudPolicyManagerChromeOSTest()
60 : cryptohome_library_(chromeos::CryptohomeLibrary::GetTestImpl()), 60 : cryptohome_library_(chromeos::CryptohomeLibrary::GetTestImpl()),
61 stub_cryptohome_client_(chromeos::CryptohomeClient::Create( 61 stub_cryptohome_client_(chromeos::CryptohomeClient::Create(
62 chromeos::STUB_DBUS_CLIENT_IMPLEMENTATION, NULL)), 62 chromeos::STUB_DBUS_CLIENT_IMPLEMENTATION, NULL)),
63 install_attributes_(cryptohome_library_.get(), 63 install_attributes_(cryptohome_library_.get(),
64 stub_cryptohome_client_.get()), 64 stub_cryptohome_client_.get()),
65 store_(new DeviceCloudPolicyStoreChromeOS(&device_settings_service_, 65 store_(new DeviceCloudPolicyStoreChromeOS(
66 &install_attributes_)), 66 chromeos::DeviceSettingsService::Get(), &install_attributes_)),
67 manager_(make_scoped_ptr(store_), &install_attributes_) {} 67 manager_(make_scoped_ptr(store_), &install_attributes_) {}
68 68
69 virtual void SetUp() OVERRIDE { 69 virtual void SetUp() OVERRIDE {
70 DeviceSettingsTestBase::SetUp(); 70 DeviceSettingsTestBase::SetUp();
71 chrome::RegisterLocalState(local_state_.registry()); 71 chrome::RegisterLocalState(local_state_.registry());
72 manager_.Init(); 72 manager_.Init();
73 73
74 // DeviceOAuth2TokenService uses the system request context to fetch 74 // DeviceOAuth2TokenService uses the system request context to fetch
75 // OAuth tokens, then writes the token to local state, encrypting it 75 // OAuth tokens, then writes the token to local state, encrypting it
76 // first with methods in CryptohomeLibrary. 76 // first with methods in CryptohomeLibrary.
(...skipping 22 matching lines...) Expand all
99 scoped_ptr<chromeos::CryptohomeLibrary> cryptohome_library_; 99 scoped_ptr<chromeos::CryptohomeLibrary> cryptohome_library_;
100 scoped_ptr<chromeos::CryptohomeClient> stub_cryptohome_client_; 100 scoped_ptr<chromeos::CryptohomeClient> stub_cryptohome_client_;
101 EnterpriseInstallAttributes install_attributes_; 101 EnterpriseInstallAttributes install_attributes_;
102 102
103 scoped_refptr<net::URLRequestContextGetter> request_context_getter_; 103 scoped_refptr<net::URLRequestContextGetter> request_context_getter_;
104 net::TestURLFetcherFactory url_fetcher_factory_; 104 net::TestURLFetcherFactory url_fetcher_factory_;
105 int url_fetcher_response_code_; 105 int url_fetcher_response_code_;
106 string url_fetcher_response_string_; 106 string url_fetcher_response_string_;
107 TestingPrefServiceSimple local_state_; 107 TestingPrefServiceSimple local_state_;
108 MockDeviceManagementService device_management_service_; 108 MockDeviceManagementService device_management_service_;
109 chromeos::ScopedTestDeviceSettingsService test_device_settings_service_;
110 chromeos::ScopedTestCrosSettings test_cros_settings_; 109 chromeos::ScopedTestCrosSettings test_cros_settings_;
111 110
112 DeviceCloudPolicyStoreChromeOS* store_; 111 DeviceCloudPolicyStoreChromeOS* store_;
113 DeviceCloudPolicyManagerChromeOS manager_; 112 DeviceCloudPolicyManagerChromeOS manager_;
114 113
115 private: 114 private:
116 DISALLOW_COPY_AND_ASSIGN(DeviceCloudPolicyManagerChromeOSTest); 115 DISALLOW_COPY_AND_ASSIGN(DeviceCloudPolicyManagerChromeOSTest);
117 }; 116 };
118 117
119 TEST_F(DeviceCloudPolicyManagerChromeOSTest, FreshDevice) { 118 TEST_F(DeviceCloudPolicyManagerChromeOSTest, FreshDevice) {
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 TEST_F(DeviceCloudPolicyManagerChromeOSEnrollmentTest, LoadError) { 477 TEST_F(DeviceCloudPolicyManagerChromeOSEnrollmentTest, LoadError) {
479 loaded_blob_.clear(); 478 loaded_blob_.clear();
480 RunTest(); 479 RunTest();
481 ExpectFailedEnrollment(EnrollmentStatus::STATUS_STORE_ERROR); 480 ExpectFailedEnrollment(EnrollmentStatus::STATUS_STORE_ERROR);
482 EXPECT_EQ(CloudPolicyStore::STATUS_LOAD_ERROR, 481 EXPECT_EQ(CloudPolicyStore::STATUS_LOAD_ERROR,
483 status_.store_status()); 482 status_.store_status());
484 } 483 }
485 484
486 } // namespace test 485 } // namespace test
487 } // namespace policy 486 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698