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

Unified Diff: cc/layers/texture_layer_unittest.cc

Issue 2729183002: Fixing flakiness of TextureLayerMailboxIsActivatedDuringCommit (Closed)
Patch Set: Removed constrcutor Created 3 years, 10 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/texture_layer_unittest.cc
diff --git a/cc/layers/texture_layer_unittest.cc b/cc/layers/texture_layer_unittest.cc
index 998c6291e3b13e612b3a0908286e3eee16a23dc0..fd3485d79f8118b770506128e9f3e16a6fa0512f 100644
--- a/cc/layers/texture_layer_unittest.cc
+++ b/cc/layers/texture_layer_unittest.cc
@@ -787,11 +787,21 @@ SINGLE_AND_MULTI_THREAD_TEST_F(TextureLayerImplWithMailboxThreadedCallback);
class TextureLayerMailboxIsActivatedDuringCommit : public LayerTreeTest {
protected:
- TextureLayerMailboxIsActivatedDuringCommit() : activate_count_(0) {}
-
- static void ReleaseCallback(const gpu::SyncToken& original_sync_token,
- const gpu::SyncToken& release_sync_token,
- bool lost_resource) {}
+ void ReleaseCallback(const gpu::SyncToken& original_sync_token,
+ const gpu::SyncToken& release_sync_token,
+ bool lost_resource) {
+ released_count_++;
+ switch (released_count_) {
+ case 1:
+ break;
+ case 2:
+ EXPECT_EQ(3, layer_tree_host()->SourceFrameNumber());
+ EndTest();
+ break;
+ default:
+ NOTREACHED();
+ }
+ }
void SetMailbox(char mailbox_char) {
const gpu::SyncToken sync_token =
@@ -799,7 +809,7 @@ class TextureLayerMailboxIsActivatedDuringCommit : public LayerTreeTest {
std::unique_ptr<SingleReleaseCallback> callback =
SingleReleaseCallback::Create(base::Bind(
&TextureLayerMailboxIsActivatedDuringCommit::ReleaseCallback,
- sync_token));
+ base::Unretained(this), sync_token));
layer_->SetTextureMailbox(TextureMailbox(MailboxFromChar(mailbox_char),
sync_token, GL_TEXTURE_2D),
std::move(callback));
@@ -849,8 +859,12 @@ class TextureLayerMailboxIsActivatedDuringCommit : public LayerTreeTest {
layer_->RemoveFromParent();
break;
case 3:
- EndTest();
+ // This ensures all texture mailboxes are released before the end of the
+ // test.
+ layer_->ClearClient();
break;
+ default:
+ NOTREACHED();
}
}
@@ -863,15 +877,13 @@ class TextureLayerMailboxIsActivatedDuringCommit : public LayerTreeTest {
void AfterTest() override {}
base::Lock activate_count_lock_;
- int activate_count_;
+ int activate_count_ = 0;
scoped_refptr<Layer> root_;
scoped_refptr<TextureLayer> layer_;
+ int released_count_ = 0;
};
-// Flaky on windows and linux. https://crbug.com/641613
-#if !defined(OS_WIN) && !defined(OS_LINUX)
SINGLE_AND_MULTI_THREAD_TEST_F(TextureLayerMailboxIsActivatedDuringCommit);
-#endif
class TextureLayerImplWithMailboxTest : public TextureLayerTest {
protected:
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698