OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/files/scoped_temp_dir.h" | 5 #include "base/files/scoped_temp_dir.h" |
6 #include "base/macros.h" | 6 #include "base/macros.h" |
7 #include "base/threading/thread.h" | 7 #include "base/threading/thread.h" |
8 #include "content/browser/browser_thread_impl.h" | 8 #include "content/browser/browser_thread_impl.h" |
9 #include "content/browser/gpu/shader_disk_cache.h" | 9 #include "content/browser/gpu/shader_disk_cache.h" |
10 #include "content/public/test/test_browser_thread_bundle.h" | 10 #include "content/public/test/test_browser_thread_bundle.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 } // namespace | 21 } // namespace |
22 | 22 |
23 class ShaderDiskCacheTest : public testing::Test { | 23 class ShaderDiskCacheTest : public testing::Test { |
24 public: | 24 public: |
25 ShaderDiskCacheTest() | 25 ShaderDiskCacheTest() |
26 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP) { | 26 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP) { |
27 } | 27 } |
28 | 28 |
29 ~ShaderDiskCacheTest() override {} | 29 ~ShaderDiskCacheTest() override {} |
30 | 30 |
31 const base::FilePath& cache_path() { return temp_dir_.path(); } | 31 const base::FilePath& cache_path() { return temp_dir_.GetPath(); } |
32 | 32 |
33 void InitCache() { | 33 void InitCache() { |
34 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 34 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
35 ShaderCacheFactory::GetInstance()->SetCacheInfo(kDefaultClientId, | 35 ShaderCacheFactory::GetInstance()->SetCacheInfo(kDefaultClientId, |
36 cache_path()); | 36 cache_path()); |
37 } | 37 } |
38 | 38 |
39 private: | 39 private: |
40 void TearDown() override { | 40 void TearDown() override { |
41 ShaderCacheFactory::GetInstance()->RemoveCacheInfo(kDefaultClientId); | 41 ShaderCacheFactory::GetInstance()->RemoveCacheInfo(kDefaultClientId); |
(...skipping 25 matching lines...) Expand all Loading... |
67 EXPECT_EQ(1, cache->Size()); | 67 EXPECT_EQ(1, cache->Size()); |
68 | 68 |
69 base::Time time; | 69 base::Time time; |
70 net::TestCompletionCallback clear_cb; | 70 net::TestCompletionCallback clear_cb; |
71 rv = cache->Clear(time, time, clear_cb.callback()); | 71 rv = cache->Clear(time, time, clear_cb.callback()); |
72 ASSERT_EQ(net::OK, clear_cb.GetResult(rv)); | 72 ASSERT_EQ(net::OK, clear_cb.GetResult(rv)); |
73 EXPECT_EQ(0, cache->Size()); | 73 EXPECT_EQ(0, cache->Size()); |
74 }; | 74 }; |
75 | 75 |
76 } // namespace content | 76 } // namespace content |
OLD | NEW |