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

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

Issue 2890293005: Network traffic annotation stored in url_request. (Closed)
Patch Set: Created 3 years, 7 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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 typedef net::URLFetcher* DoURLFetcher( 141 typedef net::URLFetcher* DoURLFetcher(
142 int id, 142 int id,
143 const GURL& url, 143 const GURL& url,
144 net::URLFetcher::RequestType request_type, 144 net::URLFetcher::RequestType request_type,
145 net::URLFetcherDelegate* delegate); 145 net::URLFetcherDelegate* delegate);
146 146
147 std::unique_ptr<net::URLFetcher> CreateURLFetcher( 147 std::unique_ptr<net::URLFetcher> CreateURLFetcher(
148 int id, 148 int id,
149 const GURL& url, 149 const GURL& url,
150 net::URLFetcher::RequestType request_type, 150 net::URLFetcher::RequestType request_type,
151 net::URLFetcherDelegate* delegate) override { 151 net::URLFetcherDelegate* delegate,
152 net::NetworkTrafficAnnotationTag traffic_annotation) override {
152 return base::WrapUnique( 153 return base::WrapUnique(
153 DoCreateURLFetcher(id, url, request_type, delegate)); 154 DoCreateURLFetcher(id, url, request_type, delegate));
154 } 155 }
155 156
156 // The method to mock out, instead of CreateURLFetcher. This is necessary 157 // The method to mock out, instead of CreateURLFetcher. This is necessary
157 // because gmock can't handle move-only types such as scoped_ptr. 158 // because gmock can't handle move-only types such as scoped_ptr.
158 MOCK_METHOD4(DoCreateURLFetcher, DoURLFetcher); 159 MOCK_METHOD4(DoCreateURLFetcher, DoURLFetcher);
159 160
160 // A fake successful response. When the action runs, it saves off a pointer to 161 // A fake successful response. When the action runs, it saves off a pointer to
161 // the FakeURLFetcher in its output parameter for later inspection. 162 // the FakeURLFetcher in its output parameter for later inspection.
(...skipping 1953 matching lines...) Expand 10 before | Expand all | Expand 10 after
2115 EXPECT_EQ(expected_requested_urls, url_callback_.requested_urls()); 2116 EXPECT_EQ(expected_requested_urls, url_callback_.requested_urls());
2116 EXPECT_TRUE(precache_delegate_.get_manifest_hosts().empty()); 2117 EXPECT_TRUE(precache_delegate_.get_manifest_hosts().empty());
2117 EXPECT_TRUE(precache_delegate_.was_on_done_called()); 2118 EXPECT_TRUE(precache_delegate_.was_on_done_called());
2118 2119
2119 histogram.ExpectTotalCount("Precache.Fetch.PercentCompleted", 2); 2120 histogram.ExpectTotalCount("Precache.Fetch.PercentCompleted", 2);
2120 histogram.ExpectTotalCount("Precache.Fetch.ResponseBytes.Total", 2); 2121 histogram.ExpectTotalCount("Precache.Fetch.ResponseBytes.Total", 2);
2121 histogram.ExpectTotalCount("Precache.Fetch.TimeToComplete", 2); 2122 histogram.ExpectTotalCount("Precache.Fetch.TimeToComplete", 2);
2122 } 2123 }
2123 2124
2124 } // namespace precache 2125 } // namespace precache
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698