OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/common/gl_mock.h" | 8 #include "gpu/command_buffer/common/gl_mock.h" |
9 #include "gpu/command_buffer/service/mocks.h" | 9 #include "gpu/command_buffer/service/mocks.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 EXPECT_TRUE(info1->InUse()); | 238 EXPECT_TRUE(info1->InUse()); |
239 manager_.UnuseShader(info1); | 239 manager_.UnuseShader(info1); |
240 EXPECT_FALSE(info1->InUse()); | 240 EXPECT_FALSE(info1->InUse()); |
241 info2 = manager_.GetShaderInfo(kClient1Id); | 241 info2 = manager_.GetShaderInfo(kClient1Id); |
242 EXPECT_EQ(info1, info2); | 242 EXPECT_EQ(info1, info2); |
243 manager_.MarkAsDeleted(info1); // this should delete the shader. | 243 manager_.MarkAsDeleted(info1); // this should delete the shader. |
244 info2 = manager_.GetShaderInfo(kClient1Id); | 244 info2 = manager_.GetShaderInfo(kClient1Id); |
245 EXPECT_TRUE(info2 == NULL); | 245 EXPECT_TRUE(info2 == NULL); |
246 } | 246 } |
247 | 247 |
| 248 TEST_F(ShaderManagerTest, ShaderInfoStoreCompilationStatus) { |
| 249 const GLuint kClientId = 1; |
| 250 const GLuint kServiceId = 11; |
| 251 const GLenum kShaderType = GL_VERTEX_SHADER; |
| 252 ShaderManager::ShaderInfo* info = manager_.CreateShaderInfo( |
| 253 kClientId, kServiceId, kShaderType); |
| 254 ASSERT_TRUE(info != NULL); |
| 255 |
| 256 info->UpdateSource("original source"); |
| 257 info->FlagSourceAsCompiled(false); |
| 258 EXPECT_FALSE(info->source_compiled()); |
| 259 info->FlagSourceAsCompiled(true); |
| 260 EXPECT_TRUE(info->source_compiled()); |
| 261 } |
| 262 |
| 263 TEST_F(ShaderManagerTest, ShaderInfoStoreDeferredSource) { |
| 264 const GLuint kClientId = 1; |
| 265 const GLuint kServiceId = 11; |
| 266 const GLenum kShaderType = GL_VERTEX_SHADER; |
| 267 ShaderManager::ShaderInfo* info = manager_.CreateShaderInfo( |
| 268 kClientId, kServiceId, kShaderType); |
| 269 ASSERT_TRUE(info != NULL); |
| 270 |
| 271 info->UpdateSource("original source"); |
| 272 info->FlagSourceAsCompiled(false); |
| 273 |
| 274 EXPECT_EQ("original source", *info->deferred_compilation_source()); |
| 275 info->UpdateSource("different!"); |
| 276 EXPECT_EQ("original source", *info->deferred_compilation_source()); |
| 277 |
| 278 info->FlagSourceAsCompiled(true); |
| 279 EXPECT_EQ("different!", *info->deferred_compilation_source()); |
| 280 } |
| 281 |
248 } // namespace gles2 | 282 } // namespace gles2 |
249 } // namespace gpu | 283 } // namespace gpu |
250 | |
251 | |
OLD | NEW |