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

Side by Side Diff: chrome/browser/page_load_metrics/observers/tab_restore_page_load_metrics_observer_unittest.cc

Issue 2857963002: Revert "[PageLoadMetrics] Keep track of Ad Sizes on Pages" (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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "chrome/browser/page_load_metrics/observers/tab_restore_page_load_metri cs_observer.h" 5 #include "chrome/browser/page_load_metrics/observers/tab_restore_page_load_metri cs_observer.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 } 64 }
65 65
66 void SimulatePageLoad(bool is_restore, bool simulate_app_background) { 66 void SimulatePageLoad(bool is_restore, bool simulate_app_background) {
67 is_restore_ = is_restore; 67 is_restore_ = is_restore;
68 NavigateAndCommit(GURL(kDefaultTestUrl)); 68 NavigateAndCommit(GURL(kDefaultTestUrl));
69 SimulateTimingUpdate(timing_); 69 SimulateTimingUpdate(timing_);
70 70
71 // Prepare 4 resources of varying size and configurations. 71 // Prepare 4 resources of varying size and configurations.
72 page_load_metrics::ExtraRequestCompleteInfo resources[] = { 72 page_load_metrics::ExtraRequestCompleteInfo resources[] = {
73 // Cached request. 73 // Cached request.
74 {GURL(), -1 /* frame_tree_node_id */, true /*was_cached*/, 74 {true /*was_cached*/, 1024 * 40 /* raw_body_bytes */,
75 1024 * 40 /* raw_body_bytes */,
76 0 /* original_network_content_length */, 75 0 /* original_network_content_length */,
77 nullptr /* data_reduction_proxy_data */, 76 nullptr /* data_reduction_proxy_data */,
78 content::ResourceType::RESOURCE_TYPE_MAIN_FRAME}, 77 content::ResourceType::RESOURCE_TYPE_MAIN_FRAME},
79 // Uncached non-proxied request. 78 // Uncached non-proxied request.
80 {GURL(), -1 /* frame_tree_node_id */, false /*was_cached*/, 79 {false /*was_cached*/, 1024 * 40 /* raw_body_bytes */,
81 1024 * 40 /* raw_body_bytes */,
82 1024 * 40 /* original_network_content_length */, 80 1024 * 40 /* original_network_content_length */,
83 nullptr /* data_reduction_proxy_data */, 81 nullptr /* data_reduction_proxy_data */,
84 content::ResourceType::RESOURCE_TYPE_MAIN_FRAME}, 82 content::ResourceType::RESOURCE_TYPE_MAIN_FRAME},
85 // Uncached proxied request with .1 compression ratio. 83 // Uncached proxied request with .1 compression ratio.
86 {GURL(), -1 /* frame_tree_node_id */, false /*was_cached*/, 84 {false /*was_cached*/, 1024 * 40 /* raw_body_bytes */,
87 1024 * 40 /* raw_body_bytes */,
88 1024 * 40 /* original_network_content_length */, 85 1024 * 40 /* original_network_content_length */,
89 nullptr /* data_reduction_proxy_data */, 86 nullptr /* data_reduction_proxy_data */,
90 content::ResourceType::RESOURCE_TYPE_MAIN_FRAME}, 87 content::ResourceType::RESOURCE_TYPE_MAIN_FRAME},
91 // Uncached proxied request with .5 compression ratio. 88 // Uncached proxied request with .5 compression ratio.
92 {GURL(), -1 /* frame_tree_node_id */, false /*was_cached*/, 89 {false /*was_cached*/, 1024 * 40 /* raw_body_bytes */,
93 1024 * 40 /* raw_body_bytes */,
94 1024 * 40 /* original_network_content_length */, 90 1024 * 40 /* original_network_content_length */,
95 nullptr /* data_reduction_proxy_data */, 91 nullptr /* data_reduction_proxy_data */,
96 content::ResourceType::RESOURCE_TYPE_MAIN_FRAME}, 92 content::ResourceType::RESOURCE_TYPE_MAIN_FRAME},
97 }; 93 };
98 94
99 for (const auto& request : resources) { 95 for (const auto& request : resources) {
100 SimulateLoadedResource(request); 96 SimulateLoadedResource(request);
101 if (!request.was_cached) { 97 if (!request.was_cached) {
102 network_bytes_ += request.raw_body_bytes; 98 network_bytes_ += request.raw_body_bytes;
103 } else { 99 } else {
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 histogram_tester().ExpectUniqueSample( 157 histogram_tester().ExpectUniqueSample(
162 "PageLoad.Clients.TabRestore.Experimental.Bytes.Network", 158 "PageLoad.Clients.TabRestore.Experimental.Bytes.Network",
163 static_cast<int>(network_bytes_ / 1024), 1); 159 static_cast<int>(network_bytes_ / 1024), 1);
164 histogram_tester().ExpectUniqueSample( 160 histogram_tester().ExpectUniqueSample(
165 "PageLoad.Clients.TabRestore.Experimental.Bytes.Cache", 161 "PageLoad.Clients.TabRestore.Experimental.Bytes.Cache",
166 static_cast<int>(cache_bytes_ / 1024), 1); 162 static_cast<int>(cache_bytes_ / 1024), 1);
167 histogram_tester().ExpectUniqueSample( 163 histogram_tester().ExpectUniqueSample(
168 "PageLoad.Clients.TabRestore.Experimental.Bytes.Total", 164 "PageLoad.Clients.TabRestore.Experimental.Bytes.Total",
169 static_cast<int>((network_bytes_ + cache_bytes_) / 1024), 1); 165 static_cast<int>((network_bytes_ + cache_bytes_) / 1024), 1);
170 } 166 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698