| 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 "base/callback.h" | 5 #include "base/callback.h" |
| 6 #include "base/compiler_specific.h" | 6 #include "base/compiler_specific.h" |
| 7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 DISALLOW_COPY_AND_ASSIGN(TestTaskRunner); | 46 DISALLOW_COPY_AND_ASSIGN(TestTaskRunner); |
| 47 }; | 47 }; |
| 48 | 48 |
| 49 } // namespace | 49 } // namespace |
| 50 | 50 |
| 51 class CloudPolicyRefreshSchedulerTest : public testing::Test { | 51 class CloudPolicyRefreshSchedulerTest : public testing::Test { |
| 52 protected: | 52 protected: |
| 53 CloudPolicyRefreshSchedulerTest() | 53 CloudPolicyRefreshSchedulerTest() |
| 54 : task_runner_(new TestTaskRunner()), | 54 : task_runner_(new TestTaskRunner()), |
| 55 network_change_notifier_(net::NetworkChangeNotifier::CreateMock()) { | 55 network_change_notifier_(net::NetworkChangeNotifier::CreateMock()) { |
| 56 browser::RegisterLocalState(&prefs_); | 56 chrome::RegisterLocalState(&prefs_); |
| 57 prefs_.SetInteger(prefs::kUserPolicyRefreshRate, kPolicyRefreshRate); | 57 prefs_.SetInteger(prefs::kUserPolicyRefreshRate, kPolicyRefreshRate); |
| 58 } | 58 } |
| 59 | 59 |
| 60 virtual void SetUp() OVERRIDE { | 60 virtual void SetUp() OVERRIDE { |
| 61 client_.SetDMToken("token"); | 61 client_.SetDMToken("token"); |
| 62 | 62 |
| 63 // Set up the protobuf timestamp to be one minute in the past. Since the | 63 // Set up the protobuf timestamp to be one minute in the past. Since the |
| 64 // protobuf field only has millisecond precision, we convert the actual | 64 // protobuf field only has millisecond precision, we convert the actual |
| 65 // value back to get a millisecond-clamped time stamp for the checks below. | 65 // value back to get a millisecond-clamped time stamp for the checks below. |
| 66 store_.policy_.reset(new em::PolicyData()); | 66 store_.policy_.reset(new em::PolicyData()); |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 } while (GetParam().backoff_factor > 1 && | 276 } while (GetParam().backoff_factor > 1 && |
| 277 expected_delay_ms <= kPolicyRefreshRate); | 277 expected_delay_ms <= kPolicyRefreshRate); |
| 278 } | 278 } |
| 279 } | 279 } |
| 280 | 280 |
| 281 INSTANTIATE_TEST_CASE_P(CloudPolicyRefreshSchedulerClientErrorTest, | 281 INSTANTIATE_TEST_CASE_P(CloudPolicyRefreshSchedulerClientErrorTest, |
| 282 CloudPolicyRefreshSchedulerClientErrorTest, | 282 CloudPolicyRefreshSchedulerClientErrorTest, |
| 283 testing::ValuesIn(kClientErrorTestCases)); | 283 testing::ValuesIn(kClientErrorTestCases)); |
| 284 | 284 |
| 285 } // namespace policy | 285 } // namespace policy |
| OLD | NEW |