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

Side by Side Diff: components/scheduler/renderer/throttling_helper_unittest.cc

Issue 1958283005: Throttling Helper to disable task queue until PumpThrottledTasks called (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix typo Created 4 years, 7 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
« no previous file with comments | « components/scheduler/renderer/throttling_helper.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/scheduler/renderer/throttling_helper.h" 5 #include "components/scheduler/renderer/throttling_helper.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 353
354 mock_task_runner_->RunUntilIdle(); 354 mock_task_runner_->RunUntilIdle();
355 355
356 EXPECT_THAT( 356 EXPECT_THAT(
357 run_times, 357 run_times,
358 ElementsAre( 358 ElementsAre(
359 base::TimeTicks() + base::TimeDelta::FromMilliseconds(1000.0), 359 base::TimeTicks() + base::TimeDelta::FromMilliseconds(1000.0),
360 base::TimeTicks() + base::TimeDelta::FromMilliseconds(3000.0))); 360 base::TimeTicks() + base::TimeDelta::FromMilliseconds(3000.0)));
361 } 361 }
362 362
363 TEST_F(ThrottlingHelperTest, TaskQueueDisabledTillPump) {
364 timer_queue_->PostTask(FROM_HERE, base::Bind(&NopTask));
365
366 EXPECT_TRUE(timer_queue_->IsQueueEnabled());
367 throttling_helper_->IncreaseThrottleRefCount(timer_queue_.get());
368 EXPECT_FALSE(timer_queue_->IsQueueEnabled());
369
370 mock_task_runner_->RunUntilIdle(); // Wait until the pump.
371 EXPECT_TRUE(timer_queue_->IsQueueEnabled());
372 }
373
374 TEST_F(ThrottlingHelperTest, TaskQueueEnabledOnUnthrottle) {
375 timer_queue_->PostTask(FROM_HERE, base::Bind(&NopTask));
376
377 throttling_helper_->IncreaseThrottleRefCount(timer_queue_.get());
378 EXPECT_FALSE(timer_queue_->IsQueueEnabled());
379
380 throttling_helper_->DecreaseThrottleRefCount(timer_queue_.get());
381 EXPECT_TRUE(timer_queue_->IsQueueEnabled());
382 }
383
363 } // namespace scheduler 384 } // namespace scheduler
OLDNEW
« no previous file with comments | « components/scheduler/renderer/throttling_helper.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698