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

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

Issue 10812002: Bug fixes for getTranslatedShader (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: last fixes Created 8 years, 4 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
« no previous file with comments | « gpu/command_buffer/service/shader_manager.cc ('k') | no next file » | 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/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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 } 246 }
247 247
248 TEST_F(ShaderManagerTest, ShaderInfoStoreCompilationStatus) { 248 TEST_F(ShaderManagerTest, ShaderInfoStoreCompilationStatus) {
249 const GLuint kClientId = 1; 249 const GLuint kClientId = 1;
250 const GLuint kServiceId = 11; 250 const GLuint kServiceId = 11;
251 const GLenum kShaderType = GL_VERTEX_SHADER; 251 const GLenum kShaderType = GL_VERTEX_SHADER;
252 ShaderManager::ShaderInfo* info = manager_.CreateShaderInfo( 252 ShaderManager::ShaderInfo* info = manager_.CreateShaderInfo(
253 kClientId, kServiceId, kShaderType); 253 kClientId, kServiceId, kShaderType);
254 ASSERT_TRUE(info != NULL); 254 ASSERT_TRUE(info != NULL);
255 255
256 EXPECT_EQ(ShaderManager::ShaderInfo::NOT_COMPILED,
257 info->compilation_status());
256 info->UpdateSource("original source"); 258 info->UpdateSource("original source");
259 EXPECT_EQ(ShaderManager::ShaderInfo::NOT_COMPILED,
260 info->compilation_status());
257 info->FlagSourceAsCompiled(false); 261 info->FlagSourceAsCompiled(false);
258 EXPECT_FALSE(info->source_compiled()); 262 EXPECT_EQ(ShaderManager::ShaderInfo::PENDING_DEFERRED_COMPILE,
263 info->compilation_status());
259 info->FlagSourceAsCompiled(true); 264 info->FlagSourceAsCompiled(true);
260 EXPECT_TRUE(info->source_compiled()); 265 EXPECT_EQ(ShaderManager::ShaderInfo::COMPILED,
266 info->compilation_status());
261 } 267 }
262 268
263 TEST_F(ShaderManagerTest, ShaderInfoStoreDeferredSource) { 269 TEST_F(ShaderManagerTest, ShaderInfoStoreDeferredSource) {
264 const GLuint kClientId = 1; 270 const GLuint kClientId = 1;
265 const GLuint kServiceId = 11; 271 const GLuint kServiceId = 11;
266 const GLenum kShaderType = GL_VERTEX_SHADER; 272 const GLenum kShaderType = GL_VERTEX_SHADER;
267 ShaderManager::ShaderInfo* info = manager_.CreateShaderInfo( 273 ShaderManager::ShaderInfo* info = manager_.CreateShaderInfo(
268 kClientId, kServiceId, kShaderType); 274 kClientId, kServiceId, kShaderType);
269 ASSERT_TRUE(info != NULL); 275 ASSERT_TRUE(info != NULL);
270 276
271 info->UpdateSource("original source"); 277 info->UpdateSource("original source");
272 info->FlagSourceAsCompiled(false); 278 info->FlagSourceAsCompiled(false);
273 279
274 EXPECT_EQ("original source", *info->deferred_compilation_source()); 280 EXPECT_EQ("original source", *info->deferred_compilation_source());
275 info->UpdateSource("different!"); 281 info->UpdateSource("different!");
276 EXPECT_EQ("original source", *info->deferred_compilation_source()); 282 EXPECT_EQ("original source", *info->deferred_compilation_source());
277 283
278 info->FlagSourceAsCompiled(true); 284 info->FlagSourceAsCompiled(true);
279 EXPECT_EQ("different!", *info->deferred_compilation_source()); 285 EXPECT_EQ("different!", *info->deferred_compilation_source());
280 } 286 }
281 287
282 } // namespace gles2 288 } // namespace gles2
283 } // namespace gpu 289 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/shader_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698