| OLD | NEW |
| 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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 FakeResponseAction(const std::string& body, | 166 FakeResponseAction(const std::string& body, |
| 167 F modifier, | 167 F modifier, |
| 168 net::FakeURLFetcher** fetcher) | 168 net::FakeURLFetcher** fetcher) |
| 169 : body_(body), modifier_(modifier), fetcher_(fetcher) {} | 169 : body_(body), modifier_(modifier), fetcher_(fetcher) {} |
| 170 | 170 |
| 171 net::URLFetcher* Perform( | 171 net::URLFetcher* Perform( |
| 172 const testing::tuple<int, | 172 const testing::tuple<int, |
| 173 const GURL&, | 173 const GURL&, |
| 174 net::URLFetcher::RequestType, | 174 net::URLFetcher::RequestType, |
| 175 net::URLFetcherDelegate*>& args) { | 175 net::URLFetcherDelegate*>& args) { |
| 176 auto fetcher = new net::FakeURLFetcher( | 176 auto* fetcher = new net::FakeURLFetcher( |
| 177 testing::get<1>(args), testing::get<3>(args), body_, net::HTTP_OK, | 177 testing::get<1>(args), testing::get<3>(args), body_, net::HTTP_OK, |
| 178 net::URLRequestStatus::SUCCESS); | 178 net::URLRequestStatus::SUCCESS); |
| 179 modifier_(fetcher); | 179 modifier_(fetcher); |
| 180 if (fetcher_) | 180 if (fetcher_) |
| 181 *fetcher_ = fetcher; | 181 *fetcher_ = fetcher; |
| 182 return fetcher; | 182 return fetcher; |
| 183 } | 183 } |
| 184 | 184 |
| 185 private: | 185 private: |
| 186 std::string body_; | 186 std::string body_; |
| (...skipping 958 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1145 | 1145 |
| 1146 EXPECT_TRUE(precache_delegate_.was_on_done_called()); | 1146 EXPECT_TRUE(precache_delegate_.was_on_done_called()); |
| 1147 | 1147 |
| 1148 // bad-manifest.com will have been completed. | 1148 // bad-manifest.com will have been completed. |
| 1149 EXPECT_THAT(histogram.GetAllSamples("Precache.Fetch.PercentCompleted"), | 1149 EXPECT_THAT(histogram.GetAllSamples("Precache.Fetch.PercentCompleted"), |
| 1150 ElementsAre(base::Bucket(100, 1))); | 1150 ElementsAre(base::Bucket(100, 1))); |
| 1151 histogram.ExpectTotalCount("Precache.Fetch.TimeToComplete", 1); | 1151 histogram.ExpectTotalCount("Precache.Fetch.TimeToComplete", 1); |
| 1152 } | 1152 } |
| 1153 | 1153 |
| 1154 } // namespace precache | 1154 } // namespace precache |
| OLD | NEW |