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

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

Issue 8404029: Strip comments from shader before checking for invalid characters (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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) 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
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, StripComments) {
249 const char* kSource = ""
250 "// this is a single line comment\n"
251 "this is not a comment\n"
252 "/* this is\n"
253 "a multi line\n"
254 "comment */\n"
255 "this is not a comment\n"
256 "this is an /* inline */ comment";
257 const char* kExpected = ""
258 " \n"
259 "this is not a comment\n"
260 "/*\n"
261 "\n"
262 "*/\n"
263 "this is not a comment\n"
264 "this is an /**/ comment";
265 std::string actual = ShaderManager::StripComments(kSource);
266 EXPECT_STREQ(kExpected, actual.c_str());
267 }
268
248 } // namespace gles2 269 } // namespace gles2
249 } // namespace gpu 270 } // namespace gpu
250 271
251 272
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698