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

Side by Side Diff: cc/scheduler/begin_frame_source_unittest.cc

Issue 2546423002: [Try # 3] Scheduler refactoring to virtually eliminate redundant DoWorks (Closed)
Patch Set: Added the MoveableAutoLock per Sami's suggestion Created 4 years 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 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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 "cc/scheduler/begin_frame_source.h" 5 #include "cc/scheduler/begin_frame_source.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/test/test_simple_task_runner.h" 10 #include "base/test/test_simple_task_runner.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 RemoveObserverThenDidFinishFrameProducesNoFrame) { 83 RemoveObserverThenDidFinishFrameProducesNoFrame) {
84 EXPECT_BEGIN_FRAME_SOURCE_PAUSED(*obs_, false); 84 EXPECT_BEGIN_FRAME_SOURCE_PAUSED(*obs_, false);
85 source_->AddObserver(obs_.get()); 85 source_->AddObserver(obs_.get());
86 EXPECT_BEGIN_FRAME_USED(*obs_, 1000, 1000 + kDeadline, kInterval); 86 EXPECT_BEGIN_FRAME_USED(*obs_, 1000, 1000 + kDeadline, kInterval);
87 task_runner_->RunPendingTasks(); 87 task_runner_->RunPendingTasks();
88 88
89 now_src_->Advance(base::TimeDelta::FromMicroseconds(100)); 89 now_src_->Advance(base::TimeDelta::FromMicroseconds(100));
90 source_->DidFinishFrame(obs_.get(), 0); 90 source_->DidFinishFrame(obs_.get(), 0);
91 source_->RemoveObserver(obs_.get()); 91 source_->RemoveObserver(obs_.get());
92 92
93 EXPECT_TRUE(task_runner_->HasPendingTasks()); 93 // There was a task posed but it's canceled.
Sami 2016/12/09 11:04:02 typo: posted
alex clarke (OOO till 29th) 2016/12/12 11:45:04 I found a way to remove this change.
94 task_runner_->RunPendingTasks(); 94 EXPECT_FALSE(task_runner_->HasPendingTasks());
95 } 95 }
96 96
97 TEST_F(BackToBackBeginFrameSourceTest, 97 TEST_F(BackToBackBeginFrameSourceTest,
98 TogglingObserverThenDidFinishFrameProducesCorrectFrame) { 98 TogglingObserverThenDidFinishFrameProducesCorrectFrame) {
99 EXPECT_BEGIN_FRAME_SOURCE_PAUSED(*obs_, false); 99 EXPECT_BEGIN_FRAME_SOURCE_PAUSED(*obs_, false);
100 source_->AddObserver(obs_.get()); 100 source_->AddObserver(obs_.get());
101 EXPECT_BEGIN_FRAME_USED(*obs_, 1000, 1000 + kDeadline, kInterval); 101 EXPECT_BEGIN_FRAME_USED(*obs_, 1000, 1000 + kDeadline, kInterval);
102 task_runner_->RunPendingTasks(); 102 task_runner_->RunPendingTasks();
103 103
104 now_src_->Advance(base::TimeDelta::FromMicroseconds(100)); 104 now_src_->Advance(base::TimeDelta::FromMicroseconds(100));
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 base::TimeDelta::FromInternalValue(10000)); 493 base::TimeDelta::FromInternalValue(10000));
494 now_src_->Advance(base::TimeDelta::FromInternalValue(5000)); 494 now_src_->Advance(base::TimeDelta::FromInternalValue(5000));
495 EXPECT_BEGIN_FRAME_SOURCE_PAUSED(obs, false); 495 EXPECT_BEGIN_FRAME_SOURCE_PAUSED(obs, false);
496 EXPECT_BEGIN_FRAME_USED_MISSED(obs, 10000, 20000, 10000); 496 EXPECT_BEGIN_FRAME_USED_MISSED(obs, 10000, 20000, 10000);
497 source_->AddObserver(&obs); 497 source_->AddObserver(&obs);
498 source_->RemoveObserver(&obs); 498 source_->RemoveObserver(&obs);
499 } 499 }
500 500
501 } // namespace 501 } // namespace
502 } // namespace cc 502 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698