| 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/files/scoped_temp_dir.h" |
| 7 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/message_loop.h" | 9 #include "base/message_loop.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" |
| 11 #include "chrome/browser/policy/device_token_fetcher.h" | 11 #include "chrome/browser/policy/device_token_fetcher.h" |
| 12 #include "chrome/browser/policy/logging_work_scheduler.h" | 12 #include "chrome/browser/policy/logging_work_scheduler.h" |
| 13 #include "chrome/browser/policy/mock_device_management_service.h" | 13 #include "chrome/browser/policy/mock_device_management_service.h" |
| 14 #include "chrome/browser/policy/policy_notifier.h" | 14 #include "chrome/browser/policy/policy_notifier.h" |
| 15 #include "chrome/browser/policy/proto/cloud_policy.pb.h" | 15 #include "chrome/browser/policy/proto/cloud_policy.pb.h" |
| 16 #include "chrome/browser/policy/proto/device_management_backend.pb.h" | 16 #include "chrome/browser/policy/proto/device_management_backend.pb.h" |
| 17 #include "chrome/browser/policy/user_policy_cache.h" | 17 #include "chrome/browser/policy/user_policy_cache.h" |
| 18 #include "content/public/test/test_browser_thread.h" | 18 #include "content/public/test/test_browser_thread.h" |
| 19 #include "policy/policy_constants.h" | 19 #include "policy/policy_constants.h" |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 cache_->policy()->GetValue(key::kDisableSpdy))); | 110 cache_->policy()->GetValue(key::kDisableSpdy))); |
| 111 } | 111 } |
| 112 | 112 |
| 113 protected: | 113 protected: |
| 114 scoped_ptr<CloudPolicyCacheBase> cache_; | 114 scoped_ptr<CloudPolicyCacheBase> cache_; |
| 115 scoped_ptr<CloudPolicyController> controller_; | 115 scoped_ptr<CloudPolicyController> controller_; |
| 116 scoped_ptr<MockDeviceTokenFetcher> token_fetcher_; | 116 scoped_ptr<MockDeviceTokenFetcher> token_fetcher_; |
| 117 scoped_ptr<CloudPolicyDataStore> data_store_; | 117 scoped_ptr<CloudPolicyDataStore> data_store_; |
| 118 MockDeviceManagementService service_; | 118 MockDeviceManagementService service_; |
| 119 PolicyNotifier notifier_; | 119 PolicyNotifier notifier_; |
| 120 ScopedTempDir temp_user_data_dir_; | 120 base::ScopedTempDir temp_user_data_dir_; |
| 121 MessageLoop loop_; | 121 MessageLoop loop_; |
| 122 em::DeviceManagementResponse spdy_policy_response_; | 122 em::DeviceManagementResponse spdy_policy_response_; |
| 123 | 123 |
| 124 private: | 124 private: |
| 125 content::TestBrowserThread ui_thread_; | 125 content::TestBrowserThread ui_thread_; |
| 126 content::TestBrowserThread file_thread_; | 126 content::TestBrowserThread file_thread_; |
| 127 | 127 |
| 128 DISALLOW_COPY_AND_ASSIGN(CloudPolicyControllerTest); | 128 DISALLOW_COPY_AND_ASSIGN(CloudPolicyControllerTest); |
| 129 }; | 129 }; |
| 130 | 130 |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 .WillOnce(DoAll(InvokeWithoutArgs(&loop_, &MessageLoop::QuitNow), | 389 .WillOnce(DoAll(InvokeWithoutArgs(&loop_, &MessageLoop::QuitNow), |
| 390 service_.SucceedJob(response))); | 390 service_.SucceedJob(response))); |
| 391 CreateNewController(); | 391 CreateNewController(); |
| 392 loop_.RunAllPending(); | 392 loop_.RunAllPending(); |
| 393 EXPECT_EQ(CloudPolicySubsystem::NETWORK_ERROR, notifier_.state()); | 393 EXPECT_EQ(CloudPolicySubsystem::NETWORK_ERROR, notifier_.state()); |
| 394 EXPECT_EQ(CloudPolicySubsystem::POLICY_NETWORK_ERROR, | 394 EXPECT_EQ(CloudPolicySubsystem::POLICY_NETWORK_ERROR, |
| 395 notifier_.error_details()); | 395 notifier_.error_details()); |
| 396 } | 396 } |
| 397 | 397 |
| 398 } // namespace policy | 398 } // namespace policy |
| OLD | NEW |