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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 base::Bind(&SessionManagerOperationTest::CheckSuccessfulValidation, | 257 base::Bind(&SessionManagerOperationTest::CheckSuccessfulValidation, |
258 base::Unretained(this))); | 258 base::Unretained(this))); |
259 validator->ValidateUsername(policy_.policy_data().username()); | 259 validator->ValidateUsername(policy_.policy_data().username()); |
260 validator->ValidateTimestamp(before, after, false); | 260 validator->ValidateTimestamp(before, after, false); |
261 validator->ValidatePolicyType(policy::dm_protocol::kChromeDevicePolicyType); | 261 validator->ValidatePolicyType(policy::dm_protocol::kChromeDevicePolicyType); |
262 validator->ValidatePayload(); | 262 validator->ValidatePayload(); |
263 std::vector<uint8> public_key; | 263 std::vector<uint8> public_key; |
264 policy_.signing_key()->ExportPublicKey(&public_key); | 264 policy_.signing_key()->ExportPublicKey(&public_key); |
265 validator->ValidateSignature(public_key, false); | 265 validator->ValidateSignature(public_key, false); |
266 validator->StartValidation(); | 266 validator->StartValidation(); |
267 message_loop_.RunAllPending(); | 267 message_loop_.RunUntilIdle(); |
268 EXPECT_TRUE(validated_); | 268 EXPECT_TRUE(validated_); |
269 | 269 |
270 // Check that the loaded policy_data contains the expected values. | 270 // Check that the loaded policy_data contains the expected values. |
271 EXPECT_EQ(policy::dm_protocol::kChromeDevicePolicyType, | 271 EXPECT_EQ(policy::dm_protocol::kChromeDevicePolicyType, |
272 op.policy_data()->policy_type()); | 272 op.policy_data()->policy_type()); |
273 EXPECT_LE((before - base::Time::UnixEpoch()).InMilliseconds(), | 273 EXPECT_LE((before - base::Time::UnixEpoch()).InMilliseconds(), |
274 op.policy_data()->timestamp()); | 274 op.policy_data()->timestamp()); |
275 EXPECT_GE((after - base::Time::UnixEpoch()).InMilliseconds(), | 275 EXPECT_GE((after - base::Time::UnixEpoch()).InMilliseconds(), |
276 op.policy_data()->timestamp()); | 276 op.policy_data()->timestamp()); |
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 |