| 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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 ASSERT_TRUE(op.device_settings().get()); | 201 ASSERT_TRUE(op.device_settings().get()); |
| 202 EXPECT_EQ(policy_.payload().SerializeAsString(), | 202 EXPECT_EQ(policy_.payload().SerializeAsString(), |
| 203 op.device_settings()->SerializeAsString()); | 203 op.device_settings()->SerializeAsString()); |
| 204 } | 204 } |
| 205 | 205 |
| 206 TEST_F(SessionManagerOperationTest, StoreSettings) { | 206 TEST_F(SessionManagerOperationTest, StoreSettings) { |
| 207 owner_key_util_->SetPublicKeyFromPrivateKey(policy_.signing_key()); | 207 owner_key_util_->SetPublicKeyFromPrivateKey(policy_.signing_key()); |
| 208 StoreSettingsOperation op( | 208 StoreSettingsOperation op( |
| 209 base::Bind(&SessionManagerOperationTest::OnOperationCompleted, | 209 base::Bind(&SessionManagerOperationTest::OnOperationCompleted, |
| 210 base::Unretained(this)), | 210 base::Unretained(this)), |
| 211 policy_.GetBlob()); | 211 policy_.GetCopy()); |
| 212 | 212 |
| 213 EXPECT_CALL(*this, | 213 EXPECT_CALL(*this, |
| 214 OnOperationCompleted( | 214 OnOperationCompleted( |
| 215 &op, DeviceSettingsService::STORE_SUCCESS)); | 215 &op, DeviceSettingsService::STORE_SUCCESS)); |
| 216 op.Start(&device_settings_test_helper_, owner_key_util_, NULL); | 216 op.Start(&device_settings_test_helper_, owner_key_util_, NULL); |
| 217 device_settings_test_helper_.Flush(); | 217 device_settings_test_helper_.Flush(); |
| 218 Mock::VerifyAndClearExpectations(this); | 218 Mock::VerifyAndClearExpectations(this); |
| 219 | 219 |
| 220 EXPECT_EQ(device_settings_test_helper_.policy_blob(), | 220 EXPECT_EQ(device_settings_test_helper_.policy_blob(), |
| 221 policy_.GetBlob()); | 221 policy_.GetBlob()); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 EXPECT_FALSE(op.policy_data()->has_request_token()); | 277 EXPECT_FALSE(op.policy_data()->has_request_token()); |
| 278 EXPECT_EQ(policy_.policy_data().username(), op.policy_data()->username()); | 278 EXPECT_EQ(policy_.policy_data().username(), op.policy_data()->username()); |
| 279 | 279 |
| 280 // Loaded device settings should match what the operation received. | 280 // Loaded device settings should match what the operation received. |
| 281 ASSERT_TRUE(op.device_settings().get()); | 281 ASSERT_TRUE(op.device_settings().get()); |
| 282 EXPECT_EQ(policy_.payload().SerializeAsString(), | 282 EXPECT_EQ(policy_.payload().SerializeAsString(), |
| 283 op.device_settings()->SerializeAsString()); | 283 op.device_settings()->SerializeAsString()); |
| 284 } | 284 } |
| 285 | 285 |
| 286 } // namespace chromeos | 286 } // namespace chromeos |
| OLD | NEW |