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

Unified Diff: cc/scheduler/begin_frame_source_unittest.cc

Issue 2591773002: [cc] BackToBackBFS: Disable time source if all pending observers removed (Closed)
Patch Set: add DCHECK 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/scheduler/begin_frame_source.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/scheduler/begin_frame_source_unittest.cc
diff --git a/cc/scheduler/begin_frame_source_unittest.cc b/cc/scheduler/begin_frame_source_unittest.cc
index b50c4b91ce510a5444ba5912f090adca3dec176c..450e154ab3faad8660686583237d4dffd711922a 100644
--- a/cc/scheduler/begin_frame_source_unittest.cc
+++ b/cc/scheduler/begin_frame_source_unittest.cc
@@ -31,6 +31,7 @@ class BackToBackBeginFrameSourceTest : public ::testing::Test {
make_scoped_refptr(new OrderedSimpleTaskRunner(now_src_.get(), false));
std::unique_ptr<TestDelayBasedTimeSource> time_source(
new TestDelayBasedTimeSource(now_src_.get(), task_runner_.get()));
+ delay_based_time_source_ = time_source.get();
source_.reset(new BackToBackBeginFrameSource(std::move(time_source)));
obs_ = base::WrapUnique(new ::testing::StrictMock<MockBeginFrameObserver>);
}
@@ -41,6 +42,7 @@ class BackToBackBeginFrameSourceTest : public ::testing::Test {
scoped_refptr<OrderedSimpleTaskRunner> task_runner_;
std::unique_ptr<BackToBackBeginFrameSource> source_;
std::unique_ptr<MockBeginFrameObserver> obs_;
+ TestDelayBasedTimeSource* delay_based_time_source_; // Owned by |now_src_|.
};
const int64_t BackToBackBeginFrameSourceTest::kDeadline =
@@ -265,6 +267,8 @@ TEST_F(BackToBackBeginFrameSourceTest, MultipleObserversInterleaved) {
source_->DidFinishFrame(&obs1, 0);
source_->RemoveObserver(&obs1);
+ // Removing all finished observers should disable the time source.
+ EXPECT_FALSE(delay_based_time_source_->Active());
// Finishing the frame for |obs1| posts a begin frame task, which will be
// aborted since |obs1| is removed. Clear that from the task runner.
task_runner_->RunPendingTasks();
« no previous file with comments | « cc/scheduler/begin_frame_source.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698