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

Unified Diff: cc/output/gl_renderer_unittest.cc

Issue 1919203003: Revert of Report lost context from GLES2Implementation based on share group state. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 | « no previous file | components/mus/gles2/command_buffer_local.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/output/gl_renderer_unittest.cc
diff --git a/cc/output/gl_renderer_unittest.cc b/cc/output/gl_renderer_unittest.cc
index be44c6f418a1367aa565e4af5c0d21a775906c03..6f32dd0800e50b408668c1b8d334b191e8c5e624 100644
--- a/cc/output/gl_renderer_unittest.cc
+++ b/cc/output/gl_renderer_unittest.cc
@@ -10,6 +10,7 @@
#include "base/location.h"
#include "base/memory/ptr_util.h"
+#include "base/single_thread_task_runner.h"
#include "base/thread_task_runner_handle.h"
#include "cc/base/math_util.h"
#include "cc/output/compositor_frame_metadata.h"
@@ -1881,6 +1882,89 @@
renderer_->SwapBuffers(CompositorFrameMetadata());
}
+class GLRendererTestSyncPoint : public GLRendererPixelTest {
+ protected:
+ static void SyncTokenCallback(int* callback_count) {
+ ++(*callback_count);
+ base::MessageLoop::current()->QuitWhenIdle();
+ }
+
+ static void OtherCallback(int* callback_count) {
+ ++(*callback_count);
+ base::MessageLoop::current()->QuitWhenIdle();
+ }
+};
+
+#if !defined(OS_ANDROID)
+TEST_F(GLRendererTestSyncPoint, SignalSyncPointOnLostContext) {
+ int sync_token_callback_count = 0;
+ int other_callback_count = 0;
+ gpu::gles2::GLES2Interface* gl =
+ output_surface_->context_provider()->ContextGL();
+ gpu::ContextSupport* context_support =
+ output_surface_->context_provider()->ContextSupport();
+
+ const uint64_t fence_sync = gl->InsertFenceSyncCHROMIUM();
+ gl->ShallowFlushCHROMIUM();
+
+ gpu::SyncToken sync_token;
+ gl->GenSyncTokenCHROMIUM(fence_sync, sync_token.GetData());
+
+ gl->LoseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB,
+ GL_INNOCENT_CONTEXT_RESET_ARB);
+
+ context_support->SignalSyncToken(
+ sync_token, base::Bind(&SyncTokenCallback, &sync_token_callback_count));
+ EXPECT_EQ(0, sync_token_callback_count);
+ EXPECT_EQ(0, other_callback_count);
+
+ // Make the sync point happen.
+ gl->Finish();
+ // Post a task after the sync point.
+ base::ThreadTaskRunnerHandle::Get()->PostTask(
+ FROM_HERE, base::Bind(&OtherCallback, &other_callback_count));
+
+ base::MessageLoop::current()->Run();
+
+ // The sync point shouldn't have happened since the context was lost.
+ EXPECT_EQ(0, sync_token_callback_count);
+ EXPECT_EQ(1, other_callback_count);
+}
+
+TEST_F(GLRendererTestSyncPoint, SignalSyncPoint) {
+ int sync_token_callback_count = 0;
+ int other_callback_count = 0;
+
+ gpu::gles2::GLES2Interface* gl =
+ output_surface_->context_provider()->ContextGL();
+ gpu::ContextSupport* context_support =
+ output_surface_->context_provider()->ContextSupport();
+
+ const uint64_t fence_sync = gl->InsertFenceSyncCHROMIUM();
+ gl->ShallowFlushCHROMIUM();
+
+ gpu::SyncToken sync_token;
+ gl->GenSyncTokenCHROMIUM(fence_sync, sync_token.GetData());
+
+ context_support->SignalSyncToken(
+ sync_token, base::Bind(&SyncTokenCallback, &sync_token_callback_count));
+ EXPECT_EQ(0, sync_token_callback_count);
+ EXPECT_EQ(0, other_callback_count);
+
+ // Make the sync point happen.
+ gl->Finish();
+ // Post a task after the sync point.
+ base::ThreadTaskRunnerHandle::Get()->PostTask(
+ FROM_HERE, base::Bind(&OtherCallback, &other_callback_count));
+
+ base::MessageLoop::current()->Run();
+
+ // The sync point should have happened.
+ EXPECT_EQ(1, sync_token_callback_count);
+ EXPECT_EQ(1, other_callback_count);
+}
+#endif // OS_ANDROID
+
class TestOverlayProcessor : public OverlayProcessor {
public:
class Strategy : public OverlayProcessor::Strategy {
« no previous file with comments | « no previous file | components/mus/gles2/command_buffer_local.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698