Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(408)

Side by Side Diff: components/policy/core/common/cloud/cloud_policy_refresh_scheduler_unittest.cc

Issue 684513002: Standardize usage of virtual/override/final specifiers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/test/test_simple_task_runner.h" 10 #include "base/test/test_simple_task_runner.h"
(...skipping 17 matching lines...) Expand all
28 const int64 kInitialCacheAgeMinutes = 1; 28 const int64 kInitialCacheAgeMinutes = 1;
29 29
30 } // namespace 30 } // namespace
31 31
32 class CloudPolicyRefreshSchedulerTest : public testing::Test { 32 class CloudPolicyRefreshSchedulerTest : public testing::Test {
33 protected: 33 protected:
34 CloudPolicyRefreshSchedulerTest() 34 CloudPolicyRefreshSchedulerTest()
35 : task_runner_(new base::TestSimpleTaskRunner()), 35 : task_runner_(new base::TestSimpleTaskRunner()),
36 network_change_notifier_(net::NetworkChangeNotifier::CreateMock()) {} 36 network_change_notifier_(net::NetworkChangeNotifier::CreateMock()) {}
37 37
38 virtual void SetUp() override { 38 void SetUp() override {
39 client_.SetDMToken("token"); 39 client_.SetDMToken("token");
40 40
41 // Set up the protobuf timestamp to be one minute in the past. Since the 41 // Set up the protobuf timestamp to be one minute in the past. Since the
42 // protobuf field only has millisecond precision, we convert the actual 42 // protobuf field only has millisecond precision, we convert the actual
43 // value back to get a millisecond-clamped time stamp for the checks below. 43 // value back to get a millisecond-clamped time stamp for the checks below.
44 store_.policy_.reset(new em::PolicyData()); 44 store_.policy_.reset(new em::PolicyData());
45 base::Time now = base::Time::NowFromSystemTime(); 45 base::Time now = base::Time::NowFromSystemTime();
46 base::TimeDelta initial_age = 46 base::TimeDelta initial_age =
47 base::TimeDelta::FromMinutes(kInitialCacheAgeMinutes); 47 base::TimeDelta::FromMinutes(kInitialCacheAgeMinutes);
48 store_.policy_->set_timestamp( 48 store_.policy_->set_timestamp(
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 // default polling rate. 307 // default polling rate.
308 scheduler->SetInvalidationServiceAvailability(false); 308 scheduler->SetInvalidationServiceAvailability(false);
309 CheckTiming(kPolicyRefreshRate); 309 CheckTiming(kPolicyRefreshRate);
310 } 310 }
311 311
312 class CloudPolicyRefreshSchedulerSteadyStateTest 312 class CloudPolicyRefreshSchedulerSteadyStateTest
313 : public CloudPolicyRefreshSchedulerTest { 313 : public CloudPolicyRefreshSchedulerTest {
314 protected: 314 protected:
315 CloudPolicyRefreshSchedulerSteadyStateTest() {} 315 CloudPolicyRefreshSchedulerSteadyStateTest() {}
316 316
317 virtual void SetUp() override { 317 void SetUp() override {
318 refresh_scheduler_.reset(CreateRefreshScheduler()); 318 refresh_scheduler_.reset(CreateRefreshScheduler());
319 refresh_scheduler_->SetRefreshDelay(kPolicyRefreshRate); 319 refresh_scheduler_->SetRefreshDelay(kPolicyRefreshRate);
320 CloudPolicyRefreshSchedulerTest::SetUp(); 320 CloudPolicyRefreshSchedulerTest::SetUp();
321 last_update_ = base::Time::NowFromSystemTime(); 321 last_update_ = base::Time::NowFromSystemTime();
322 client_.NotifyPolicyFetched(); 322 client_.NotifyPolicyFetched();
323 CheckTiming(kPolicyRefreshRate); 323 CheckTiming(kPolicyRefreshRate);
324 } 324 }
325 325
326 scoped_ptr<CloudPolicyRefreshScheduler> refresh_scheduler_; 326 scoped_ptr<CloudPolicyRefreshScheduler> refresh_scheduler_;
327 }; 327 };
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 EXPECT_EQ(base::TimeDelta(), GetLastDelay()); 440 EXPECT_EQ(base::TimeDelta(), GetLastDelay());
441 EXPECT_TRUE(task_runner_->GetPendingTasks().empty()); 441 EXPECT_TRUE(task_runner_->GetPendingTasks().empty());
442 } 442 }
443 } 443 }
444 444
445 INSTANTIATE_TEST_CASE_P(CloudPolicyRefreshSchedulerClientErrorTest, 445 INSTANTIATE_TEST_CASE_P(CloudPolicyRefreshSchedulerClientErrorTest,
446 CloudPolicyRefreshSchedulerClientErrorTest, 446 CloudPolicyRefreshSchedulerClientErrorTest,
447 testing::ValuesIn(kClientErrorTestCases)); 447 testing::ValuesIn(kClientErrorTestCases));
448 448
449 } // namespace policy 449 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698