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

Unified Diff: gpu/command_buffer/client/gles2_implementation_unittest.cc

Issue 1916303003: Report lost context from GLES2Implementation based on share group state. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: lost-share-group: disconnect-channel 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 | « gpu/command_buffer/client/gles2_implementation.cc ('k') | gpu/command_buffer/client/gpu_control.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/client/gles2_implementation_unittest.cc
diff --git a/gpu/command_buffer/client/gles2_implementation_unittest.cc b/gpu/command_buffer/client/gles2_implementation_unittest.cc
index e75b9b239b3a638608540f6a46644043823c54ea..a088537269f3fbc21370a785f9a7d5f0f1a94f07 100644
--- a/gpu/command_buffer/client/gles2_implementation_unittest.cc
+++ b/gpu/command_buffer/client/gles2_implementation_unittest.cc
@@ -672,7 +672,7 @@ class GLES2ImplementationTest : public testing::Test {
// Sets the ProgramInfoManager. The manager will be owned
// by the ShareGroup.
void SetProgramInfoManager(ProgramInfoManager* manager) {
- gl_->share_group()->set_program_info_manager(manager);
+ gl_->share_group()->SetProgramInfoManagerForTesting(manager);
}
int CheckError() {
@@ -4487,9 +4487,7 @@ TEST_F(GLES2ImplementationTest, SignalSyncToken) {
EXPECT_EQ(1, signaled_count);
}
-// TODO(danakj): Re-enable after/during re-land of https://crrev.com/389947.
-// This test depends on r389947 but that CL was reverted in r389980.
-TEST_F(GLES2ImplementationTest, DISABLED_SignalSyncTokenAfterContextLoss) {
+TEST_F(GLES2ImplementationTest, SignalSyncTokenAfterContextLoss) {
EXPECT_CALL(*gpu_control_, GenerateFenceSyncRelease()).WillOnce(Return(1));
const uint64_t fence_sync = gl_->InsertFenceSyncCHROMIUM();
gl_->ShallowFlushCHROMIUM();
@@ -4526,6 +4524,34 @@ TEST_F(GLES2ImplementationTest, DISABLED_SignalSyncTokenAfterContextLoss) {
EXPECT_EQ(0, signaled_count);
}
+TEST_F(GLES2ImplementationTest, ReportLoss) {
+ GpuControlClient* gl_as_client = gl_;
+ int lost_count = 0;
+ gl_->SetLostContextCallback(base::Bind(&CountCallback, &lost_count));
+ EXPECT_EQ(0, lost_count);
+
+ EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), gl_->GetGraphicsResetStatusKHR());
+ gl_as_client->OnGpuControlLostContext();
+ EXPECT_NE(static_cast<GLenum>(GL_NO_ERROR), gl_->GetGraphicsResetStatusKHR());
+ // The lost context callback should be run when GLES2Implementation is
+ // notified of the loss.
+ EXPECT_EQ(1, lost_count);
+}
+
+TEST_F(GLES2ImplementationTest, ReportLossReentrant) {
+ GpuControlClient* gl_as_client = gl_;
+ int lost_count = 0;
+ gl_->SetLostContextCallback(base::Bind(&CountCallback, &lost_count));
+ EXPECT_EQ(0, lost_count);
+
+ EXPECT_EQ(static_cast<GLenum>(GL_NO_ERROR), gl_->GetGraphicsResetStatusKHR());
+ gl_as_client->OnGpuControlLostContextMaybeReentrant();
+ EXPECT_NE(static_cast<GLenum>(GL_NO_ERROR), gl_->GetGraphicsResetStatusKHR());
+ // The lost context callback should not be run yet to avoid calling back into
+ // clients re-entrantly, and having them re-enter GLES2Implementation.
+ EXPECT_EQ(0, lost_count);
+}
+
TEST_F(GLES2ImplementationManualInitTest, LoseContextOnOOM) {
ContextInitOptions init_options;
init_options.lose_context_when_out_of_memory = true;
« no previous file with comments | « gpu/command_buffer/client/gles2_implementation.cc ('k') | gpu/command_buffer/client/gpu_control.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698