OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
11 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
12 #include "base/test/histogram_tester.h" | 12 #include "base/test/histogram_tester.h" |
13 #include "chrome/browser/browsing_data/browsing_data_helper.h" | 13 #include "chrome/browser/browsing_data/browsing_data_helper.h" |
14 #include "chrome/browser/browsing_data/browsing_data_remover.h" | 14 #include "chrome/browser/browsing_data/browsing_data_remover.h" |
15 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h" | 15 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h" |
| 16 #include "chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.h" |
16 #include "chrome/browser/predictors/resource_prefetch_predictor.h" | 17 #include "chrome/browser/predictors/resource_prefetch_predictor.h" |
17 #include "chrome/browser/predictors/resource_prefetch_predictor_factory.h" | 18 #include "chrome/browser/predictors/resource_prefetch_predictor_factory.h" |
18 #include "chrome/browser/predictors/resource_prefetch_predictor_test_util.h" | 19 #include "chrome/browser/predictors/resource_prefetch_predictor_test_util.h" |
19 #include "chrome/browser/profiles/profile.h" | 20 #include "chrome/browser/profiles/profile.h" |
20 #include "chrome/browser/ui/browser.h" | 21 #include "chrome/browser/ui/browser.h" |
21 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 22 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
22 #include "chrome/common/chrome_switches.h" | 23 #include "chrome/common/chrome_switches.h" |
23 #include "chrome/test/base/in_process_browser_test.h" | 24 #include "chrome/test/base/in_process_browser_test.h" |
24 #include "chrome/test/base/ui_test_utils.h" | 25 #include "chrome/test/base/ui_test_utils.h" |
25 #include "net/base/host_port_pair.h" | 26 #include "net/base/host_port_pair.h" |
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 current = edge.url; | 462 current = edge.url; |
462 } | 463 } |
463 } | 464 } |
464 | 465 |
465 void ClearResources() { resources_.clear(); } | 466 void ClearResources() { resources_.clear(); } |
466 | 467 |
467 void ClearCache() { | 468 void ClearCache() { |
468 BrowsingDataRemover* remover = | 469 BrowsingDataRemover* remover = |
469 BrowsingDataRemoverFactory::GetForBrowserContext(browser()->profile()); | 470 BrowsingDataRemoverFactory::GetForBrowserContext(browser()->profile()); |
470 BrowsingDataRemoverObserver observer(remover); | 471 BrowsingDataRemoverObserver observer(remover); |
471 remover->RemoveAndReply(base::Time(), base::Time::Max(), | 472 remover->RemoveAndReply( |
472 BrowsingDataRemover::REMOVE_CACHE, | 473 base::Time(), base::Time::Max(), BrowsingDataRemover::DATA_TYPE_CACHE, |
473 BrowsingDataHelper::UNPROTECTED_WEB, &observer); | 474 BrowsingDataRemover::ORIGIN_TYPE_UNPROTECTED_WEB, &observer); |
474 observer.Wait(); | 475 observer.Wait(); |
475 | 476 |
476 for (auto& kv : resources_) | 477 for (auto& kv : resources_) |
477 kv.second.request.was_cached = false; | 478 kv.second.request.was_cached = false; |
478 } | 479 } |
479 | 480 |
480 // Shortcut for convenience. | 481 // Shortcut for convenience. |
481 GURL GetURL(const std::string& path) const { | 482 GURL GetURL(const std::string& path) const { |
482 return embedded_test_server()->GetURL(path); | 483 return embedded_test_server()->GetURL(path); |
483 } | 484 } |
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
971 net::HIGHEST); | 972 net::HIGHEST); |
972 | 973 |
973 NavigateToURLAndCheckSubresources(initial_url); | 974 NavigateToURLAndCheckSubresources(initial_url); |
974 ClearCache(); | 975 ClearCache(); |
975 NavigateToURLAndCheckSubresources(initial_url); | 976 NavigateToURLAndCheckSubresources(initial_url); |
976 ClearCache(); | 977 ClearCache(); |
977 NavigateToURLAndCheckPrefetching(initial_url); | 978 NavigateToURLAndCheckPrefetching(initial_url); |
978 } | 979 } |
979 | 980 |
980 } // namespace predictors | 981 } // namespace predictors |
OLD | NEW |