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

Side by Side Diff: third_party/WebKit/Source/platform/scheduler/child/idle_helper_unittest.cc

Issue 2700123003: DO NOT COMMIT: Results of running old (current) clang-format on Blink (Closed)
Patch Set: Created 3 years, 10 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 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 "platform/scheduler/child/idle_helper.h" 5 #include "platform/scheduler/child/idle_helper.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/ptr_util.h" 11 #include "base/memory/ptr_util.h"
12 #include "base/run_loop.h" 12 #include "base/run_loop.h"
13 #include "base/test/simple_test_tick_clock.h" 13 #include "base/test/simple_test_tick_clock.h"
14 #include "cc/test/ordered_simple_task_runner.h" 14 #include "cc/test/ordered_simple_task_runner.h"
15 #include "platform/scheduler/base/real_time_domain.h" 15 #include "platform/scheduler/base/real_time_domain.h"
16 #include "public/platform/scheduler/base/task_queue.h"
17 #include "platform/scheduler/base/task_queue_manager.h" 16 #include "platform/scheduler/base/task_queue_manager.h"
18 #include "platform/scheduler/base/test_time_source.h" 17 #include "platform/scheduler/base/test_time_source.h"
19 #include "platform/scheduler/child/scheduler_helper.h" 18 #include "platform/scheduler/child/scheduler_helper.h"
20 #include "platform/scheduler/child/scheduler_tqm_delegate_for_test.h" 19 #include "platform/scheduler/child/scheduler_tqm_delegate_for_test.h"
21 #include "platform/scheduler/child/scheduler_tqm_delegate_impl.h" 20 #include "platform/scheduler/child/scheduler_tqm_delegate_impl.h"
21 #include "public/platform/scheduler/base/task_queue.h"
22 #include "testing/gmock/include/gmock/gmock.h" 22 #include "testing/gmock/include/gmock/gmock.h"
23 #include "testing/gtest/include/gtest/gtest.h" 23 #include "testing/gtest/include/gtest/gtest.h"
24 24
25 using testing::_; 25 using testing::_;
26 using testing::AnyNumber; 26 using testing::AnyNumber;
27 using testing::AtLeast; 27 using testing::AtLeast;
28 using testing::Exactly; 28 using testing::Exactly;
29 using testing::Invoke; 29 using testing::Invoke;
30 using testing::Return; 30 using testing::Return;
31 31
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 idle_helper_->StartIdlePeriod( 444 idle_helper_->StartIdlePeriod(
445 IdleHelper::IdlePeriodState::IN_SHORT_IDLE_PERIOD, clock_->NowTicks(), 445 IdleHelper::IdlePeriodState::IN_SHORT_IDLE_PERIOD, clock_->NowTicks(),
446 clock_->NowTicks() + base::TimeDelta::FromMilliseconds(10)); 446 clock_->NowTicks() + base::TimeDelta::FromMilliseconds(10));
447 } 447 }
448 448
449 TEST_F(IdleHelperTestWithIdlePeriodObserver, TestEnterAndExitIdlePeriod) { 449 TEST_F(IdleHelperTestWithIdlePeriodObserver, TestEnterAndExitIdlePeriod) {
450 BaseIdleHelperTest* fixture = this; 450 BaseIdleHelperTest* fixture = this;
451 ON_CALL(*idle_helper_, OnIdlePeriodStarted()) 451 ON_CALL(*idle_helper_, OnIdlePeriodStarted())
452 .WillByDefault( 452 .WillByDefault(
453 Invoke([fixture]() { EXPECT_TRUE(fixture->IsInIdlePeriod()); })); 453 Invoke([fixture]() { EXPECT_TRUE(fixture->IsInIdlePeriod()); }));
454 ON_CALL(*idle_helper_, OnIdlePeriodEnded()) 454 ON_CALL(*idle_helper_, OnIdlePeriodEnded()).WillByDefault(Invoke([fixture]() {
455 .WillByDefault( 455 EXPECT_FALSE(fixture->IsInIdlePeriod());
456 Invoke([fixture]() { EXPECT_FALSE(fixture->IsInIdlePeriod()); })); 456 }));
457 457
458 ExpectIdlePeriodStartsAndEnds(Exactly(1)); 458 ExpectIdlePeriodStartsAndEnds(Exactly(1));
459 459
460 idle_helper_->StartIdlePeriod( 460 idle_helper_->StartIdlePeriod(
461 IdleHelper::IdlePeriodState::IN_SHORT_IDLE_PERIOD, clock_->NowTicks(), 461 IdleHelper::IdlePeriodState::IN_SHORT_IDLE_PERIOD, clock_->NowTicks(),
462 clock_->NowTicks() + base::TimeDelta::FromMilliseconds(10)); 462 clock_->NowTicks() + base::TimeDelta::FromMilliseconds(10));
463 idle_helper_->EndIdlePeriod(); 463 idle_helper_->EndIdlePeriod();
464 } 464 }
465 465
466 class IdleHelperWithMessageLoopTest : public BaseIdleHelperTest { 466 class IdleHelperWithMessageLoopTest : public BaseIdleHelperTest {
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after
1113 expected_deadline); 1113 expected_deadline);
1114 EXPECT_EQ(1u, idle_queue()->GetNumberOfPendingTasks()); 1114 EXPECT_EQ(1u, idle_queue()->GetNumberOfPendingTasks());
1115 RunUntilIdle(); 1115 RunUntilIdle();
1116 1116
1117 EXPECT_EQ(1, run_count); 1117 EXPECT_EQ(1, run_count);
1118 EXPECT_EQ(expected_deadline, deadline_in_task); 1118 EXPECT_EQ(expected_deadline, deadline_in_task);
1119 } 1119 }
1120 1120
1121 } // namespace scheduler 1121 } // namespace scheduler
1122 } // namespace blink 1122 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698