| 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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 owner_key_util_->SetPrivateKey(policy_.signing_key()); | 165 owner_key_util_->SetPrivateKey(policy_.signing_key()); |
| 166 device_settings_test_helper_.set_policy_blob(policy_.GetBlob()); | 166 device_settings_test_helper_.set_policy_blob(policy_.GetBlob()); |
| 167 LoadSettingsOperation op( | 167 LoadSettingsOperation op( |
| 168 base::Bind(&SessionManagerOperationTest::OnOperationCompleted, | 168 base::Bind(&SessionManagerOperationTest::OnOperationCompleted, |
| 169 base::Unretained(this))); | 169 base::Unretained(this))); |
| 170 | 170 |
| 171 EXPECT_CALL(*this, OnOperationCompleted(&op, _)).Times(0); | 171 EXPECT_CALL(*this, OnOperationCompleted(&op, _)).Times(0); |
| 172 op.Start(&device_settings_test_helper_, owner_key_util_, NULL); | 172 op.Start(&device_settings_test_helper_, owner_key_util_, NULL); |
| 173 device_settings_test_helper_.FlushLoops(); | 173 device_settings_test_helper_.FlushLoops(); |
| 174 device_settings_test_helper_.FlushRetrieve(); | 174 device_settings_test_helper_.FlushRetrieve(); |
| 175 EXPECT_TRUE(op.owner_key()); | 175 EXPECT_TRUE(op.owner_key().get()); |
| 176 EXPECT_TRUE(op.owner_key()->public_key()); | 176 EXPECT_TRUE(op.owner_key()->public_key()); |
| 177 Mock::VerifyAndClearExpectations(this); | 177 Mock::VerifyAndClearExpectations(this); |
| 178 | 178 |
| 179 // Now install a different key and policy and restart the operation. | 179 // Now install a different key and policy and restart the operation. |
| 180 policy_.set_signing_key(policy::PolicyBuilder::CreateTestNewSigningKey()); | 180 policy_.set_signing_key(policy::PolicyBuilder::CreateTestNewSigningKey()); |
| 181 policy_.payload().mutable_metrics_enabled()->set_metrics_enabled(true); | 181 policy_.payload().mutable_metrics_enabled()->set_metrics_enabled(true); |
| 182 policy_.Build(); | 182 policy_.Build(); |
| 183 device_settings_test_helper_.set_policy_blob(policy_.GetBlob()); | 183 device_settings_test_helper_.set_policy_blob(policy_.GetBlob()); |
| 184 owner_key_util_->SetPrivateKey(policy_.signing_key()); | 184 owner_key_util_->SetPrivateKey(policy_.signing_key()); |
| 185 | 185 |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 EXPECT_FALSE(op.policy_data()->has_request_token()); | 280 EXPECT_FALSE(op.policy_data()->has_request_token()); |
| 281 EXPECT_EQ(policy_.policy_data().username(), op.policy_data()->username()); | 281 EXPECT_EQ(policy_.policy_data().username(), op.policy_data()->username()); |
| 282 | 282 |
| 283 // Loaded device settings should match what the operation received. | 283 // Loaded device settings should match what the operation received. |
| 284 ASSERT_TRUE(op.device_settings().get()); | 284 ASSERT_TRUE(op.device_settings().get()); |
| 285 EXPECT_EQ(policy_.payload().SerializeAsString(), | 285 EXPECT_EQ(policy_.payload().SerializeAsString(), |
| 286 op.device_settings()->SerializeAsString()); | 286 op.device_settings()->SerializeAsString()); |
| 287 } | 287 } |
| 288 | 288 |
| 289 } // namespace chromeos | 289 } // namespace chromeos |
| OLD | NEW |