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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « cc/test/test_hooks.h ('k') | cc/trees/proxy_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/trees/layer_tree_host.h" 5 #include "cc/trees/layer_tree_host.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 7484 matching lines...) Expand 10 before | Expand all | Expand 10 after
7495 DCHECK_EQ(hud->clip_tree_index(), root_layer->clip_tree_index()); 7495 DCHECK_EQ(hud->clip_tree_index(), root_layer->clip_tree_index());
7496 DCHECK_EQ(hud->effect_tree_index(), root_layer->effect_tree_index()); 7496 DCHECK_EQ(hud->effect_tree_index(), root_layer->effect_tree_index());
7497 DCHECK_EQ(hud->scroll_tree_index(), root_layer->scroll_tree_index()); 7497 DCHECK_EQ(hud->scroll_tree_index(), root_layer->scroll_tree_index());
7498 } 7498 }
7499 7499
7500 void AfterTest() override {} 7500 void AfterTest() override {}
7501 }; 7501 };
7502 7502
7503 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestHudLayerWithLayerLists); 7503 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestHudLayerWithLayerLists);
7504 7504
7505 // Verifies that LayerTreeHostClient does not receive frame acks from a released
7506 // CompositorFrameSink.
7507 class LayerTreeHostTestDiscardAckAfterRelease : public LayerTreeHostTest {
7508 protected:
7509 void SetupTree() override {
7510 scoped_refptr<Layer> root = Layer::Create();
7511 root->SetBounds(gfx::Size(10, 10));
7512 layer_tree_host()->SetRootLayer(std::move(root));
7513 LayerTreeHostTest::SetupTree();
7514 }
7515
7516 void BeginTest() override { PostSetNeedsCommitToMainThread(); }
7517
7518 void WillReceiveCompositorFrameAckOnThread(
7519 LayerTreeHostImpl* host_impl) override {
7520 MainThreadTaskRunner()->PostTask(
7521 FROM_HERE, base::Bind(&LayerTreeHostTestDiscardAckAfterRelease::
7522 ReleaseCompositorFrameSink,
7523 base::Unretained(this)));
7524 }
7525
7526 void DidReceiveCompositorFrameAckOnThread(
7527 LayerTreeHostImpl* host_impl) override {
7528 MainThreadTaskRunner()->PostDelayedTask(
danakj 2017/04/18 21:52:34 Thanks! LGTM One suggestion is pretend you are a
7529 FROM_HERE,
7530 base::Bind(
7531 &LayerTreeHostTestDiscardAckAfterRelease::VerifyAckNotReceived,
7532 base::Unretained(this)),
7533 base::TimeDelta::FromMilliseconds(100));
7534 }
7535
7536 void DidReceiveCompositorFrameAck() override { received_ack_ = true; }
7537
7538 void ReleaseCompositorFrameSink() {
7539 layer_tree_host()->SetVisible(false);
7540 layer_tree_host()->ReleaseCompositorFrameSink();
7541 }
7542
7543 void VerifyAckNotReceived() {
7544 EXPECT_FALSE(received_ack_);
7545 EndTest();
7546 }
7547
7548 void AfterTest() override {}
7549
7550 private:
7551 bool received_ack_ = false;
7552 };
7553
7554 SINGLE_AND_MULTI_THREAD_TEST_F(LayerTreeHostTestDiscardAckAfterRelease);
7555
7505 } // namespace 7556 } // namespace
7506 } // namespace cc 7557 } // namespace cc
OLDNEW
« 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