| 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 } | 69 } |
| 70 | 70 |
| 71 virtual ~CloudPolicyControllerTest() {} | 71 virtual ~CloudPolicyControllerTest() {} |
| 72 | 72 |
| 73 virtual void SetUp() { | 73 virtual void SetUp() { |
| 74 ASSERT_TRUE(temp_user_data_dir_.CreateUniqueTempDir()); | 74 ASSERT_TRUE(temp_user_data_dir_.CreateUniqueTempDir()); |
| 75 cache_.reset(new UserPolicyCache( | 75 cache_.reset(new UserPolicyCache( |
| 76 temp_user_data_dir_.path().AppendASCII("CloudPolicyControllerTest"), | 76 temp_user_data_dir_.path().AppendASCII("CloudPolicyControllerTest"), |
| 77 false /* wait_for_policy_fetch */)); | 77 false /* wait_for_policy_fetch */)); |
| 78 token_fetcher_.reset(new MockDeviceTokenFetcher(cache_.get())); | 78 token_fetcher_.reset(new MockDeviceTokenFetcher(cache_.get())); |
| 79 EXPECT_CALL(service_, StartJob(_)).Times(AnyNumber()); | 79 EXPECT_CALL(service_, StartJob(_, _, _, _, _, _, _)).Times(AnyNumber()); |
| 80 data_store_.reset(CloudPolicyDataStore::CreateForUserPolicies()); | 80 data_store_.reset(CloudPolicyDataStore::CreateForUserPolicies()); |
| 81 } | 81 } |
| 82 | 82 |
| 83 virtual void TearDown() { | 83 virtual void TearDown() { |
| 84 controller_.reset(); // Unregisters observers. | 84 controller_.reset(); // Unregisters observers. |
| 85 data_store_.reset(); | 85 data_store_.reset(); |
| 86 } | 86 } |
| 87 | 87 |
| 88 void CreateNewController() { | 88 void CreateNewController() { |
| 89 controller_.reset(new CloudPolicyController( | 89 controller_.reset(new CloudPolicyController( |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 CreateJob(DeviceManagementRequestJob::TYPE_POLICY_FETCH)) | 340 CreateJob(DeviceManagementRequestJob::TYPE_POLICY_FETCH)) |
| 341 .WillOnce(DoAll(InvokeWithoutArgs(&loop_, &MessageLoop::QuitNow), | 341 .WillOnce(DoAll(InvokeWithoutArgs(&loop_, &MessageLoop::QuitNow), |
| 342 service_.FailJob(DM_STATUS_REQUEST_FAILED))); | 342 service_.FailJob(DM_STATUS_REQUEST_FAILED))); |
| 343 CreateNewController(); | 343 CreateNewController(); |
| 344 loop_.RunAllPending(); | 344 loop_.RunAllPending(); |
| 345 EXPECT_TRUE(cache_->IsReady()); | 345 EXPECT_TRUE(cache_->IsReady()); |
| 346 EXPECT_TRUE(cache_->last_policy_refresh_time().is_null()); | 346 EXPECT_TRUE(cache_->last_policy_refresh_time().is_null()); |
| 347 } | 347 } |
| 348 | 348 |
| 349 } // namespace policy | 349 } // namespace policy |
| OLD | NEW |