| OLD | NEW |
| 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 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 throttling_helper_->IncreaseThrottleRefCount(timer_queue_.get()); | 421 throttling_helper_->IncreaseThrottleRefCount(timer_queue_.get()); |
| 422 EXPECT_FALSE(timer_queue_->IsQueueEnabled()); | 422 EXPECT_FALSE(timer_queue_->IsQueueEnabled()); |
| 423 | 423 |
| 424 mock_task_runner_->RunUntilIdle(); // Wait until the pump. | 424 mock_task_runner_->RunUntilIdle(); // Wait until the pump. |
| 425 EXPECT_TRUE(timer_queue_->IsQueueEnabled()); | 425 EXPECT_TRUE(timer_queue_->IsQueueEnabled()); |
| 426 | 426 |
| 427 throttling_helper_->SetQueueEnabled(timer_queue_.get(), false); | 427 throttling_helper_->SetQueueEnabled(timer_queue_.get(), false); |
| 428 EXPECT_FALSE(timer_queue_->IsQueueEnabled()); | 428 EXPECT_FALSE(timer_queue_->IsQueueEnabled()); |
| 429 } | 429 } |
| 430 | 430 |
| 431 TEST_F(ThrottlingHelperTest, DoubleIncrementDoubleDecrement) { |
| 432 timer_queue_->PostTask(FROM_HERE, base::Bind(&NopTask)); |
| 433 |
| 434 EXPECT_TRUE(timer_queue_->IsQueueEnabled()); |
| 435 throttling_helper_->IncreaseThrottleRefCount(timer_queue_.get()); |
| 436 throttling_helper_->IncreaseThrottleRefCount(timer_queue_.get()); |
| 437 EXPECT_FALSE(timer_queue_->IsQueueEnabled()); |
| 438 throttling_helper_->DecreaseThrottleRefCount(timer_queue_.get()); |
| 439 throttling_helper_->DecreaseThrottleRefCount(timer_queue_.get()); |
| 440 EXPECT_TRUE(timer_queue_->IsQueueEnabled()); |
| 441 } |
| 442 |
| 431 } // namespace scheduler | 443 } // namespace scheduler |
| OLD | NEW |