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

Side by Side Diff: gpu/command_buffer/service/vertex_attrib_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
« no previous file with comments | « gpu/command_buffer/service/vertex_array_manager_unittest.cc ('k') | gpu/gpu.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_attrib_manager.h" 5 #include "gpu/command_buffer/service/vertex_attrib_manager.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "gpu/command_buffer/service/buffer_manager.h" 8 #include "gpu/command_buffer/service/buffer_manager.h"
9 #include "gpu/command_buffer/service/error_state_mock.h" 9 #include "gpu/command_buffer/service/error_state_mock.h"
10 #include "gpu/command_buffer/service/feature_info.h" 10 #include "gpu/command_buffer/service/feature_info.h"
11 #include "gpu/command_buffer/service/gpu_service_test.h"
11 #include "gpu/command_buffer/service/test_helper.h" 12 #include "gpu/command_buffer/service/test_helper.h"
12 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
13 #include "ui/gl/gl_mock.h" 14 #include "ui/gl/gl_mock.h"
14 15
15 using ::testing::Pointee; 16 using ::testing::Pointee;
16 using ::testing::_; 17 using ::testing::_;
17 18
18 namespace gpu { 19 namespace gpu {
19 namespace gles2 { 20 namespace gles2 {
20 21
21 class VertexAttribManagerTest : public testing::Test { 22 class VertexAttribManagerTest : public GpuServiceTest {
22 public: 23 public:
23 static const uint32 kNumVertexAttribs = 8; 24 static const uint32 kNumVertexAttribs = 8;
24 25
25 VertexAttribManagerTest() { 26 VertexAttribManagerTest() {
26 } 27 }
27 28
28 virtual ~VertexAttribManagerTest() { 29 virtual ~VertexAttribManagerTest() {
29 } 30 }
30 31
31 protected: 32 protected:
32 virtual void SetUp() { 33 virtual void SetUp() {
33 gl_.reset(new ::testing::StrictMock< ::gfx::MockGLInterface>()); 34 GpuServiceTest::SetUp();
34 ::gfx::MockGLInterface::SetGLInterface(gl_.get());
35 35
36 for (uint32 ii = 0; ii < kNumVertexAttribs; ++ii) { 36 for (uint32 ii = 0; ii < kNumVertexAttribs; ++ii) {
37 EXPECT_CALL(*gl_, VertexAttrib4f(ii, 0.0f, 0.0f, 0.0f, 1.0f)) 37 EXPECT_CALL(*gl_, VertexAttrib4f(ii, 0.0f, 0.0f, 0.0f, 1.0f))
38 .Times(1) 38 .Times(1)
39 .RetiresOnSaturation(); 39 .RetiresOnSaturation();
40 } 40 }
41 41
42 manager_ = new VertexAttribManager(); 42 manager_ = new VertexAttribManager();
43 manager_->Initialize(kNumVertexAttribs, true); 43 manager_->Initialize(kNumVertexAttribs, true);
44 } 44 }
45 45
46 virtual void TearDown() {
47 manager_ = NULL;
48 ::gfx::MockGLInterface::SetGLInterface(NULL);
49 gl_.reset();
50 }
51
52 // Use StrictMock to make 100% sure we know how GL will be called.
53 scoped_ptr< ::testing::StrictMock< ::gfx::MockGLInterface> > gl_;
54 scoped_refptr<VertexAttribManager> manager_; 46 scoped_refptr<VertexAttribManager> manager_;
55 }; 47 };
56 48
57 // GCC requires these declarations, but MSVC requires they not be present 49 // GCC requires these declarations, but MSVC requires they not be present
58 #ifndef COMPILER_MSVC 50 #ifndef COMPILER_MSVC
59 const uint32 VertexAttribManagerTest::kNumVertexAttribs; 51 const uint32 VertexAttribManagerTest::kNumVertexAttribs;
60 #endif 52 #endif
61 53
62 TEST_F(VertexAttribManagerTest, Basic) { 54 TEST_F(VertexAttribManagerTest, Basic) {
63 EXPECT_TRUE(manager_->GetVertexAttrib(kNumVertexAttribs) == NULL); 55 EXPECT_TRUE(manager_->GetVertexAttrib(kNumVertexAttribs) == NULL);
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 buffer_manager.Destroy(false); 216 buffer_manager.Destroy(false);
225 } 217 }
226 218
227 // TODO(gman): Test ValidateBindings 219 // TODO(gman): Test ValidateBindings
228 // TODO(gman): Test ValidateBindings with client side arrays. 220 // TODO(gman): Test ValidateBindings with client side arrays.
229 221
230 } // namespace gles2 222 } // namespace gles2
231 } // namespace gpu 223 } // namespace gpu
232 224
233 225
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/vertex_array_manager_unittest.cc ('k') | gpu/gpu.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698