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 <vector> | 5 #include <vector> |
6 | 6 |
| 7 #include "base/callback.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 "base/scoped_temp_dir.h" |
10 #include "base/values.h" | 11 #include "base/values.h" |
11 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
12 #include "chrome/browser/policy/cloud_policy_data_store.h" | 13 #include "chrome/browser/policy/cloud_policy_data_store.h" |
13 #include "chrome/browser/policy/logging_work_scheduler.h" | 14 #include "chrome/browser/policy/logging_work_scheduler.h" |
14 #include "chrome/browser/policy/proto/cloud_policy.pb.h" | 15 #include "chrome/browser/policy/proto/cloud_policy.pb.h" |
15 #include "chrome/browser/policy/proto/device_management_backend.pb.h" | 16 #include "chrome/browser/policy/proto/device_management_backend.pb.h" |
16 #include "chrome/browser/policy/testing_cloud_policy_subsystem.h" | 17 #include "chrome/browser/policy/testing_cloud_policy_subsystem.h" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 prefs_.reset(new TestingPrefService); | 117 prefs_.reset(new TestingPrefService); |
117 CloudPolicySubsystem::RegisterPrefs(prefs_.get()); | 118 CloudPolicySubsystem::RegisterPrefs(prefs_.get()); |
118 ((TestingBrowserProcess*) g_browser_process)->SetLocalState(prefs_.get()); | 119 ((TestingBrowserProcess*) g_browser_process)->SetLocalState(prefs_.get()); |
119 | 120 |
120 logger_.reset(new EventLogger); | 121 logger_.reset(new EventLogger); |
121 factory_.reset(new TestingPolicyURLFetcherFactory(logger_.get())); | 122 factory_.reset(new TestingPolicyURLFetcherFactory(logger_.get())); |
122 ASSERT_TRUE(temp_user_data_dir_.CreateUniqueTempDir()); | 123 ASSERT_TRUE(temp_user_data_dir_.CreateUniqueTempDir()); |
123 data_store_.reset(CloudPolicyDataStore::CreateForUserPolicies()); | 124 data_store_.reset(CloudPolicyDataStore::CreateForUserPolicies()); |
124 cache_ = new UserPolicyCache( | 125 cache_ = new UserPolicyCache( |
125 temp_user_data_dir_.path().AppendASCII("CloudPolicyControllerTest"), | 126 temp_user_data_dir_.path().AppendASCII("CloudPolicyControllerTest"), |
126 false /* wait_for_policy_fetch */); | 127 false, /* wait_for_policy_fetch */ |
| 128 base::Closure() /* ready_callback */); |
127 cloud_policy_subsystem_.reset(new TestingCloudPolicySubsystem( | 129 cloud_policy_subsystem_.reset(new TestingCloudPolicySubsystem( |
128 data_store_.get(), cache_, | 130 data_store_.get(), cache_, |
129 kDeviceManagementUrl, logger_.get())); | 131 kDeviceManagementUrl, logger_.get())); |
130 cloud_policy_subsystem_->CompleteInitialization( | 132 cloud_policy_subsystem_->CompleteInitialization( |
131 prefs::kDevicePolicyRefreshRate, 0); | 133 prefs::kDevicePolicyRefreshRate, 0); |
132 | 134 |
133 // Abort the test on unexpected requests. | 135 // Abort the test on unexpected requests. |
134 ON_CALL(factory(), Intercept(_, _, _, _)) | 136 ON_CALL(factory(), Intercept(_, _, _, _)) |
135 .WillByDefault(InvokeWithoutArgs( | 137 .WillByDefault(InvokeWithoutArgs( |
136 this, | 138 this, |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 TEST_F(CloudPolicySubsystemSerialNumberRecoveryTest, SerialRequested) { | 453 TEST_F(CloudPolicySubsystemSerialNumberRecoveryTest, SerialRequested) { |
452 InSequence s; | 454 InSequence s; |
453 ExpectSuccessfulRegistration(); | 455 ExpectSuccessfulRegistration(); |
454 ExpectPolicyRequest("", true, true); | 456 ExpectPolicyRequest("", true, true); |
455 ExpectPolicyRequest(kMachineId, false, false); | 457 ExpectPolicyRequest(kMachineId, false, false); |
456 ExpectPolicyRequest("", false, false); | 458 ExpectPolicyRequest("", false, false); |
457 ExecuteTest(); | 459 ExecuteTest(); |
458 } | 460 } |
459 | 461 |
460 } // policy | 462 } // policy |
OLD | NEW |