| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <stdint.h> |
| 6 |
| 5 #include "gpu/command_buffer/service/vertex_array_manager.h" | 7 #include "gpu/command_buffer/service/vertex_array_manager.h" |
| 6 #include "gpu/command_buffer/service/vertex_attrib_manager.h" | 8 #include "gpu/command_buffer/service/vertex_attrib_manager.h" |
| 7 | 9 |
| 8 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 9 #include "gpu/command_buffer/service/feature_info.h" | 11 #include "gpu/command_buffer/service/feature_info.h" |
| 10 #include "gpu/command_buffer/service/gpu_service_test.h" | 12 #include "gpu/command_buffer/service/gpu_service_test.h" |
| 11 #include "gpu/command_buffer/service/test_helper.h" | 13 #include "gpu/command_buffer/service/test_helper.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 13 #include "ui/gl/gl_mock.h" | 15 #include "ui/gl/gl_mock.h" |
| 14 | 16 |
| 15 using ::testing::Pointee; | 17 using ::testing::Pointee; |
| 16 using ::testing::_; | 18 using ::testing::_; |
| 17 | 19 |
| 18 namespace gpu { | 20 namespace gpu { |
| 19 namespace gles2 { | 21 namespace gles2 { |
| 20 | 22 |
| 21 class VertexArrayManagerTest : public GpuServiceTest { | 23 class VertexArrayManagerTest : public GpuServiceTest { |
| 22 public: | 24 public: |
| 23 static const uint32 kNumVertexAttribs = 8; | 25 static const uint32_t kNumVertexAttribs = 8; |
| 24 | 26 |
| 25 VertexArrayManagerTest() { | 27 VertexArrayManagerTest() { |
| 26 } | 28 } |
| 27 | 29 |
| 28 ~VertexArrayManagerTest() override {} | 30 ~VertexArrayManagerTest() override {} |
| 29 | 31 |
| 30 protected: | 32 protected: |
| 31 void SetUp() override { | 33 void SetUp() override { |
| 32 GpuServiceTest::SetUpWithGLVersion("2.1", "GL_ARB_vertex_array_object"); | 34 GpuServiceTest::SetUpWithGLVersion("2.1", "GL_ARB_vertex_array_object"); |
| 33 manager_.reset(new VertexArrayManager()); | 35 manager_.reset(new VertexArrayManager()); |
| 34 } | 36 } |
| 35 | 37 |
| 36 void TearDown() override { | 38 void TearDown() override { |
| 37 manager_.reset(); | 39 manager_.reset(); |
| 38 GpuServiceTest::TearDown(); | 40 GpuServiceTest::TearDown(); |
| 39 } | 41 } |
| 40 | 42 |
| 41 scoped_ptr<VertexArrayManager> manager_; | 43 scoped_ptr<VertexArrayManager> manager_; |
| 42 }; | 44 }; |
| 43 | 45 |
| 44 // GCC requires these declarations, but MSVC requires they not be present | 46 // GCC requires these declarations, but MSVC requires they not be present |
| 45 #ifndef COMPILER_MSVC | 47 #ifndef COMPILER_MSVC |
| 46 const uint32 VertexArrayManagerTest::kNumVertexAttribs; | 48 const uint32_t VertexArrayManagerTest::kNumVertexAttribs; |
| 47 #endif | 49 #endif |
| 48 | 50 |
| 49 TEST_F(VertexArrayManagerTest, Basic) { | 51 TEST_F(VertexArrayManagerTest, Basic) { |
| 50 const GLuint kClient1Id = 1; | 52 const GLuint kClient1Id = 1; |
| 51 const GLuint kService1Id = 11; | 53 const GLuint kService1Id = 11; |
| 52 const GLuint kClient2Id = 2; | 54 const GLuint kClient2Id = 2; |
| 53 | 55 |
| 54 // Check we can create | 56 // Check we can create |
| 55 manager_->CreateVertexAttribManager( | 57 manager_->CreateVertexAttribManager( |
| 56 kClient1Id, kService1Id, kNumVertexAttribs, true); | 58 kClient1Id, kService1Id, kNumVertexAttribs, true); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 manager.Destroy(true); | 92 manager.Destroy(true); |
| 91 // Check that resources got freed. | 93 // Check that resources got freed. |
| 92 info1 = manager.GetVertexAttribManager(kClient1Id); | 94 info1 = manager.GetVertexAttribManager(kClient1Id); |
| 93 ASSERT_TRUE(info1 == NULL); | 95 ASSERT_TRUE(info1 == NULL); |
| 94 } | 96 } |
| 95 | 97 |
| 96 } // namespace gles2 | 98 } // namespace gles2 |
| 97 } // namespace gpu | 99 } // namespace gpu |
| 98 | 100 |
| 99 | 101 |
| OLD | NEW |