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/message_loop/message_loop_proxy.h" | 6 #include "base/message_loop/message_loop_proxy.h" |
7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
8 #include "base/threading/thread.h" | 8 #include "base/threading/thread.h" |
9 #include "content/browser/browser_thread_impl.h" | 9 #include "content/browser/browser_thread_impl.h" |
10 #include "content/browser/gpu/shader_disk_cache.h" | 10 #include "content/browser/gpu/shader_disk_cache.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 content::TestBrowserThreadBundle thread_bundle_; | 93 content::TestBrowserThreadBundle thread_bundle_; |
94 | 94 |
95 scoped_refptr<ShaderDiskCache> cache_; | 95 scoped_refptr<ShaderDiskCache> cache_; |
96 }; | 96 }; |
97 | 97 |
98 void ClearData(content::StoragePartitionImpl* sp, | 98 void ClearData(content::StoragePartitionImpl* sp, |
99 const base::Closure& cb) { | 99 const base::Closure& cb) { |
100 base::Time time; | 100 base::Time time; |
101 sp->ClearDataForRange( | 101 sp->ClearDataForRange( |
102 StoragePartition::REMOVE_DATA_MASK_SHADER_CACHE, | 102 StoragePartition::REMOVE_DATA_MASK_SHADER_CACHE, |
103 StoragePartition::kAllStorage, | 103 StoragePartition::QUOTA_MANAGED_STORAGE_MASK_ALL, |
104 time, time, cb); | 104 time, time, cb); |
105 } | 105 } |
106 | 106 |
107 TEST_F(StoragePartitionShaderClearTest, ClearShaderCache) { | 107 TEST_F(StoragePartitionShaderClearTest, ClearShaderCache) { |
108 InitCache(); | 108 InitCache(); |
109 EXPECT_EQ(1u, Size()); | 109 EXPECT_EQ(1u, Size()); |
110 | 110 |
111 TestClosureCallback clear_cb; | 111 TestClosureCallback clear_cb; |
112 StoragePartitionImpl sp(cache_path(), | 112 StoragePartitionImpl sp(cache_path(), |
113 NULL, | 113 NULL, |
114 NULL, | 114 NULL, |
115 NULL, | 115 NULL, |
116 NULL, | 116 NULL, |
117 NULL, | 117 NULL, |
118 NULL, | 118 NULL, |
119 scoped_ptr<WebRTCIdentityStore>()); | 119 scoped_ptr<WebRTCIdentityStore>()); |
120 base::MessageLoop::current()->PostTask( | 120 base::MessageLoop::current()->PostTask( |
121 FROM_HERE, base::Bind(&ClearData, &sp, clear_cb.callback())); | 121 FROM_HERE, base::Bind(&ClearData, &sp, clear_cb.callback())); |
122 clear_cb.WaitForResult(); | 122 clear_cb.WaitForResult(); |
123 EXPECT_EQ(0u, Size()); | 123 EXPECT_EQ(0u, Size()); |
124 } | 124 } |
125 | 125 |
126 } // namespace content | 126 } // namespace content |
OLD | NEW |