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

Side by Side Diff: gpu/command_buffer/service/vertex_array_manager_unittest.cc

Issue 332303002: gpu: Add base class for gpu service tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update gpu/build.GN Created 6 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "gpu/command_buffer/service/vertex_array_manager.h" 5 #include "gpu/command_buffer/service/vertex_array_manager.h"
6 #include "gpu/command_buffer/service/vertex_attrib_manager.h" 6 #include "gpu/command_buffer/service/vertex_attrib_manager.h"
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "gpu/command_buffer/service/feature_info.h" 9 #include "gpu/command_buffer/service/feature_info.h"
10 #include "gpu/command_buffer/service/gpu_service_test.h"
10 #include "gpu/command_buffer/service/test_helper.h" 11 #include "gpu/command_buffer/service/test_helper.h"
11 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
12 #include "ui/gl/gl_mock.h" 13 #include "ui/gl/gl_mock.h"
13 14
14 using ::testing::Pointee; 15 using ::testing::Pointee;
15 using ::testing::_; 16 using ::testing::_;
16 17
17 namespace gpu { 18 namespace gpu {
18 namespace gles2 { 19 namespace gles2 {
19 20
20 class VertexArrayManagerTest : public testing::Test { 21 class VertexArrayManagerTest : public GpuServiceTest {
21 public: 22 public:
22 static const uint32 kNumVertexAttribs = 8; 23 static const uint32 kNumVertexAttribs = 8;
23 24
24 VertexArrayManagerTest() { 25 VertexArrayManagerTest() {
25 } 26 }
26 27
27 virtual ~VertexArrayManagerTest() { 28 virtual ~VertexArrayManagerTest() {
28 } 29 }
29 30
30 protected: 31 protected:
31 virtual void SetUp() { 32 virtual void SetUp() {
32 gl_.reset(new ::testing::StrictMock< ::gfx::MockGLInterface>()); 33 GpuServiceTest::SetUp();
33 ::gfx::MockGLInterface::SetGLInterface(gl_.get()); 34 manager_.reset(new VertexArrayManager());
34
35 manager_ = new VertexArrayManager();
36 } 35 }
37 36
38 virtual void TearDown() { 37 virtual void TearDown() {
39 delete manager_; 38 manager_.reset();
40 ::gfx::MockGLInterface::SetGLInterface(NULL); 39 GpuServiceTest::TearDown();
41 gl_.reset();
42 } 40 }
43 41
44 // Use StrictMock to make 100% sure we know how GL will be called. 42 scoped_ptr<VertexArrayManager> manager_;
45 scoped_ptr< ::testing::StrictMock< ::gfx::MockGLInterface> > gl_;
46 VertexArrayManager* manager_;
47 }; 43 };
48 44
49 // GCC requires these declarations, but MSVC requires they not be present 45 // GCC requires these declarations, but MSVC requires they not be present
50 #ifndef COMPILER_MSVC 46 #ifndef COMPILER_MSVC
51 const uint32 VertexArrayManagerTest::kNumVertexAttribs; 47 const uint32 VertexArrayManagerTest::kNumVertexAttribs;
52 #endif 48 #endif
53 49
54 TEST_F(VertexArrayManagerTest, Basic) { 50 TEST_F(VertexArrayManagerTest, Basic) {
55 const GLuint kClient1Id = 1; 51 const GLuint kClient1Id = 1;
56 const GLuint kService1Id = 11; 52 const GLuint kService1Id = 11;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 manager.Destroy(true); 91 manager.Destroy(true);
96 // Check that resources got freed. 92 // Check that resources got freed.
97 info1 = manager.GetVertexAttribManager(kClient1Id); 93 info1 = manager.GetVertexAttribManager(kClient1Id);
98 ASSERT_TRUE(info1 == NULL); 94 ASSERT_TRUE(info1 == NULL);
99 } 95 }
100 96
101 } // namespace gles2 97 } // namespace gles2
102 } // namespace gpu 98 } // namespace gpu
103 99
104 100
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/texture_manager_unittest.cc ('k') | gpu/command_buffer/service/vertex_attrib_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698