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

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

Issue 331293005: Revert of gpu: Add base class for gpu service tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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"
9 #include "gpu/command_buffer/service/mocks.h" 8 #include "gpu/command_buffer/service/mocks.h"
10 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
11 #include "ui/gl/gl_mock.h" 10 #include "ui/gl/gl_mock.h"
12 11
13 using ::testing::Return; 12 using ::testing::Return;
14 using ::testing::ReturnRef; 13 using ::testing::ReturnRef;
15 14
16 namespace gpu { 15 namespace gpu {
17 namespace gles2 { 16 namespace gles2 {
18 17
19 class ShaderManagerTest : public GpuServiceTest { 18 class ShaderManagerTest : public testing::Test {
20 public: 19 public:
21 ShaderManagerTest() { 20 ShaderManagerTest() {
22 } 21 }
23 22
24 virtual ~ShaderManagerTest() { 23 virtual ~ShaderManagerTest() {
25 manager_.Destroy(false); 24 manager_.Destroy(false);
26 } 25 }
27 26
28 protected: 27 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_;
29 ShaderManager manager_; 40 ShaderManager manager_;
30 }; 41 };
31 42
32 TEST_F(ShaderManagerTest, Basic) { 43 TEST_F(ShaderManagerTest, Basic) {
33 const GLuint kClient1Id = 1; 44 const GLuint kClient1Id = 1;
34 const GLuint kService1Id = 11; 45 const GLuint kService1Id = 11;
35 const GLenum kShader1Type = GL_VERTEX_SHADER; 46 const GLenum kShader1Type = GL_VERTEX_SHADER;
36 const GLuint kClient2Id = 2; 47 const GLuint kClient2Id = 2;
37 // Check we can create shader. 48 // Check we can create shader.
38 Shader* info0 = manager_.CreateShader( 49 Shader* info0 = manager_.CreateShader(
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 EXPECT_FALSE(shader1->InUse()); 262 EXPECT_FALSE(shader1->InUse());
252 shader2 = manager_.GetShader(kClient1Id); 263 shader2 = manager_.GetShader(kClient1Id);
253 EXPECT_EQ(shader1, shader2); 264 EXPECT_EQ(shader1, shader2);
254 manager_.MarkAsDeleted(shader1); // this should delete the shader. 265 manager_.MarkAsDeleted(shader1); // this should delete the shader.
255 shader2 = manager_.GetShader(kClient1Id); 266 shader2 = manager_.GetShader(kClient1Id);
256 EXPECT_TRUE(shader2 == NULL); 267 EXPECT_TRUE(shader2 == NULL);
257 } 268 }
258 269
259 } // namespace gles2 270 } // namespace gles2
260 } // namespace gpu 271 } // 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