Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(347)

Side by Side Diff: chrome/browser/predictors/resource_prefetch_predictor_browsertest.cc

Issue 2697123004: Convert RemoveDataMask from enum to pointers and split it between content and embedder (Closed)
Patch Set: More compilation error fixes. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "chrome/browser/browsing_data/browsing_data_helper.h" 12 #include "chrome/browser/browsing_data/browsing_data_helper.h"
13 #include "chrome/browser/browsing_data/browsing_data_remover.h" 13 #include "chrome/browser/browsing_data/browsing_data_remover.h"
14 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h" 14 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h"
15 #include "chrome/browser/browsing_data/chrome_browsing_data_types.h"
15 #include "chrome/browser/predictors/resource_prefetch_predictor.h" 16 #include "chrome/browser/predictors/resource_prefetch_predictor.h"
16 #include "chrome/browser/predictors/resource_prefetch_predictor_factory.h" 17 #include "chrome/browser/predictors/resource_prefetch_predictor_factory.h"
17 #include "chrome/browser/predictors/resource_prefetch_predictor_test_util.h" 18 #include "chrome/browser/predictors/resource_prefetch_predictor_test_util.h"
18 #include "chrome/browser/profiles/profile.h" 19 #include "chrome/browser/profiles/profile.h"
19 #include "chrome/browser/ui/browser.h" 20 #include "chrome/browser/ui/browser.h"
20 #include "chrome/browser/ui/tabs/tab_strip_model.h" 21 #include "chrome/browser/ui/tabs/tab_strip_model.h"
21 #include "chrome/common/chrome_switches.h" 22 #include "chrome/common/chrome_switches.h"
22 #include "chrome/test/base/in_process_browser_test.h" 23 #include "chrome/test/base/in_process_browser_test.h"
23 #include "chrome/test/base/ui_test_utils.h" 24 #include "chrome/test/base/ui_test_utils.h"
24 #include "net/base/host_port_pair.h" 25 #include "net/base/host_port_pair.h"
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 } 438 }
438 } 439 }
439 440
440 void ClearResources() { resources_.clear(); } 441 void ClearResources() { resources_.clear(); }
441 442
442 void ClearCache() { 443 void ClearCache() {
443 BrowsingDataRemover* remover = 444 BrowsingDataRemover* remover =
444 BrowsingDataRemoverFactory::GetForBrowserContext(browser()->profile()); 445 BrowsingDataRemoverFactory::GetForBrowserContext(browser()->profile());
445 BrowsingDataRemoverObserver observer(remover); 446 BrowsingDataRemoverObserver observer(remover);
446 remover->RemoveAndReply(base::Time(), base::Time::Max(), 447 remover->RemoveAndReply(base::Time(), base::Time::Max(),
447 BrowsingDataRemover::REMOVE_CACHE, 448 {&kBrowsingDataTypeCache},
448 BrowsingDataHelper::UNPROTECTED_WEB, &observer); 449 BrowsingDataHelper::UNPROTECTED_WEB, &observer);
449 observer.Wait(); 450 observer.Wait();
450 451
451 for (auto& kv : resources_) 452 for (auto& kv : resources_)
452 kv.second.request.was_cached = false; 453 kv.second.request.was_cached = false;
453 } 454 }
454 455
455 // Shortcut for convenience. 456 // Shortcut for convenience.
456 GURL GetURL(const std::string& path) const { 457 GURL GetURL(const std::string& path) const {
457 return embedded_test_server()->GetURL(path); 458 return embedded_test_server()->GetURL(path);
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
872 TryToPrefetchURL(initial_url); 873 TryToPrefetchURL(initial_url);
873 NavigateToURLAndCheckSubresources(initial_url); 874 NavigateToURLAndCheckSubresources(initial_url);
874 ClearCache(); 875 ClearCache();
875 // But the predictor database contains all subresources for the endpoint url 876 // But the predictor database contains all subresources for the endpoint url
876 // so this prefetch works. 877 // so this prefetch works.
877 PrefetchURL(GetURL(kHtmlSubresourcesPath)); 878 PrefetchURL(GetURL(kHtmlSubresourcesPath));
878 NavigateToURLAndCheckSubresourcesAllCached(GetURL(kHtmlSubresourcesPath)); 879 NavigateToURLAndCheckSubresourcesAllCached(GetURL(kHtmlSubresourcesPath));
879 } 880 }
880 881
881 } // namespace predictors 882 } // namespace predictors
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698