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

Unified Diff: cc/trees/layer_tree_host_unittest.cc

Issue 1247033007: cc: Abort frame when becoming invisible and waiting for ready to draw. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove race between ready to draw and set visible Created 5 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | cc/trees/single_thread_proxy.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 470a63b1b3ae3651e581e45e3b81796ba712c75e..91ca4001f2db1b769e5594fe9877495e2db6dbe7 100644
--- a/cc/trees/layer_tree_host_unittest.cc
+++ b/cc/trees/layer_tree_host_unittest.cc
@@ -272,6 +272,42 @@ class LayerTreeHostTestReadyToDrawNonEmpty
// single threaded mode.
SINGLE_THREAD_TEST_F(LayerTreeHostTestReadyToDrawNonEmpty);
+// This tests if we get the READY_TO_DRAW signal if we become invisible and then
+// become visible again.
+class LayerTreeHostTestReadyToDrawVisibility
+ : public LayerTreeHostTestReadyToDrawNonEmpty {
+ public:
+ LayerTreeHostTestReadyToDrawVisibility()
+ : LayerTreeHostTestReadyToDrawNonEmpty(), commit_count_(0) {}
+
+ void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) override {
+ commit_count_++;
+ if (commit_count_ == 1) {
+ DebugScopedSetMainThread main(proxy());
+ layer_tree_host()->SetVisible(false);
brianderson 2015/07/23 22:58:15 EXPECT_FALSE(host_impl->visible()) here?
sunnyps 2015/07/23 23:10:50 Done.
+ }
+ }
+
+ void DidFinishImplFrameOnThread(LayerTreeHostImpl* host_impl) override {
+ if (commit_count_ == 1) {
+ DebugScopedSetMainThread main(proxy());
+ layer_tree_host()->SetVisible(true);
brianderson 2015/07/23 22:58:15 EXPECT_TRUE(host_impl->visible()) here?
sunnyps 2015/07/23 23:10:50 Done.
+ }
+ }
+
+ void AfterTest() override {
+ LayerTreeHostTestReadyToDrawNonEmpty::AfterTest();
+ EXPECT_EQ(2, commit_count_);
+ }
+
+ private:
+ int commit_count_;
+};
+
+// Note: With this test setup, we only get tiles flagged as REQUIRED_FOR_DRAW in
+// single threaded mode.
+SINGLE_THREAD_TEST_F(LayerTreeHostTestReadyToDrawVisibility);
+
class LayerTreeHostFreeWorkerContextResourcesTest : public LayerTreeHostTest {
public:
scoped_ptr<FakeOutputSurface> CreateFakeOutputSurface() override {
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | cc/trees/single_thread_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698