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 "chrome/browser/chromeos/settings/session_manager_operation.h" | 5 #include "chrome/browser/chromeos/settings/session_manager_operation.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 ASSERT_TRUE(op.policy_data().get()); | 206 ASSERT_TRUE(op.policy_data().get()); |
207 EXPECT_EQ(policy_.policy_data().SerializeAsString(), | 207 EXPECT_EQ(policy_.policy_data().SerializeAsString(), |
208 op.policy_data()->SerializeAsString()); | 208 op.policy_data()->SerializeAsString()); |
209 ASSERT_TRUE(op.device_settings().get()); | 209 ASSERT_TRUE(op.device_settings().get()); |
210 EXPECT_EQ(policy_.payload().SerializeAsString(), | 210 EXPECT_EQ(policy_.payload().SerializeAsString(), |
211 op.device_settings()->SerializeAsString()); | 211 op.device_settings()->SerializeAsString()); |
212 } | 212 } |
213 | 213 |
214 TEST_F(SessionManagerOperationTest, SignAndStoreSettings) { | 214 TEST_F(SessionManagerOperationTest, SignAndStoreSettings) { |
215 owner_key_util_->SetPrivateKey(policy_.GetSigningKey()); | 215 owner_key_util_->SetPrivateKey(policy_.GetSigningKey()); |
216 service_->OnTPMTokenReady(); | 216 service_->OnTPMTokenReady(true /* is ready */); |
217 | 217 |
218 scoped_ptr<em::PolicyData> policy(new em::PolicyData(policy_.policy_data())); | 218 scoped_ptr<em::PolicyData> policy(new em::PolicyData(policy_.policy_data())); |
219 SignAndStoreSettingsOperation op( | 219 SignAndStoreSettingsOperation op( |
220 base::Bind(&SessionManagerOperationTest::OnOperationCompleted, | 220 base::Bind(&SessionManagerOperationTest::OnOperationCompleted, |
221 base::Unretained(this)), | 221 base::Unretained(this)), |
222 policy.Pass()); | 222 policy.Pass()); |
223 op.set_delegate(service_->as_weak_ptr()); | 223 op.set_delegate(service_->as_weak_ptr()); |
224 | 224 |
225 EXPECT_CALL(*this, | 225 EXPECT_CALL(*this, |
226 OnOperationCompleted( | 226 OnOperationCompleted( |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 message_loop_.RunUntilIdle(); | 266 message_loop_.RunUntilIdle(); |
267 EXPECT_TRUE(validated_); | 267 EXPECT_TRUE(validated_); |
268 | 268 |
269 // Loaded device settings should match what the operation received. | 269 // Loaded device settings should match what the operation received. |
270 ASSERT_TRUE(op.device_settings().get()); | 270 ASSERT_TRUE(op.device_settings().get()); |
271 EXPECT_EQ(policy_.payload().SerializeAsString(), | 271 EXPECT_EQ(policy_.payload().SerializeAsString(), |
272 op.device_settings()->SerializeAsString()); | 272 op.device_settings()->SerializeAsString()); |
273 } | 273 } |
274 | 274 |
275 } // namespace chromeos | 275 } // namespace chromeos |
OLD | NEW |