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

Unified Diff: components/exo/buffer_unittest.cc

Issue 2083853002: exo: Recreate Surface resources on context lost. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix nits Created 4 years, 6 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 | « components/exo/buffer.cc ('k') | components/exo/surface.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/exo/buffer_unittest.cc
diff --git a/components/exo/buffer_unittest.cc b/components/exo/buffer_unittest.cc
index bc708aa6db19182ba9f14f22d40089e0de60539e..987c29056538f8a580c6c9eedddd5c5583d68a9d 100644
--- a/components/exo/buffer_unittest.cc
+++ b/components/exo/buffer_unittest.cc
@@ -37,6 +37,7 @@ TEST_F(BufferTest, ReleaseCallback) {
buffer->set_release_callback(
base::Bind(&Release, base::Unretained(&release_call_count)));
+ buffer->OnAttach();
// Produce a texture mailbox for the contents of the buffer.
cc::TextureMailbox texture_mailbox;
std::unique_ptr<cc::SingleReleaseCallback> buffer_release_callback =
@@ -46,6 +47,10 @@ TEST_F(BufferTest, ReleaseCallback) {
// Release buffer.
buffer_release_callback->Run(gpu::SyncToken(), false);
+ ASSERT_EQ(release_call_count, 0);
+
+ buffer->OnDetach();
+
// Release() should have been called exactly once.
ASSERT_EQ(release_call_count, 1);
}
@@ -55,6 +60,7 @@ TEST_F(BufferTest, IsLost) {
std::unique_ptr<Buffer> buffer(
new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size)));
+ buffer->OnAttach();
// Acquire a texture mailbox for the contents of the buffer.
cc::TextureMailbox texture_mailbox;
std::unique_ptr<cc::SingleReleaseCallback> buffer_release_callback =
@@ -71,14 +77,16 @@ TEST_F(BufferTest, IsLost) {
GL_INNOCENT_CONTEXT_RESET_ARB);
}
+ // Release buffer.
+ bool is_lost = true;
+ buffer_release_callback->Run(gpu::SyncToken(), is_lost);
+
// Producing a new texture mailbox for the contents of the buffer.
std::unique_ptr<cc::SingleReleaseCallback> buffer_release_callback2 =
buffer->ProduceTextureMailbox(&texture_mailbox, false, false);
- ASSERT_TRUE(buffer_release_callback);
+ ASSERT_TRUE(buffer_release_callback2);
+ buffer->OnDetach();
- // Release buffer.
- bool is_lost = true;
- buffer_release_callback->Run(gpu::SyncToken(), is_lost);
buffer_release_callback2->Run(gpu::SyncToken(), false);
}
« no previous file with comments | « components/exo/buffer.cc ('k') | components/exo/surface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698