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

Side by Side Diff: gpu/command_buffer/service/shader_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/shader_manager.h" 5 #include "gpu/command_buffer/service/shader_manager.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "gpu/command_buffer/service/gpu_service_test.h"
8 #include "gpu/command_buffer/service/mocks.h" 9 #include "gpu/command_buffer/service/mocks.h"
9 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
10 #include "ui/gl/gl_mock.h" 11 #include "ui/gl/gl_mock.h"
11 12
12 using ::testing::Return; 13 using ::testing::Return;
13 using ::testing::ReturnRef; 14 using ::testing::ReturnRef;
14 15
15 namespace gpu { 16 namespace gpu {
16 namespace gles2 { 17 namespace gles2 {
17 18
18 class ShaderManagerTest : public testing::Test { 19 class ShaderManagerTest : public GpuServiceTest {
19 public: 20 public:
20 ShaderManagerTest() { 21 ShaderManagerTest() {
21 } 22 }
22 23
23 virtual ~ShaderManagerTest() { 24 virtual ~ShaderManagerTest() {
24 manager_.Destroy(false); 25 manager_.Destroy(false);
25 } 26 }
26 27
27 protected: 28 protected:
28 virtual void SetUp() {
29 gl_.reset(new ::testing::StrictMock< ::gfx::MockGLInterface>());
30 ::gfx::MockGLInterface::SetGLInterface(gl_.get());
31 }
32
33 virtual void TearDown() {
34 ::gfx::MockGLInterface::SetGLInterface(NULL);
35 gl_.reset();
36 }
37
38 // Use StrictMock to make 100% sure we know how GL will be called.
39 scoped_ptr< ::testing::StrictMock< ::gfx::MockGLInterface> > gl_;
40 ShaderManager manager_; 29 ShaderManager manager_;
41 }; 30 };
42 31
43 TEST_F(ShaderManagerTest, Basic) { 32 TEST_F(ShaderManagerTest, Basic) {
44 const GLuint kClient1Id = 1; 33 const GLuint kClient1Id = 1;
45 const GLuint kService1Id = 11; 34 const GLuint kService1Id = 11;
46 const GLenum kShader1Type = GL_VERTEX_SHADER; 35 const GLenum kShader1Type = GL_VERTEX_SHADER;
47 const GLuint kClient2Id = 2; 36 const GLuint kClient2Id = 2;
48 // Check we can create shader. 37 // Check we can create shader.
49 Shader* info0 = manager_.CreateShader( 38 Shader* info0 = manager_.CreateShader(
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 EXPECT_FALSE(shader1->InUse()); 251 EXPECT_FALSE(shader1->InUse());
263 shader2 = manager_.GetShader(kClient1Id); 252 shader2 = manager_.GetShader(kClient1Id);
264 EXPECT_EQ(shader1, shader2); 253 EXPECT_EQ(shader1, shader2);
265 manager_.MarkAsDeleted(shader1); // this should delete the shader. 254 manager_.MarkAsDeleted(shader1); // this should delete the shader.
266 shader2 = manager_.GetShader(kClient1Id); 255 shader2 = manager_.GetShader(kClient1Id);
267 EXPECT_TRUE(shader2 == NULL); 256 EXPECT_TRUE(shader2 == NULL);
268 } 257 }
269 258
270 } // namespace gles2 259 } // namespace gles2
271 } // namespace gpu 260 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/renderbuffer_manager_unittest.cc ('k') | gpu/command_buffer/service/texture_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698