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

Unified Diff: components/policy/core/common/cloud/cloud_policy_refresh_scheduler_unittest.cc

Issue 2338733002: Use TestSimpleTaskRunner::HasPendingTask instead of GetPendingTasks().empty() (Closed)
Patch Set: +bluetooth_adapter_win_unittest.cc Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: components/policy/core/common/cloud/cloud_policy_refresh_scheduler_unittest.cc
diff --git a/components/policy/core/common/cloud/cloud_policy_refresh_scheduler_unittest.cc b/components/policy/core/common/cloud/cloud_policy_refresh_scheduler_unittest.cc
index ac0c4869ddee4bacba178a7d6764e96db09b0b33..36d095c473c2de2a63eda01e06dfc9dc0e051311 100644
--- a/components/policy/core/common/cloud/cloud_policy_refresh_scheduler_unittest.cc
+++ b/components/policy/core/common/cloud/cloud_policy_refresh_scheduler_unittest.cc
@@ -88,7 +88,7 @@ class CloudPolicyRefreshSchedulerTest : public testing::Test {
// |cache_age| is how old the cache was when the refresh was issued.
void CheckTimingWithAge(const base::TimeDelta& offset_from_last_refresh,
const base::TimeDelta& cache_age) const {
- EXPECT_FALSE(task_runner_->GetPendingTasks().empty());
+ EXPECT_TRUE(task_runner_->HasPendingTask());
base::Time now(base::Time::NowFromSystemTime());
// |last_update_| was updated and then a refresh was scheduled at time S,
// so |last_update_| is a bit before that.
@@ -155,7 +155,7 @@ TEST_F(CloudPolicyRefreshSchedulerTest, InitialRefreshNoPolicy) {
store_.policy_.reset();
std::unique_ptr<CloudPolicyRefreshScheduler> scheduler(
CreateRefreshScheduler());
- EXPECT_FALSE(task_runner_->GetPendingTasks().empty());
+ EXPECT_TRUE(task_runner_->HasPendingTask());
EXPECT_EQ(GetLastDelay(), base::TimeDelta());
EXPECT_CALL(client_, FetchPolicy()).Times(1);
task_runner_->RunUntilIdle();
@@ -173,7 +173,7 @@ TEST_F(CloudPolicyRefreshSchedulerTest, InitialRefreshUnmanaged) {
TEST_F(CloudPolicyRefreshSchedulerTest, InitialRefreshManagedNotYetFetched) {
std::unique_ptr<CloudPolicyRefreshScheduler> scheduler(
CreateRefreshScheduler());
- EXPECT_FALSE(task_runner_->GetPendingTasks().empty());
+ EXPECT_TRUE(task_runner_->HasPendingTask());
CheckInitialRefresh(false);
EXPECT_CALL(client_, FetchPolicy()).Times(1);
task_runner_->RunUntilIdle();
@@ -200,7 +200,7 @@ TEST_F(CloudPolicyRefreshSchedulerTest, Unregistered) {
scheduler->SetDesiredRefreshDelay(12 * 60 * 60 * 1000);
store_.NotifyStoreLoaded();
store_.NotifyStoreError();
- EXPECT_TRUE(task_runner_->GetPendingTasks().empty());
+ EXPECT_FALSE(task_runner_->HasPendingTask());
}
TEST_F(CloudPolicyRefreshSchedulerTest, RefreshSoon) {
@@ -353,7 +353,7 @@ TEST_F(CloudPolicyRefreshSchedulerSteadyStateTest, OnRegistrationStateChanged) {
task_runner_->ClearPendingTasks();
client_.SetDMToken(std::string());
client_.NotifyRegistrationStateChanged();
- EXPECT_TRUE(task_runner_->GetPendingTasks().empty());
+ EXPECT_FALSE(task_runner_->HasPendingTask());
}
TEST_F(CloudPolicyRefreshSchedulerSteadyStateTest, OnStoreLoaded) {
@@ -364,7 +364,7 @@ TEST_F(CloudPolicyRefreshSchedulerSteadyStateTest, OnStoreLoaded) {
TEST_F(CloudPolicyRefreshSchedulerSteadyStateTest, OnStoreError) {
task_runner_->ClearPendingTasks();
store_.NotifyStoreError();
- EXPECT_TRUE(task_runner_->GetPendingTasks().empty());
+ EXPECT_FALSE(task_runner_->HasPendingTask());
}
TEST_F(CloudPolicyRefreshSchedulerSteadyStateTest, RefreshDelayChange) {
@@ -452,7 +452,7 @@ TEST_P(CloudPolicyRefreshSchedulerClientErrorTest, OnClientError) {
expected_delay_ms <= kPolicyRefreshRate);
} else {
EXPECT_EQ(base::TimeDelta(), GetLastDelay());
- EXPECT_TRUE(task_runner_->GetPendingTasks().empty());
+ EXPECT_FALSE(task_runner_->HasPendingTask());
}
}

Powered by Google App Engine
This is Rietveld 408576698