diff options
author | danakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-15 22:30:03 +0000 |
---|---|---|
committer | danakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-15 22:30:03 +0000 |
commit | 1a510045f4e5a96c78edec0e284276781d14e78f (patch) | |
tree | d791cf5bf4eafe784d9175b8b11139fd4ed5522e /cc | |
parent | f4bc8bd2d5aec9ef0985550f71d7f680f4c741b9 (diff) | |
download | chromium_src-1a510045f4e5a96c78edec0e284276781d14e78f.zip chromium_src-1a510045f4e5a96c78edec0e284276781d14e78f.tar.gz chromium_src-1a510045f4e5a96c78edec0e284276781d14e78f.tar.bz2 |
cc: Try eliminate flake on a cc unittest.
LayerTreeHostTestAtomicCommitWithPartialUpdate flaked on the
waterfall today. It looks like it drew an extra frame somehow
with no damage, but I can't see how it would. So let's try
make the test robust to that anyway, and see if that fixes it
or gives us more data.
R=enne
BUG=240757
Review URL: https://chromiumcodereview.appspot.com/15123006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@200372 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc')
-rw-r--r-- | cc/trees/layer_tree_host_unittest.cc | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc index 2aac01e..7191712 100644 --- a/cc/trees/layer_tree_host_unittest.cc +++ b/cc/trees/layer_tree_host_unittest.cc @@ -959,7 +959,10 @@ class LayerTreeHostTestAtomicCommit : public LayerTreeHostTest { LayerTreeHostTest::SetupTree(); } - virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } + virtual void BeginTest() OVERRIDE { + drew_frame_ = -1; + PostSetNeedsCommitToMainThread(); + } virtual void TreeActivatedOnThread(LayerTreeHostImpl* impl) OVERRIDE { ASSERT_EQ(0u, layer_tree_host()->settings().max_partial_texture_updates); @@ -1010,6 +1013,12 @@ class LayerTreeHostTestAtomicCommit : public LayerTreeHostTest { TestWebGraphicsContext3D* context = static_cast<TestWebGraphicsContext3D*>( impl->output_surface()->context3d()); + if (drew_frame_ == impl->active_tree()->source_frame_number()) { + EXPECT_EQ(0u, context->NumUsedTextures()) << "For frame " << drew_frame_; + return; + } + drew_frame_ = impl->active_tree()->source_frame_number(); + // We draw/ship one texture each frame for each layer. EXPECT_EQ(2u, context->NumUsedTextures()); context->ResetUsedTextures(); @@ -1026,6 +1035,7 @@ class LayerTreeHostTestAtomicCommit : public LayerTreeHostTest { FakeContentLayerClient client_; scoped_refptr<FakeContentLayer> layer_; scoped_refptr<FakeScrollbarLayer> scrollbar_; + int drew_frame_; }; MULTI_THREAD_TEST_F(LayerTreeHostTestAtomicCommit); @@ -1050,8 +1060,6 @@ static void SetLayerPropertiesForTesting(Layer* layer, class LayerTreeHostTestAtomicCommitWithPartialUpdate : public LayerTreeHostTest { public: - LayerTreeHostTestAtomicCommitWithPartialUpdate() : num_commits_(0) {} - virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE { // Allow one partial texture update. settings->max_partial_texture_updates = 1; @@ -1090,7 +1098,11 @@ class LayerTreeHostTestAtomicCommitWithPartialUpdate LayerTreeHostTest::SetupTree(); } - virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); } + virtual void BeginTest() OVERRIDE { + num_commits_ = 0; + drew_frame_ = -1; + PostSetNeedsCommitToMainThread(); + } virtual void CommitCompleteOnThread(LayerTreeHostImpl* impl) OVERRIDE { ASSERT_EQ(1u, layer_tree_host()->settings().max_partial_texture_updates); @@ -1183,6 +1195,12 @@ class LayerTreeHostTestAtomicCommitWithPartialUpdate TestWebGraphicsContext3D* context = static_cast<TestWebGraphicsContext3D*>( impl->output_surface()->context3d()); + if (drew_frame_ == impl->active_tree()->source_frame_number()) { + EXPECT_EQ(0u, context->NumUsedTextures()) << "For frame " << drew_frame_; + return; + } + drew_frame_ = impl->active_tree()->source_frame_number(); + // Number of textures used for drawing should one per layer except for // frame 3 where the viewport only contains one layer. if (impl->active_tree()->source_frame_number() == 3) @@ -1237,6 +1255,7 @@ class LayerTreeHostTestAtomicCommitWithPartialUpdate scoped_refptr<FakeScrollbarLayer> scrollbar_with_paints_; scoped_refptr<FakeScrollbarLayer> scrollbar_without_paints_; int num_commits_; + int drew_frame_; }; // Partial updates are not possible with a delegating renderer. |