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

Unified Diff: cc/trees/layer_tree_host_unittest.cc

Issue 2757373002: Fixing flakiness of TextureLayerChangeInvisibleMailboxTest (Closed)
Patch Set: Addressed comments Created 3 years, 8 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/test/test_hooks.h ('k') | cc/trees/proxy_impl.h » ('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 2e7457a49aac6600be861bf479eb244c545a3d17..b7e599cc0ae07f690a3e14512fbb11e0a05bfb6d 100644
--- a/cc/trees/layer_tree_host_unittest.cc
+++ b/cc/trees/layer_tree_host_unittest.cc
@@ -7502,5 +7502,56 @@ class LayerTreeHostTestHudLayerWithLayerLists : public LayerTreeHostTest {
SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestHudLayerWithLayerLists);
+// Verifies that LayerTreeHostClient does not receive frame acks from a released
+// CompositorFrameSink.
+class LayerTreeHostTestDiscardAckAfterRelease : public LayerTreeHostTest {
+ protected:
+ void SetupTree() override {
+ scoped_refptr<Layer> root = Layer::Create();
+ root->SetBounds(gfx::Size(10, 10));
+ layer_tree_host()->SetRootLayer(std::move(root));
+ LayerTreeHostTest::SetupTree();
+ }
+
+ void BeginTest() override { PostSetNeedsCommitToMainThread(); }
+
+ void WillReceiveCompositorFrameAckOnThread(
+ LayerTreeHostImpl* host_impl) override {
+ MainThreadTaskRunner()->PostTask(
+ FROM_HERE, base::Bind(&LayerTreeHostTestDiscardAckAfterRelease::
+ ReleaseCompositorFrameSink,
+ base::Unretained(this)));
+ }
+
+ void DidReceiveCompositorFrameAckOnThread(
+ LayerTreeHostImpl* host_impl) override {
+ MainThreadTaskRunner()->PostDelayedTask(
danakj 2017/04/18 21:52:34 Thanks! LGTM One suggestion is pretend you are a
+ FROM_HERE,
+ base::Bind(
+ &LayerTreeHostTestDiscardAckAfterRelease::VerifyAckNotReceived,
+ base::Unretained(this)),
+ base::TimeDelta::FromMilliseconds(100));
+ }
+
+ void DidReceiveCompositorFrameAck() override { received_ack_ = true; }
+
+ void ReleaseCompositorFrameSink() {
+ layer_tree_host()->SetVisible(false);
+ layer_tree_host()->ReleaseCompositorFrameSink();
+ }
+
+ void VerifyAckNotReceived() {
+ EXPECT_FALSE(received_ack_);
+ EndTest();
+ }
+
+ void AfterTest() override {}
+
+ private:
+ bool received_ack_ = false;
+};
+
+SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestDiscardAckAfterRelease);
+
} // namespace
} // namespace cc
« no previous file with comments | « cc/test/test_hooks.h ('k') | cc/trees/proxy_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698