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

Side by Side Diff: chrome/browser/policy/cloud/cloud_policy_invalidator_unittest.cc

Issue 2331423002: Replace TestSimpleTaskRunner::GetPendingTasks with TakePendingTasks (Closed)
Patch Set: split test Created 4 years, 2 months 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/cloud_policy_invalidator.h" 5 #include "chrome/browser/policy/cloud/cloud_policy_invalidator.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 CloudPolicyInvalidatorTest::GetPolicyType() const { 406 CloudPolicyInvalidatorTest::GetPolicyType() const {
407 return UserCloudPolicyInvalidator::GetPolicyType(); 407 return UserCloudPolicyInvalidator::GetPolicyType();
408 } 408 }
409 409
410 bool CloudPolicyInvalidatorTest::CheckPolicyRefreshed(base::TimeDelta delay) { 410 bool CloudPolicyInvalidatorTest::CheckPolicyRefreshed(base::TimeDelta delay) {
411 base::TimeDelta max_delay = delay + base::TimeDelta::FromMilliseconds( 411 base::TimeDelta max_delay = delay + base::TimeDelta::FromMilliseconds(
412 CloudPolicyInvalidator::kMaxFetchDelayMin); 412 CloudPolicyInvalidator::kMaxFetchDelayMin);
413 413
414 if (!task_runner_->HasPendingTask()) 414 if (!task_runner_->HasPendingTask())
415 return false; 415 return false;
416 base::TimeDelta actual_delay = task_runner_->GetPendingTasks().back().delay; 416 base::TimeDelta actual_delay = task_runner_->FinalPendingTaskDelay();
417 EXPECT_GE(actual_delay, delay); 417 EXPECT_GE(actual_delay, delay);
418 EXPECT_LE(actual_delay, max_delay); 418 EXPECT_LE(actual_delay, max_delay);
419 419
420 return CheckPolicyRefreshCount(1); 420 return CheckPolicyRefreshCount(1);
421 } 421 }
422 422
423 bool CloudPolicyInvalidatorTest::CheckPolicyRefreshCount(int count) { 423 bool CloudPolicyInvalidatorTest::CheckPolicyRefreshCount(int count) {
424 if (!client_) { 424 if (!client_) {
425 task_runner_->RunUntilIdle(); 425 task_runner_->RunUntilIdle();
426 return count == 0; 426 return count == 0;
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after
1095 CloudPolicyInvalidatorUserTypedTest, 1095 CloudPolicyInvalidatorUserTypedTest,
1096 testing::Values(em::DeviceRegisterRequest::ANDROID_BROWSER)); 1096 testing::Values(em::DeviceRegisterRequest::ANDROID_BROWSER));
1097 #else 1097 #else
1098 INSTANTIATE_TEST_CASE_P( 1098 INSTANTIATE_TEST_CASE_P(
1099 CloudPolicyInvalidatorUserTypedTestInstance, 1099 CloudPolicyInvalidatorUserTypedTestInstance,
1100 CloudPolicyInvalidatorUserTypedTest, 1100 CloudPolicyInvalidatorUserTypedTest,
1101 testing::Values(em::DeviceRegisterRequest::BROWSER)); 1101 testing::Values(em::DeviceRegisterRequest::BROWSER));
1102 #endif 1102 #endif
1103 1103
1104 } // namespace policy 1104 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698