| OLD | NEW |
| 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_cache.h" | 5 #include "gpu/command_buffer/service/program_cache.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include <memory> |
| 8 |
| 8 #include "gpu/command_buffer/service/mocks.h" | 9 #include "gpu/command_buffer/service/mocks.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 11 |
| 11 using ::testing::Return; | 12 using ::testing::Return; |
| 12 | 13 |
| 13 namespace gpu { | 14 namespace gpu { |
| 14 namespace gles2 { | 15 namespace gles2 { |
| 15 | 16 |
| 16 class NoBackendProgramCache : public ProgramCache { | 17 class NoBackendProgramCache : public ProgramCache { |
| 17 public: | 18 public: |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 ProgramCache::Evict(program_hash); | 85 ProgramCache::Evict(program_hash); |
| 85 } | 86 } |
| 86 }; | 87 }; |
| 87 | 88 |
| 88 class ProgramCacheTest : public testing::Test { | 89 class ProgramCacheTest : public testing::Test { |
| 89 public: | 90 public: |
| 90 ProgramCacheTest() : | 91 ProgramCacheTest() : |
| 91 cache_(new NoBackendProgramCache()) { } | 92 cache_(new NoBackendProgramCache()) { } |
| 92 | 93 |
| 93 protected: | 94 protected: |
| 94 scoped_ptr<NoBackendProgramCache> cache_; | 95 std::unique_ptr<NoBackendProgramCache> cache_; |
| 95 std::vector<std::string> varyings_; | 96 std::vector<std::string> varyings_; |
| 96 }; | 97 }; |
| 97 | 98 |
| 98 TEST_F(ProgramCacheTest, LinkStatusSave) { | 99 TEST_F(ProgramCacheTest, LinkStatusSave) { |
| 99 const std::string shader1 = "abcd1234"; | 100 const std::string shader1 = "abcd1234"; |
| 100 const std::string shader2 = "abcda sda b1~#4 bbbbb1234"; | 101 const std::string shader2 = "abcda sda b1~#4 bbbbb1234"; |
| 101 { | 102 { |
| 102 std::string shader_a = shader1; | 103 std::string shader_a = shader1; |
| 103 std::string shader_b = shader2; | 104 std::string shader_b = shader2; |
| 104 EXPECT_EQ(ProgramCache::LINK_UNKNOWN, | 105 EXPECT_EQ(ProgramCache::LINK_UNKNOWN, |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 varyings_, GL_SEPARATE_ATTRIBS)); | 232 varyings_, GL_SEPARATE_ATTRIBS)); |
| 232 | 233 |
| 233 varyings_.push_back("b"); | 234 varyings_.push_back("b"); |
| 234 EXPECT_EQ(ProgramCache::LINK_UNKNOWN, | 235 EXPECT_EQ(ProgramCache::LINK_UNKNOWN, |
| 235 cache_->GetLinkedProgramStatus(shader1, shader2, NULL, | 236 cache_->GetLinkedProgramStatus(shader1, shader2, NULL, |
| 236 varyings_, GL_INTERLEAVED_ATTRIBS)); | 237 varyings_, GL_INTERLEAVED_ATTRIBS)); |
| 237 } | 238 } |
| 238 | 239 |
| 239 } // namespace gles2 | 240 } // namespace gles2 |
| 240 } // namespace gpu | 241 } // namespace gpu |
| OLD | NEW |