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/threading/thread.h" | 6 #include "base/threading/thread.h" |
7 #include "content/browser/browser_thread_impl.h" | 7 #include "content/browser/browser_thread_impl.h" |
8 #include "content/browser/gpu/shader_disk_cache.h" | 8 #include "content/browser/gpu/shader_disk_cache.h" |
9 #include "content/public/test/test_browser_thread.h" | 9 #include "content/public/test/test_browser_thread.h" |
10 #include "net/base/test_completion_callback.h" | 10 #include "net/base/test_completion_callback.h" |
(...skipping 24 matching lines...) Expand all Loading... |
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 virtual void TearDown() OVERRIDE { | 40 virtual void TearDown() OVERRIDE { |
41 ShaderCacheFactory::GetInstance()->RemoveCacheInfo(kDefaultClientId); | 41 ShaderCacheFactory::GetInstance()->RemoveCacheInfo(kDefaultClientId); |
42 } | 42 } |
43 | 43 |
44 base::ScopedTempDir temp_dir_; | 44 base::ScopedTempDir temp_dir_; |
45 MessageLoopForIO message_loop_; | 45 base::MessageLoopForIO message_loop_; |
46 TestBrowserThread cache_thread_; | 46 TestBrowserThread cache_thread_; |
47 TestBrowserThread io_thread_; | 47 TestBrowserThread io_thread_; |
48 | 48 |
49 DISALLOW_COPY_AND_ASSIGN(ShaderDiskCacheTest); | 49 DISALLOW_COPY_AND_ASSIGN(ShaderDiskCacheTest); |
50 }; | 50 }; |
51 | 51 |
52 TEST_F(ShaderDiskCacheTest, ClearsCache) { | 52 TEST_F(ShaderDiskCacheTest, ClearsCache) { |
53 InitCache(); | 53 InitCache(); |
54 | 54 |
55 scoped_refptr<ShaderDiskCache> cache = | 55 scoped_refptr<ShaderDiskCache> cache = |
(...skipping 13 matching lines...) Expand all Loading... |
69 EXPECT_EQ(1, cache->Size()); | 69 EXPECT_EQ(1, cache->Size()); |
70 | 70 |
71 base::Time time; | 71 base::Time time; |
72 net::TestCompletionCallback clear_cb; | 72 net::TestCompletionCallback clear_cb; |
73 rv = cache->Clear(time, time, clear_cb.callback()); | 73 rv = cache->Clear(time, time, clear_cb.callback()); |
74 ASSERT_EQ(net::OK, clear_cb.GetResult(rv)); | 74 ASSERT_EQ(net::OK, clear_cb.GetResult(rv)); |
75 EXPECT_EQ(0, cache->Size()); | 75 EXPECT_EQ(0, cache->Size()); |
76 }; | 76 }; |
77 | 77 |
78 } // namespace content | 78 } // namespace content |
OLD | NEW |