| 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 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 keys.erase("42"); | 238 keys.erase("42"); |
| 239 CompareRemainingKeys(keys); | 239 CompareRemainingKeys(keys); |
| 240 } | 240 } |
| 241 | 241 |
| 242 // Tests that ConditionalCacheDeletionHelper correctly constructs a condition | 242 // Tests that ConditionalCacheDeletionHelper correctly constructs a condition |
| 243 // for time and URL. | 243 // for time and URL. |
| 244 // | 244 // |
| 245 // Note: This test depends on the timing in cache backends and can be flaky | 245 // Note: This test depends on the timing in cache backends and can be flaky |
| 246 // if those backends are slow. If this turns out to be a problem, consider | 246 // if those backends are slow. If this turns out to be a problem, consider |
| 247 // increasing the |timeout_ms| constant. | 247 // increasing the |timeout_ms| constant. |
| 248 IN_PROC_BROWSER_TEST_F(ConditionalCacheDeletionHelperBrowserTest, TimeAndURL) { | 248 // |
| 249 // Flakily timing out on Mac 10.11: https://crbug.com/646119 |
| 250 #if defined(OS_MACOSX) |
| 251 #define MAYBE_TimeAndURL DISABLED_TimeAndURL |
| 252 #else |
| 253 #define MAYBE_TimeAndURL TimeAndURL |
| 254 #endif |
| 255 IN_PROC_BROWSER_TEST_F(ConditionalCacheDeletionHelperBrowserTest, |
| 256 MAYBE_TimeAndURL) { |
| 249 const int64_t timeout_ms = 1; | 257 const int64_t timeout_ms = 1; |
| 250 | 258 |
| 251 // Create some entries. | 259 // Create some entries. |
| 252 std::set<std::string> keys; | 260 std::set<std::string> keys; |
| 253 keys.insert("https://google.com/index.html"); | 261 keys.insert("https://google.com/index.html"); |
| 254 keys.insert("https://example.com/foo/bar/icon.png"); | 262 keys.insert("https://example.com/foo/bar/icon.png"); |
| 255 keys.insert("http://chrome.com"); | 263 keys.insert("http://chrome.com"); |
| 256 | 264 |
| 257 BrowserThread::PostTask( | 265 BrowserThread::PostTask( |
| 258 BrowserThread::IO, FROM_HERE, | 266 BrowserThread::IO, FROM_HERE, |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 BrowserThread::IO, FROM_HERE, | 308 BrowserThread::IO, FROM_HERE, |
| 301 base::Bind(&ConditionalCacheDeletionHelperBrowserTest::GetRemainingKeys, | 309 base::Bind(&ConditionalCacheDeletionHelperBrowserTest::GetRemainingKeys, |
| 302 base::Unretained(this))); | 310 base::Unretained(this))); |
| 303 WaitForTasksOnIOThread(); | 311 WaitForTasksOnIOThread(); |
| 304 | 312 |
| 305 keys.insert(newer_keys.begin(), newer_keys.end()); | 313 keys.insert(newer_keys.begin(), newer_keys.end()); |
| 306 keys.erase("https://example.com/foo/bar/icon2.png"); | 314 keys.erase("https://example.com/foo/bar/icon2.png"); |
| 307 keys.erase("https://example.com/foo/bar/icon3.png"); | 315 keys.erase("https://example.com/foo/bar/icon3.png"); |
| 308 CompareRemainingKeys(keys); | 316 CompareRemainingKeys(keys); |
| 309 } | 317 } |
| OLD | NEW |