| OLD | NEW |
| 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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 test_prerender->WaitForLoads(0); | 158 test_prerender->WaitForLoads(0); |
| 159 } | 159 } |
| 160 | 160 |
| 161 // Check that a prefetch followed by a load produces the approriate | 161 // Check that a prefetch followed by a load produces the approriate |
| 162 // histograms. Note that other histogram testing is done in | 162 // histograms. Note that other histogram testing is done in |
| 163 // browser/page_load_metrics, in particular, testing the combinations of | 163 // browser/page_load_metrics, in particular, testing the combinations of |
| 164 // Warm/Cold and Cacheable/NoCacheable. | 164 // Warm/Cold and Cacheable/NoCacheable. |
| 165 IN_PROC_BROWSER_TEST_F(NoStatePrefetchBrowserTest, PrefetchHistograms) { | 165 IN_PROC_BROWSER_TEST_F(NoStatePrefetchBrowserTest, PrefetchHistograms) { |
| 166 PrefetchFromFile(kPrefetchPage, FINAL_STATUS_NOSTATE_PREFETCH_FINISHED); | 166 PrefetchFromFile(kPrefetchPage, FINAL_STATUS_NOSTATE_PREFETCH_FINISHED); |
| 167 histogram_tester().ExpectTotalCount( | 167 histogram_tester().ExpectTotalCount( |
| 168 "Prerender.websame_NoStatePrefetchTTFCP.Warm", 0); | 168 "Prerender.websame_PrefetchTTFCP.Warm.Cacheable.Visible", 0); |
| 169 | 169 |
| 170 test_utils::FirstContentfulPaintManagerWaiter* fcp_waiter = | 170 test_utils::FirstContentfulPaintManagerWaiter* fcp_waiter = |
| 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); |
| (...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 597 // 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 |
| 598 // 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 |
| 599 // observing the fetch of the image. | 599 // observing the fetch of the image. |
| 600 RequestCounter image_counter; | 600 RequestCounter image_counter; |
| 601 CountRequestFor(kPrefetchPng, &image_counter); | 601 CountRequestFor(kPrefetchPng, &image_counter); |
| 602 PrefetchFromFile(kPrefetchPage, FINAL_STATUS_NOSTATE_PREFETCH_FINISHED); | 602 PrefetchFromFile(kPrefetchPage, FINAL_STATUS_NOSTATE_PREFETCH_FINISHED); |
| 603 image_counter.WaitForCount(1); | 603 image_counter.WaitForCount(1); |
| 604 } | 604 } |
| 605 | 605 |
| 606 } // namespace prerender | 606 } // namespace prerender |
| OLD | NEW |