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

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

Issue 2833523002: Adding opt out and previews type information to DRP pingback (Closed)
Patch Set: bengr comments Created 3 years, 8 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
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::ExtraRequestInfo resources[] = { 72 page_load_metrics::ExtraRequestInfo resources[] = {
73 // Cached request. 73 // Cached request.
74 {true /*was_cached*/, 1024 * 40 /* raw_body_bytes */, 74 {true /*was_cached*/, 1024 * 40 /* raw_body_bytes */,
75 false /* data_reduction_proxy_used*/, 75 0 /* original_network_content_length */,
76 0 /* original_network_content_length */}, 76 nullptr /* data_reduction_proxy_data */},
77 // Uncached non-proxied request. 77 // Uncached non-proxied request.
78 {false /*was_cached*/, 1024 * 40 /* raw_body_bytes */, 78 {false /*was_cached*/, 1024 * 40 /* raw_body_bytes */,
79 false /* data_reduction_proxy_used*/, 79 1024 * 40 /* original_network_content_length */,
80 1024 * 40 /* original_network_content_length */}, 80 nullptr /* data_reduction_proxy_data */},
81 // Uncached proxied request with .1 compression ratio. 81 // Uncached proxied request with .1 compression ratio.
82 {false /*was_cached*/, 1024 * 40 /* raw_body_bytes */, 82 {false /*was_cached*/, 1024 * 40 /* raw_body_bytes */,
83 false /* data_reduction_proxy_used*/, 83 1024 * 40 /* original_network_content_length */,
84 1024 * 40 /* original_network_content_length */}, 84 nullptr /* data_reduction_proxy_data */},
85 // Uncached proxied request with .5 compression ratio. 85 // Uncached proxied request with .5 compression ratio.
86 {false /*was_cached*/, 1024 * 40 /* raw_body_bytes */, 86 {false /*was_cached*/, 1024 * 40 /* raw_body_bytes */,
87 false /* data_reduction_proxy_used*/, 87 1024 * 40 /* original_network_content_length */,
88 1024 * 40 /* original_network_content_length */}, 88 nullptr /* data_reduction_proxy_data */},
89 }; 89 };
90 90
91 for (auto request : resources) { 91 for (const auto& request : resources) {
92 SimulateLoadedResource(request); 92 SimulateLoadedResource(request);
93 if (!request.was_cached) { 93 if (!request.was_cached) {
94 network_bytes_ += request.raw_body_bytes; 94 network_bytes_ += request.raw_body_bytes;
95 } else { 95 } else {
96 cache_bytes_ += request.raw_body_bytes; 96 cache_bytes_ += request.raw_body_bytes;
97 } 97 }
98 } 98 }
99 99
100 if (simulate_app_background) { 100 if (simulate_app_background) {
101 // The histograms should be logged when the app is backgrounded. 101 // The histograms should be logged when the app is backgrounded.
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 histogram_tester().ExpectUniqueSample( 153 histogram_tester().ExpectUniqueSample(
154 "PageLoad.Clients.TabRestore.Experimental.Bytes.Network", 154 "PageLoad.Clients.TabRestore.Experimental.Bytes.Network",
155 static_cast<int>(network_bytes_ / 1024), 1); 155 static_cast<int>(network_bytes_ / 1024), 1);
156 histogram_tester().ExpectUniqueSample( 156 histogram_tester().ExpectUniqueSample(
157 "PageLoad.Clients.TabRestore.Experimental.Bytes.Cache", 157 "PageLoad.Clients.TabRestore.Experimental.Bytes.Cache",
158 static_cast<int>(cache_bytes_ / 1024), 1); 158 static_cast<int>(cache_bytes_ / 1024), 1);
159 histogram_tester().ExpectUniqueSample( 159 histogram_tester().ExpectUniqueSample(
160 "PageLoad.Clients.TabRestore.Experimental.Bytes.Total", 160 "PageLoad.Clients.TabRestore.Experimental.Bytes.Total",
161 static_cast<int>((network_bytes_ + cache_bytes_) / 1024), 1); 161 static_cast<int>((network_bytes_ + cache_bytes_) / 1024), 1);
162 } 162 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698