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

Unified Diff: ppapi/tests/test_graphics_3d.cc

Issue 24466004: PPAPI: Make GLES2 calls resilient to bad/dead resources. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 7 years, 3 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 | « ppapi/tests/test_graphics_3d.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/tests/test_graphics_3d.cc
diff --git a/ppapi/tests/test_graphics_3d.cc b/ppapi/tests/test_graphics_3d.cc
index 61bedbf198b2730e67caed19e31fcd3a1b251004..8c1bdc17bc9d716120bc286abfbdacf81e6c2df6 100644
--- a/ppapi/tests/test_graphics_3d.cc
+++ b/ppapi/tests/test_graphics_3d.cc
@@ -34,6 +34,7 @@ void TestGraphics3D::RunTests(const std::string& filter) {
RUN_CALLBACK_TEST(TestGraphics3D, FramePPAPI, filter);
RUN_CALLBACK_TEST(TestGraphics3D, FrameGL, filter);
RUN_CALLBACK_TEST(TestGraphics3D, ExtensionsGL, filter);
+ RUN_CALLBACK_TEST(TestGraphics3D, BadResource, filter);
}
std::string TestGraphics3D::TestFramePPAPI() {
@@ -167,3 +168,32 @@ std::string TestGraphics3D::CheckPixelGL(
PASS();
}
+std::string TestGraphics3D::TestBadResource() {
+ // The point of this test is mostly just to make sure that we don't crash and
+ // provide reasonable (error) results when the resource is bad.
+ const PP_Resource kBadResource = 123;
+
+ // Access OpenGLES API through the PPAPI interface.
+ opengl_es2_->ClearColor(kBadResource, 0.0f, 0.0f, 0.0f, 0.0f);
+ opengl_es2_->Clear(kBadResource, GL_COLOR_BUFFER_BIT);
+ ASSERT_EQ(0, opengl_es2_->GetError(kBadResource));
+ ASSERT_EQ(NULL, opengl_es2_->GetString(kBadResource, GL_VERSION));
+ ASSERT_EQ(-1, opengl_es2_->GetUniformLocation(kBadResource, 0, NULL));
+ ASSERT_EQ(GL_FALSE, opengl_es2_->IsBuffer(kBadResource, 0));
+ ASSERT_EQ(0, opengl_es2_->CheckFramebufferStatus(kBadResource,
+ GL_DRAW_FRAMEBUFFER));
+
+ glSetCurrentContextPPAPI(kBadResource);
+ glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
+ glClear(GL_COLOR_BUFFER_BIT);
+ ASSERT_EQ(0, glGetError());
+ ASSERT_EQ(NULL, glGetString(GL_VERSION));
+ ASSERT_EQ(-1, glGetUniformLocation(0, NULL));
+ ASSERT_EQ(GL_FALSE, glIsBuffer(0));
+ ASSERT_EQ(0, glCheckFramebufferStatus(GL_DRAW_FRAMEBUFFER));
+ glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
+ glClear(GL_COLOR_BUFFER_BIT);
+
+ PASS();
+}
+
« no previous file with comments | « ppapi/tests/test_graphics_3d.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698