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, 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 |
OLD | NEW |