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

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

Issue 14200028: Make CrosSettings and DeviceSettingsService non Lazy instances (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix LoginUtilsTest 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 "chrome/browser/chromeos/policy/device_cloud_policy_store_chromeos.h" 5 #include "chrome/browser/chromeos/policy/device_cloud_policy_store_chromeos.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 22 matching lines...) Expand all
33 33
34 class DeviceCloudPolicyStoreChromeOSTest 34 class DeviceCloudPolicyStoreChromeOSTest
35 : public chromeos::DeviceSettingsTestBase { 35 : public chromeos::DeviceSettingsTestBase {
36 protected: 36 protected:
37 DeviceCloudPolicyStoreChromeOSTest() 37 DeviceCloudPolicyStoreChromeOSTest()
38 : cryptohome_library_(chromeos::CryptohomeLibrary::GetImpl(true)), 38 : cryptohome_library_(chromeos::CryptohomeLibrary::GetImpl(true)),
39 stub_cryptohome_client_(chromeos::CryptohomeClient::Create( 39 stub_cryptohome_client_(chromeos::CryptohomeClient::Create(
40 chromeos::STUB_DBUS_CLIENT_IMPLEMENTATION, NULL)), 40 chromeos::STUB_DBUS_CLIENT_IMPLEMENTATION, NULL)),
41 install_attributes_(new EnterpriseInstallAttributes( 41 install_attributes_(new EnterpriseInstallAttributes(
42 cryptohome_library_.get(), stub_cryptohome_client_.get())), 42 cryptohome_library_.get(), stub_cryptohome_client_.get())),
43 store_(new DeviceCloudPolicyStoreChromeOS(&device_settings_service_, 43 store_(new DeviceCloudPolicyStoreChromeOS(device_settings_service_,
44 install_attributes_.get())) {} 44 install_attributes_.get())) {}
45 45
46 virtual void SetUp() OVERRIDE { 46 virtual void SetUp() OVERRIDE {
47 DeviceSettingsTestBase::SetUp(); 47 DeviceSettingsTestBase::SetUp();
48 48
49 base::RunLoop loop; 49 base::RunLoop loop;
50 EnterpriseInstallAttributes::LockResult result; 50 EnterpriseInstallAttributes::LockResult result;
51 install_attributes_->LockDevice( 51 install_attributes_->LockDevice(
52 PolicyBuilder::kFakeUsername, 52 PolicyBuilder::kFakeUsername,
53 DEVICE_MODE_ENTERPRISE, 53 DEVICE_MODE_ENTERPRISE,
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 owner_key_util_->SetPublicKeyFromPrivateKey( 93 owner_key_util_->SetPublicKeyFromPrivateKey(
94 device_policy_.new_signing_key()); 94 device_policy_.new_signing_key());
95 } 95 }
96 96
97 void ResetToNonEnterprise() { 97 void ResetToNonEnterprise() {
98 store_.reset(); 98 store_.reset();
99 cryptohome_library_->InstallAttributesSet("enterprise.owned", 99 cryptohome_library_->InstallAttributesSet("enterprise.owned",
100 std::string()); 100 std::string());
101 install_attributes_.reset(new EnterpriseInstallAttributes( 101 install_attributes_.reset(new EnterpriseInstallAttributes(
102 cryptohome_library_.get(), stub_cryptohome_client_.get())); 102 cryptohome_library_.get(), stub_cryptohome_client_.get()));
103 store_.reset(new DeviceCloudPolicyStoreChromeOS(&device_settings_service_, 103 store_.reset(new DeviceCloudPolicyStoreChromeOS(device_settings_service_,
104 install_attributes_.get())); 104 install_attributes_.get()));
105 } 105 }
106 106
107 scoped_ptr<chromeos::CryptohomeLibrary> cryptohome_library_; 107 scoped_ptr<chromeos::CryptohomeLibrary> cryptohome_library_;
108 scoped_ptr<chromeos::CryptohomeClient> stub_cryptohome_client_; 108 scoped_ptr<chromeos::CryptohomeClient> stub_cryptohome_client_;
109 scoped_ptr<EnterpriseInstallAttributes> install_attributes_; 109 scoped_ptr<EnterpriseInstallAttributes> install_attributes_;
110 110
111 scoped_ptr<DeviceCloudPolicyStoreChromeOS> store_; 111 scoped_ptr<DeviceCloudPolicyStoreChromeOS> store_;
112 112
113 private: 113 private:
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 209
210 TEST_F(DeviceCloudPolicyStoreChromeOSTest, InstallInitialPolicyNotEnterprise) { 210 TEST_F(DeviceCloudPolicyStoreChromeOSTest, InstallInitialPolicyNotEnterprise) {
211 PrepareNewSigningKey(); 211 PrepareNewSigningKey();
212 ResetToNonEnterprise(); 212 ResetToNonEnterprise();
213 store_->InstallInitialPolicy(device_policy_.policy()); 213 store_->InstallInitialPolicy(device_policy_.policy());
214 FlushDeviceSettings(); 214 FlushDeviceSettings();
215 ExpectFailure(CloudPolicyStore::STATUS_BAD_STATE); 215 ExpectFailure(CloudPolicyStore::STATUS_BAD_STATE);
216 } 216 }
217 217
218 } // namespace policy 218 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698