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

Side by Side Diff: components/precache/core/precache_fetcher_unittest.cc

Issue 2762673002: predictors: Pass manifests from Bork to store in ResourcePrefetchPredictor. (Closed)
Patch Set: Rename PrecacheManifestDelegate to PrecacheManager::Delegate. Created 3 years, 9 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 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 "components/precache/core/precache_fetcher.h" 5 #include "components/precache/core/precache_fetcher.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <cstring> 9 #include <cstring>
10 #include <memory> 10 #include <memory>
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 class TestPrecacheDelegate : public PrecacheFetcher::PrecacheDelegate { 110 class TestPrecacheDelegate : public PrecacheFetcher::PrecacheDelegate {
111 public: 111 public:
112 TestPrecacheDelegate() 112 TestPrecacheDelegate()
113 : on_done_was_called_(false) {} 113 : on_done_was_called_(false) {}
114 114
115 void OnDone() override { 115 void OnDone() override {
116 LOG(INFO) << "OnDone"; 116 LOG(INFO) << "OnDone";
117 on_done_was_called_ = true; 117 on_done_was_called_ = true;
118 } 118 }
119 119
120 void OnManifestFetched(const std::string& host,
121 const PrecacheManifest& manifest) override {
122 manifests_fetched.push_back(host);
123 }
124
120 bool was_on_done_called() const { 125 bool was_on_done_called() const {
121 return on_done_was_called_; 126 return on_done_was_called_;
122 } 127 }
123 128
124 private: 129 private:
125 bool on_done_was_called_; 130 bool on_done_was_called_;
131 std::vector<std::string> manifests_fetched;
126 }; 132 };
127 133
128 class MockURLFetcherFactory : public net::URLFetcherFactory { 134 class MockURLFetcherFactory : public net::URLFetcherFactory {
129 public: 135 public:
130 typedef net::URLFetcher* DoURLFetcher( 136 typedef net::URLFetcher* DoURLFetcher(
131 int id, 137 int id,
132 const GURL& url, 138 const GURL& url,
133 net::URLFetcher::RequestType request_type, 139 net::URLFetcher::RequestType request_type,
134 net::URLFetcherDelegate* delegate); 140 net::URLFetcherDelegate* delegate);
135 141
(...skipping 1907 matching lines...) Expand 10 before | Expand all | Expand 10 after
2043 EXPECT_EQ(expected_requested_urls, url_callback_.requested_urls()); 2049 EXPECT_EQ(expected_requested_urls, url_callback_.requested_urls());
2044 2050
2045 EXPECT_TRUE(precache_delegate_.was_on_done_called()); 2051 EXPECT_TRUE(precache_delegate_.was_on_done_called());
2046 2052
2047 histogram.ExpectTotalCount("Precache.Fetch.PercentCompleted", 2); 2053 histogram.ExpectTotalCount("Precache.Fetch.PercentCompleted", 2);
2048 histogram.ExpectTotalCount("Precache.Fetch.ResponseBytes.Total", 2); 2054 histogram.ExpectTotalCount("Precache.Fetch.ResponseBytes.Total", 2);
2049 histogram.ExpectTotalCount("Precache.Fetch.TimeToComplete", 2); 2055 histogram.ExpectTotalCount("Precache.Fetch.TimeToComplete", 2);
2050 } 2056 }
2051 2057
2052 } // namespace precache 2058 } // namespace precache
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698