| 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/policy/cloud_policy_controller.h" | 5 #include "chrome/browser/policy/cloud_policy_controller.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/scoped_temp_dir.h" | 9 #include "base/scoped_temp_dir.h" |
| 10 #include "chrome/browser/policy/cloud_policy_data_store.h" | 10 #include "chrome/browser/policy/cloud_policy_data_store.h" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 // Make this cache's disk cache ready, but have it still waiting for a | 98 // Make this cache's disk cache ready, but have it still waiting for a |
| 99 // policy fetch. | 99 // policy fetch. |
| 100 cache_->Load(); | 100 cache_->Load(); |
| 101 loop_.RunAllPending(); | 101 loop_.RunAllPending(); |
| 102 ASSERT_TRUE(cache_->last_policy_refresh_time().is_null()); | 102 ASSERT_TRUE(cache_->last_policy_refresh_time().is_null()); |
| 103 ASSERT_FALSE(cache_->IsReady()); | 103 ASSERT_FALSE(cache_->IsReady()); |
| 104 } | 104 } |
| 105 | 105 |
| 106 void ExpectHasSpdyPolicy() { | 106 void ExpectHasSpdyPolicy() { |
| 107 base::FundamentalValue expected(true); | 107 base::FundamentalValue expected(true); |
| 108 const PolicyMap* policy_map = cache_->policy( | 108 ASSERT_TRUE(Value::Equals(&expected, |
| 109 CloudPolicyCacheBase::POLICY_LEVEL_MANDATORY); | 109 cache_->policy()->GetValue(key::kDisableSpdy))); |
| 110 ASSERT_TRUE(Value::Equals(&expected, policy_map->Get(kPolicyDisableSpdy))); | |
| 111 } | 110 } |
| 112 | 111 |
| 113 protected: | 112 protected: |
| 114 scoped_ptr<CloudPolicyCacheBase> cache_; | 113 scoped_ptr<CloudPolicyCacheBase> cache_; |
| 115 scoped_ptr<CloudPolicyController> controller_; | 114 scoped_ptr<CloudPolicyController> controller_; |
| 116 scoped_ptr<MockDeviceTokenFetcher> token_fetcher_; | 115 scoped_ptr<MockDeviceTokenFetcher> token_fetcher_; |
| 117 scoped_ptr<CloudPolicyDataStore> data_store_; | 116 scoped_ptr<CloudPolicyDataStore> data_store_; |
| 118 MockDeviceManagementService service_; | 117 MockDeviceManagementService service_; |
| 119 PolicyNotifier notifier_; | 118 PolicyNotifier notifier_; |
| 120 ScopedTempDir temp_user_data_dir_; | 119 ScopedTempDir temp_user_data_dir_; |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 CreateJob(DeviceManagementRequestJob::TYPE_POLICY_FETCH)) | 339 CreateJob(DeviceManagementRequestJob::TYPE_POLICY_FETCH)) |
| 341 .WillOnce(DoAll(InvokeWithoutArgs(&loop_, &MessageLoop::QuitNow), | 340 .WillOnce(DoAll(InvokeWithoutArgs(&loop_, &MessageLoop::QuitNow), |
| 342 service_.FailJob(DM_STATUS_REQUEST_FAILED))); | 341 service_.FailJob(DM_STATUS_REQUEST_FAILED))); |
| 343 CreateNewController(); | 342 CreateNewController(); |
| 344 loop_.RunAllPending(); | 343 loop_.RunAllPending(); |
| 345 EXPECT_TRUE(cache_->IsReady()); | 344 EXPECT_TRUE(cache_->IsReady()); |
| 346 EXPECT_TRUE(cache_->last_policy_refresh_time().is_null()); | 345 EXPECT_TRUE(cache_->last_policy_refresh_time().is_null()); |
| 347 } | 346 } |
| 348 | 347 |
| 349 } // namespace policy | 348 } // namespace policy |
| OLD | NEW |