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

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

Issue 10534173: GPU Program Caching (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 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
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/program_manager.h" 5 #include "gpu/command_buffer/service/program_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/weak_ptr.h"
10 #include "base/string_number_conversions.h" 11 #include "base/string_number_conversions.h"
11 #include "base/string_util.h" 12 #include "base/string_util.h"
12 #include "gpu/command_buffer/common/gl_mock.h" 13 #include "gpu/command_buffer/common/gl_mock.h"
13 #include "gpu/command_buffer/common/gles2_cmd_format.h" 14 #include "gpu/command_buffer/common/gles2_cmd_format.h"
14 #include "gpu/command_buffer/service/common_decoder.h" 15 #include "gpu/command_buffer/service/common_decoder.h"
15 #include "gpu/command_buffer/service/mocks.h" 16 #include "gpu/command_buffer/service/mocks.h"
16 #include "gpu/command_buffer/service/test_helper.h" 17 #include "gpu/command_buffer/service/test_helper.h"
17 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
18 19
19 using ::gfx::MockGLInterface; 20 using ::gfx::MockGLInterface;
20 using ::testing::_; 21 using ::testing::_;
21 using ::testing::DoAll; 22 using ::testing::DoAll;
22 using ::testing::InSequence; 23 using ::testing::InSequence;
23 using ::testing::MatcherCast; 24 using ::testing::MatcherCast;
24 using ::testing::Pointee; 25 using ::testing::Pointee;
25 using ::testing::Return; 26 using ::testing::Return;
26 using ::testing::ReturnRef; 27 using ::testing::ReturnRef;
27 using ::testing::SetArrayArgument; 28 using ::testing::SetArrayArgument;
28 using ::testing::SetArgumentPointee; 29 using ::testing::SetArgumentPointee;
29 using ::testing::StrEq; 30 using ::testing::StrEq;
30 using ::testing::StrictMock; 31 using ::testing::StrictMock;
31 32
32 namespace gpu { 33 namespace gpu {
34 class ShaderCache;
35
33 namespace gles2 { 36 namespace gles2 {
34 37
35 class ProgramManagerTest : public testing::Test { 38 class ProgramManagerTest : public testing::Test {
36 public: 39 public:
37 ProgramManagerTest() { } 40 ProgramManagerTest() : manager_(base::WeakPtr<ShaderCache>()) { }
38 ~ProgramManagerTest() { 41 ~ProgramManagerTest() {
39 manager_.Destroy(false); 42 manager_.Destroy(false);
40 } 43 }
41 44
42 protected: 45 protected:
43 virtual void SetUp() { 46 virtual void SetUp() {
44 gl_.reset(new ::testing::StrictMock< ::gfx::MockGLInterface>()); 47 gl_.reset(new ::testing::StrictMock< ::gfx::MockGLInterface>());
45 ::gfx::GLInterface::SetGLInterface(gl_.get()); 48 ::gfx::GLInterface::SetGLInterface(gl_.get());
46 } 49 }
47 50
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 for (GLint ii = -limit; ii < limit; ii += power) { 140 for (GLint ii = -limit; ii < limit; ii += power) {
138 GLint s = manager_.SwizzleLocation(ii); 141 GLint s = manager_.SwizzleLocation(ii);
139 EXPECT_EQ(ii, manager_.UnswizzleLocation(s)); 142 EXPECT_EQ(ii, manager_.UnswizzleLocation(s));
140 } 143 }
141 } 144 }
142 } 145 }
143 146
144 class ProgramManagerWithShaderTest : public testing::Test { 147 class ProgramManagerWithShaderTest : public testing::Test {
145 public: 148 public:
146 ProgramManagerWithShaderTest() 149 ProgramManagerWithShaderTest()
147 : program_info_(NULL) { 150 : manager_(base::WeakPtr<ShaderCache>()), program_info_(NULL) {
148 } 151 }
149 152
150 ~ProgramManagerWithShaderTest() { 153 ~ProgramManagerWithShaderTest() {
151 manager_.Destroy(false); 154 manager_.Destroy(false);
152 shader_manager_.Destroy(false); 155 shader_manager_.Destroy(false);
153 } 156 }
154 157
155 static const GLint kNumVertexAttribs = 16; 158 static const GLint kNumVertexAttribs = 16;
156 159
157 static const GLuint kClientProgramId = 123; 160 static const GLuint kClientProgramId = 123;
(...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after
996 program_info->Link(); 999 program_info->Link();
997 SetupExpectationsForClearingUniforms(kUniforms, kNumUniforms); 1000 SetupExpectationsForClearingUniforms(kUniforms, kNumUniforms);
998 manager_.ClearUniforms(program_info); 1001 manager_.ClearUniforms(program_info);
999 } 1002 }
1000 } 1003 }
1001 1004
1002 } // namespace gles2 1005 } // namespace gles2
1003 } // namespace gpu 1006 } // namespace gpu
1004 1007
1005 1008
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698