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/file_util.h" | 5 #include "base/file_util.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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 } | 172 } |
173 | 173 |
174 void AddDOMStorageTestData() { | 174 void AddDOMStorageTestData() { |
175 // Note: This test depends on details of how the dom_storage library | 175 // Note: This test depends on details of how the dom_storage library |
176 // stores data in the host file system. | 176 // stores data in the host file system. |
177 base::FilePath storage_path = | 177 base::FilePath storage_path = |
178 profile_->GetPath().AppendASCII("Local Storage"); | 178 profile_->GetPath().AppendASCII("Local Storage"); |
179 base::CreateDirectory(storage_path); | 179 base::CreateDirectory(storage_path); |
180 | 180 |
181 // Write some files. | 181 // Write some files. |
182 file_util::WriteFile(storage_path.Append(kDomStorageOrigin1), NULL, 0); | 182 base::WriteFile(storage_path.Append(kDomStorageOrigin1), NULL, 0); |
183 file_util::WriteFile(storage_path.Append(kDomStorageOrigin2), NULL, 0); | 183 base::WriteFile(storage_path.Append(kDomStorageOrigin2), NULL, 0); |
184 file_util::WriteFile(storage_path.Append(kDomStorageOrigin3), NULL, 0); | 184 base::WriteFile(storage_path.Append(kDomStorageOrigin3), NULL, 0); |
185 | 185 |
186 // Tweak their dates. | 186 // Tweak their dates. |
187 base::Time now = base::Time::Now(); | 187 base::Time now = base::Time::Now(); |
188 base::TouchFile(storage_path.Append(kDomStorageOrigin1), now, now); | 188 base::TouchFile(storage_path.Append(kDomStorageOrigin1), now, now); |
189 | 189 |
190 base::Time one_day_ago = now - base::TimeDelta::FromDays(1); | 190 base::Time one_day_ago = now - base::TimeDelta::FromDays(1); |
191 base::TouchFile(storage_path.Append(kDomStorageOrigin2), | 191 base::TouchFile(storage_path.Append(kDomStorageOrigin2), |
192 one_day_ago, one_day_ago); | 192 one_day_ago, one_day_ago); |
193 | 193 |
194 base::Time sixty_days_ago = now - base::TimeDelta::FromDays(60); | 194 base::Time sixty_days_ago = now - base::TimeDelta::FromDays(60); |
(...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
928 &run_loop)); | 928 &run_loop)); |
929 run_loop.Run(); | 929 run_loop.Run(); |
930 | 930 |
931 // kOrigin1 and kOrigin2 do not have age more than a week. | 931 // kOrigin1 and kOrigin2 do not have age more than a week. |
932 EXPECT_FALSE(tester.DOMStorageExistsForOrigin(kOrigin1)); | 932 EXPECT_FALSE(tester.DOMStorageExistsForOrigin(kOrigin1)); |
933 EXPECT_FALSE(tester.DOMStorageExistsForOrigin(kOrigin2)); | 933 EXPECT_FALSE(tester.DOMStorageExistsForOrigin(kOrigin2)); |
934 EXPECT_TRUE(tester.DOMStorageExistsForOrigin(kOrigin3)); | 934 EXPECT_TRUE(tester.DOMStorageExistsForOrigin(kOrigin3)); |
935 } | 935 } |
936 | 936 |
937 } // namespace content | 937 } // namespace content |
OLD | NEW |