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

Side by Side Diff: chrome/browser/prerender/prerender_nostate_prefetch_browsertest.cc

Issue 2620383002: [NoStatePrefetch] Fix the PrefetchAge histogram to match histograms.xml (Closed)
Patch Set: Created 3 years, 11 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
« no previous file with comments | « chrome/browser/prerender/prerender_histograms.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/strings/string16.h" 6 #include "base/strings/string16.h"
7 #include "base/strings/string_split.h" 7 #include "base/strings/string_split.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "base/task_scheduler/post_task.h" 9 #include "base/task_scheduler/post_task.h"
10 #include "chrome/browser/history/history_service_factory.h" 10 #include "chrome/browser/history/history_service_factory.h"
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 test_utils::FirstContentfulPaintManagerWaiter::Create( 171 test_utils::FirstContentfulPaintManagerWaiter::Create(
172 GetPrerenderManager()); 172 GetPrerenderManager());
173 ui_test_utils::NavigateToURL( 173 ui_test_utils::NavigateToURL(
174 current_browser(), src_server()->GetURL(MakeAbsolute(kPrefetchPage))); 174 current_browser(), src_server()->GetURL(MakeAbsolute(kPrefetchPage)));
175 fcp_waiter->Wait(); 175 fcp_waiter->Wait();
176 176
177 histogram_tester().ExpectTotalCount( 177 histogram_tester().ExpectTotalCount(
178 "Prerender.websame_PrefetchTTFCP.Warm.Cacheable.Visible", 1); 178 "Prerender.websame_PrefetchTTFCP.Warm.Cacheable.Visible", 1);
179 histogram_tester().ExpectTotalCount( 179 histogram_tester().ExpectTotalCount(
180 "Prerender.websame_NoStatePrefetchResponseTypes", 2); 180 "Prerender.websame_NoStatePrefetchResponseTypes", 2);
181 histogram_tester().ExpectTotalCount("Prerender.websame_PrefetchAge", 1);
181 } 182 }
182 183
183 // Checks the prefetch of an img tag. 184 // Checks the prefetch of an img tag.
184 IN_PROC_BROWSER_TEST_F(NoStatePrefetchBrowserTest, PrefetchImage) { 185 IN_PROC_BROWSER_TEST_F(NoStatePrefetchBrowserTest, PrefetchImage) {
185 RequestCounter image_counter; 186 RequestCounter image_counter;
186 CountRequestFor(kPrefetchJpeg, &image_counter); 187 CountRequestFor(kPrefetchJpeg, &image_counter);
187 base::StringPairs replacement_text; 188 base::StringPairs replacement_text;
188 replacement_text.push_back( 189 replacement_text.push_back(
189 std::make_pair("REPLACE_WITH_IMAGE_URL", MakeAbsolute(kPrefetchJpeg))); 190 std::make_pair("REPLACE_WITH_IMAGE_URL", MakeAbsolute(kPrefetchJpeg)));
190 std::string main_page_path; 191 std::string main_page_path;
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 // The SW intercepts kPrefetchPage and replaces it with a body that contains 597 // The SW intercepts kPrefetchPage and replaces it with a body that contains
597 // an <img> tage for kPrefetchPng. This verifies that the SW ran correctly by 598 // an <img> tage for kPrefetchPng. This verifies that the SW ran correctly by
598 // observing the fetch of the image. 599 // observing the fetch of the image.
599 RequestCounter image_counter; 600 RequestCounter image_counter;
600 CountRequestFor(kPrefetchPng, &image_counter); 601 CountRequestFor(kPrefetchPng, &image_counter);
601 PrefetchFromFile(kPrefetchPage, FINAL_STATUS_NOSTATE_PREFETCH_FINISHED); 602 PrefetchFromFile(kPrefetchPage, FINAL_STATUS_NOSTATE_PREFETCH_FINISHED);
602 image_counter.WaitForCount(1); 603 image_counter.WaitForCount(1);
603 } 604 }
604 605
605 } // namespace prerender 606 } // namespace prerender
OLDNEW
« no previous file with comments | « chrome/browser/prerender/prerender_histograms.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698