| 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..63c6a74128b9007523a2cf1c02494b53b5d66ee5 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,33 @@ 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(GL_INVALID_OPERATION, opengl_es2_->GetError(kBadResource));
|
| + ASSERT_EQ(NULL, opengl_es2_->GetString(kBadResource, GL_VERSION));
|
| + ASSERT_EQ(0, opengl_es2_->GetUniformLocation(kBadResource, 0, NULL));
|
| + ASSERT_EQ(GL_FALSE, opengl_es2_->IsBuffer(kBadResource, 0));
|
| + ASSERT_EQ(GL_INVALID_ENUM,
|
| + 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(GL_INVALID_OPERATION, glGetError());
|
| + ASSERT_EQ(NULL, glGetString(GL_VERSION));
|
| + ASSERT_EQ(0, glGetUniformLocation(0, NULL));
|
| + ASSERT_EQ(GL_FALSE, glIsBuffer(0));
|
| + ASSERT_EQ(GL_INVALID_ENUM, glCheckFramebufferStatus(GL_DRAW_FRAMEBUFFER));
|
| + glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
|
| + glClear(GL_COLOR_BUFFER_BIT);
|
| +
|
| + PASS();
|
| +}
|
| +
|
|
|