OLD | NEW |
---|---|
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/media_page_load_metrics_obs erver.h" | 5 #include "chrome/browser/page_load_metrics/observers/media_page_load_metrics_obs erver.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
49 | 49 |
50 if (simulate_play_media) | 50 if (simulate_play_media) |
51 SimulateMediaPlayed(); | 51 SimulateMediaPlayed(); |
52 | 52 |
53 SimulateTimingUpdate(timing_); | 53 SimulateTimingUpdate(timing_); |
54 | 54 |
55 // Prepare 4 resources of varying size and configurations. | 55 // Prepare 4 resources of varying size and configurations. |
56 page_load_metrics::ExtraRequestInfo resources[] = { | 56 page_load_metrics::ExtraRequestInfo resources[] = { |
57 // Cached request. | 57 // Cached request. |
58 {true /*was_cached*/, 1024 * 40 /* raw_body_bytes */, | 58 {true /*was_cached*/, 1024 * 40 /* raw_body_bytes */, |
59 false /* data_reduction_proxy_used*/, | 59 false /* data_reduction_proxy_used*/, false /* was_lofi_response */, |
bengr
2017/04/20 17:36:18
two spaces.
RyanSturm
2017/04/20 20:25:44
Acknowledged.
| |
60 0 /* original_network_content_length */}, | 60 0 /* original_network_content_length */}, |
61 // Uncached non-proxied request. | 61 // Uncached non-proxied request. |
62 {false /*was_cached*/, 1024 * 40 /* raw_body_bytes */, | 62 {false /*was_cached*/, 1024 * 40 /* raw_body_bytes */, |
63 false /* data_reduction_proxy_used*/, | 63 false /* data_reduction_proxy_used*/, false /* was_lofi_response */, |
64 1024 * 40 /* original_network_content_length */}, | 64 1024 * 40 /* original_network_content_length */}, |
65 // Uncached proxied request with .1 compression ratio. | 65 // Uncached proxied request with .1 compression ratio. |
66 {false /*was_cached*/, 1024 * 40 /* raw_body_bytes */, | 66 {false /*was_cached*/, 1024 * 40 /* raw_body_bytes */, |
67 false /* data_reduction_proxy_used*/, | 67 false /* data_reduction_proxy_used*/, false /* was_lofi_response */, |
68 1024 * 40 /* original_network_content_length */}, | 68 1024 * 40 /* original_network_content_length */}, |
69 // Uncached proxied request with .5 compression ratio. | 69 // Uncached proxied request with .5 compression ratio. |
70 {false /*was_cached*/, 1024 * 40 /* raw_body_bytes */, | 70 {false /*was_cached*/, 1024 * 40 /* raw_body_bytes */, |
71 false /* data_reduction_proxy_used*/, | 71 false /* data_reduction_proxy_used*/, false /* was_lofi_response */, |
72 1024 * 40 /* original_network_content_length */}, | 72 1024 * 40 /* original_network_content_length */}, |
73 }; | 73 }; |
74 | 74 |
75 for (auto request : resources) { | 75 for (auto request : resources) { |
76 SimulateLoadedResource(request); | 76 SimulateLoadedResource(request); |
77 if (!request.was_cached) { | 77 if (!request.was_cached) { |
78 network_bytes_ += request.raw_body_bytes; | 78 network_bytes_ += request.raw_body_bytes; |
79 } else { | 79 } else { |
80 cache_bytes_ += request.raw_body_bytes; | 80 cache_bytes_ += request.raw_body_bytes; |
81 } | 81 } |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
141 SimulatePageLoad(false /* simulate_play_media */, | 141 SimulatePageLoad(false /* simulate_play_media */, |
142 false /* simulate_app_background */); | 142 false /* simulate_app_background */); |
143 | 143 |
144 histogram_tester().ExpectTotalCount( | 144 histogram_tester().ExpectTotalCount( |
145 "PageLoad.Clients.MediaPageLoad.Experimental.Bytes.Network", 0); | 145 "PageLoad.Clients.MediaPageLoad.Experimental.Bytes.Network", 0); |
146 histogram_tester().ExpectTotalCount( | 146 histogram_tester().ExpectTotalCount( |
147 "PageLoad.Clients.MediaPageLoad.Experimental.Bytes.Cache", 0); | 147 "PageLoad.Clients.MediaPageLoad.Experimental.Bytes.Cache", 0); |
148 histogram_tester().ExpectTotalCount( | 148 histogram_tester().ExpectTotalCount( |
149 "PageLoad.Clients.MediaPageLoad.Experimental.Bytes.Total", 0); | 149 "PageLoad.Clients.MediaPageLoad.Experimental.Bytes.Total", 0); |
150 } | 150 } |
OLD | NEW |