OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ppapi/tests/test_graphics_3d.h" | 5 #include "ppapi/tests/test_graphics_3d.h" |
6 | 6 |
7 #include <GLES2/gl2.h> | 7 #include <GLES2/gl2.h> |
8 | 8 |
9 #include "ppapi/c/dev/ppb_testing_dev.h" | 9 #include "ppapi/c/dev/ppb_testing_dev.h" |
10 #include "ppapi/c/ppb_opengles2.h" | 10 #include "ppapi/c/ppb_opengles2.h" |
11 #include "ppapi/cpp/graphics_3d.h" | 11 #include "ppapi/cpp/graphics_3d.h" |
12 #include "ppapi/cpp/module.h" | 12 #include "ppapi/cpp/module.h" |
13 #include "ppapi/tests/test_utils.h" | 13 #include "ppapi/tests/test_utils.h" |
14 #include "ppapi/tests/testing_instance.h" | 14 #include "ppapi/tests/testing_instance.h" |
15 | 15 |
16 REGISTER_TEST_CASE(Graphics3D); | 16 REGISTER_TEST_CASE(Graphics3D); |
17 | 17 |
18 bool TestGraphics3D::Init() { | 18 bool TestGraphics3D::Init() { |
19 opengl_es2_ = static_cast<const PPB_OpenGLES2*>( | 19 opengl_es2_ = static_cast<const PPB_OpenGLES2*>( |
20 pp::Module::Get()->GetBrowserInterface(PPB_OPENGLES2_INTERFACE)); | 20 pp::Module::Get()->GetBrowserInterface(PPB_OPENGLES2_INTERFACE)); |
21 return opengl_es2_ && InitTestingInterface(); | 21 return opengl_es2_ && CheckTestingInterface(); |
22 } | 22 } |
23 | 23 |
24 void TestGraphics3D::RunTests(const std::string& filter) { | 24 void TestGraphics3D::RunTests(const std::string& filter) { |
25 RUN_TEST(Frame, filter); | 25 RUN_TEST(Frame, filter); |
26 } | 26 } |
27 | 27 |
28 std::string TestGraphics3D::TestFrame() { | 28 std::string TestGraphics3D::TestFrame() { |
29 const int width = 16; | 29 const int width = 16; |
30 const int height = 16; | 30 const int height = 16; |
31 const int32_t attribs[] = { | 31 const int32_t attribs[] = { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 opengl_es2_->ReadPixels(context->pp_resource(), | 66 opengl_es2_->ReadPixels(context->pp_resource(), |
67 x, y, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixel_color); | 67 x, y, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixel_color); |
68 | 68 |
69 ASSERT_EQ(pixel_color[0], expected_color[0]); | 69 ASSERT_EQ(pixel_color[0], expected_color[0]); |
70 ASSERT_EQ(pixel_color[1], expected_color[1]); | 70 ASSERT_EQ(pixel_color[1], expected_color[1]); |
71 ASSERT_EQ(pixel_color[2], expected_color[2]); | 71 ASSERT_EQ(pixel_color[2], expected_color[2]); |
72 ASSERT_EQ(pixel_color[3], expected_color[3]); | 72 ASSERT_EQ(pixel_color[3], expected_color[3]); |
73 PASS(); | 73 PASS(); |
74 } | 74 } |
75 | 75 |
OLD | NEW |