OLD | NEW |
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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 <algorithm> | 5 #include <algorithm> |
6 #include <memory> | 6 #include <memory> |
7 #include <set> | 7 #include <set> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 namespace { | 29 namespace { |
30 | 30 |
31 bool KeyIsEven(const disk_cache::Entry* entry) { | 31 bool KeyIsEven(const disk_cache::Entry* entry) { |
32 int key_as_int = 0; | 32 int key_as_int = 0; |
33 base::StringToInt(entry->GetKey().c_str(), &key_as_int); | 33 base::StringToInt(entry->GetKey().c_str(), &key_as_int); |
34 return (key_as_int % 2) == 0; | 34 return (key_as_int % 2) == 0; |
35 } | 35 } |
36 | 36 |
37 bool HasHttpsExampleOrigin(const GURL& url) { | 37 bool HasHttpsExampleOrigin(const GURL& url) { |
38 return url.GetOrigin() == GURL("https://example.com"); | 38 return url.GetOrigin() == "https://example.com/"; |
39 } | 39 } |
40 | 40 |
41 } // namespace | 41 } // namespace |
42 | 42 |
43 class ConditionalCacheDeletionHelperBrowserTest : public InProcessBrowserTest { | 43 class ConditionalCacheDeletionHelperBrowserTest : public InProcessBrowserTest { |
44 public: | 44 public: |
45 // Initialization ------------------------------------------------------------ | 45 // Initialization ------------------------------------------------------------ |
46 | 46 |
47 void SetUpOnMainThread() override { | 47 void SetUpOnMainThread() override { |
48 // Prepare the commonly used callbacks. | 48 // Prepare the commonly used callbacks. |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 BrowserThread::IO, FROM_HERE, | 308 BrowserThread::IO, FROM_HERE, |
309 base::Bind(&ConditionalCacheDeletionHelperBrowserTest::GetRemainingKeys, | 309 base::Bind(&ConditionalCacheDeletionHelperBrowserTest::GetRemainingKeys, |
310 base::Unretained(this))); | 310 base::Unretained(this))); |
311 WaitForTasksOnIOThread(); | 311 WaitForTasksOnIOThread(); |
312 | 312 |
313 keys.insert(newer_keys.begin(), newer_keys.end()); | 313 keys.insert(newer_keys.begin(), newer_keys.end()); |
314 keys.erase("https://example.com/foo/bar/icon2.png"); | 314 keys.erase("https://example.com/foo/bar/icon2.png"); |
315 keys.erase("https://example.com/foo/bar/icon3.png"); | 315 keys.erase("https://example.com/foo/bar/icon3.png"); |
316 CompareRemainingKeys(keys); | 316 CompareRemainingKeys(keys); |
317 } | 317 } |
OLD | NEW |