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

Unified Diff: cc/trees/layer_tree_host_unittest.cc

Issue 672283003: cc: ReadyToDraw notifications. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add unit test. Created 6 years, 1 month 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
Index: cc/trees/layer_tree_host_unittest.cc
diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc
index aedd0d937a43a69ffce015ea7507f522556a406a..06d1393dd3831c0d060e6c86df4c2e57d659b231 100644
--- a/cc/trees/layer_tree_host_unittest.cc
+++ b/cc/trees/layer_tree_host_unittest.cc
@@ -69,6 +69,40 @@ namespace {
class LayerTreeHostTest : public LayerTreeTest {};
+// Test if the LTHI receives ReadyToActivate and ReadyToDraw notifications from
+// the TileManager.
+class LayerTreeHostTestNotifications : public LayerTreeHostTest {
+ public:
+ LayerTreeHostTestNotifications()
+ : did_notify_ready_to_activate_(false),
+ did_notify_ready_to_draw_(false) {}
+
+ void BeginTest() override { PostSetNeedsCommitToMainThread(); }
+
+ void NotifyReadyToActivateOnThread(LayerTreeHostImpl* impl) override {
+ did_notify_ready_to_activate_ = true;
+ if (did_notify_ready_to_draw_)
+ EndTest();
danakj 2014/11/07 19:08:18 It's much nicer to understand the test if there is
ernstm 2014/11/08 01:57:26 Done. I created separate tests for ReadyToActivate
+ }
+
+ void NotifyReadyToDrawOnThread(LayerTreeHostImpl* impl) override {
+ did_notify_ready_to_draw_ = true;
+ if (did_notify_ready_to_activate_)
+ EndTest();
+ }
+
+ void AfterTest() override {
+ EXPECT_TRUE(did_notify_ready_to_activate_);
danakj 2014/11/07 19:08:18 I was kinda expecting a test that was more long th
+ EXPECT_TRUE(did_notify_ready_to_draw_);
+ }
+
+ private:
+ bool did_notify_ready_to_activate_;
+ bool did_notify_ready_to_draw_;
+};
+
+SINGLE_AND_MULTI_THREAD_IMPL_TEST_F(LayerTreeHostTestNotifications);
+
// Two setNeedsCommits in a row should lead to at least 1 commit and at least 1
// draw with frame 0.
class LayerTreeHostTestSetNeedsCommit1 : public LayerTreeHostTest {

Powered by Google App Engine
This is Rietveld 408576698