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

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

Issue 2798953002: [PageLoadMetrics] Keep track of Ad Sizes on Pages (Closed)
Patch Set: Clean up test 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/page_load_metrics/observers/ads_page_load_metrics_obser ver.h"
6
7 #include <string>
8
9 #include "base/macros.h"
10 #include "chrome/browser/page_load_metrics/observers/page_load_metrics_observer_ test_harness.h"
11 #include "chrome/browser/page_load_metrics/page_load_tracker.h"
12 #include "content/public/browser/render_frame_host.h"
13 #include "content/public/test/navigation_simulator.h"
14 #include "content/public/test/test_renderer_host.h"
15 #include "url/gurl.h"
16
17 using content::RenderFrameHost;
18 using content::RenderFrameHostTester;
19 using content::NavigationSimulator;
20
21 namespace {
22
23 enum class ResourceCached { NOT_CACHED, CACHED };
24
25 } // namespace
26
27 class AdsPageLoadMetricsObserverTest
28 : public page_load_metrics::PageLoadMetricsObserverTestHarness {
29 public:
30 AdsPageLoadMetricsObserverTest() {}
31
32 RenderFrameHost* NavigateMainFrame(const GURL& url) {
Charlie Harrison 2017/04/24 19:18:26 Can you document that these return the final RFH?
jkarlin 2017/04/25 15:56:50 Done.
33 RenderFrameHost* main_frame = web_contents()->GetMainFrame();
Charlie Harrison 2017/04/24 19:18:26 #include web_contents
jkarlin 2017/04/25 15:56:50 Done.
34 auto navigation_simulator =
35 NavigationSimulator::CreateRendererInitiated(url, main_frame);
36 navigation_simulator->Commit();
37 return navigation_simulator->GetFinalRenderFrameHost();
38 }
39
40 RenderFrameHost* RenavigateFrame(const GURL& url,
Charlie Harrison 2017/04/24 19:18:26 Just rename this NavigateFrame since it is pretty
jkarlin 2017/04/25 15:56:51 Good idea, done.
41 content::RenderFrameHost* frame) {
42 auto navigation_simulator =
43 NavigationSimulator::CreateRendererInitiated(url, frame);
44 navigation_simulator->Commit();
45 return navigation_simulator->GetFinalRenderFrameHost();
46 }
47
48 RenderFrameHost* CreateAndNavigateSubFrame(const GURL& url,
49 const std::string& frame_name,
Charlie Harrison 2017/04/24 19:18:26 Optional: Unless you really need the frame name, i
jkarlin 2017/04/25 15:56:51 It's needed, but I've cleaned up the strings to ma
50 content::RenderFrameHost* parent) {
51 RenderFrameHost* subframe =
52 RenderFrameHostTester::For(parent)->AppendChild(frame_name);
53 auto navigation_simulator =
54 NavigationSimulator::CreateRendererInitiated(url, subframe);
55 navigation_simulator->Commit();
56 return navigation_simulator->GetFinalRenderFrameHost();
57 }
58
59 void LoadResource(RenderFrameHost* frame,
60 ResourceCached resource_cached,
61 int resource_size_in_kb) {
62 page_load_metrics::ExtraRequestInfo request(
Charlie Harrison 2017/04/24 19:18:26 #include page_load_metrics_observer
jkarlin 2017/04/25 15:56:50 Done.
63 GURL("http://foo.com/bar"), frame->GetFrameTreeNodeId(),
64 resource_cached == ResourceCached::CACHED, resource_size_in_kb * 1024,
65 false /* data_reduction_proxy_used */,
66 0 /* original_network_content_length */);
67 SimulateLoadedResource(request);
68 }
69
70 protected:
71 void RegisterObservers(page_load_metrics::PageLoadTracker* tracker) override {
72 tracker->AddObserver(base::MakeUnique<AdsPageLoadMetricsObserver>());
73 }
74
75 private:
76 DISALLOW_COPY_AND_ASSIGN(AdsPageLoadMetricsObserverTest);
77 };
78
79 TEST_F(AdsPageLoadMetricsObserverTest, PageWithNoAds) {
80 RenderFrameHost* main_frame = NavigateMainFrame(GURL("https://foo.com/"));
81 RenderFrameHost* frame1 = CreateAndNavigateSubFrame(
82 GURL("https://bar.com/frame1"), "foo name", main_frame);
83 RenderFrameHost* frame2 =
84 CreateAndNavigateSubFrame(GURL("https://bar.com/frame2"), "", main_frame);
85 LoadResource(main_frame, ResourceCached::NOT_CACHED, 1);
86 LoadResource(frame1, ResourceCached::NOT_CACHED, 1);
87 LoadResource(frame2, ResourceCached::NOT_CACHED, 1);
88
89 // Navigate again to trigger histograms.
90 RenavigateFrame(GURL("https://bar.com/"), main_frame);
91
92 histogram_tester().ExpectUniqueSample(
93 "PageLoad.Clients.Ads.Google.AdFrameCount", 0, 1);
94 histogram_tester().ExpectTotalCount(
95 "PageLoad.Clients.Ads.Google.Bytes.AllAdFrames.Total", 0);
96 }
97
98 TEST_F(AdsPageLoadMetricsObserverTest, ResourceBeforeAdFrameCommits) {
99 RenderFrameHost* main_frame = NavigateMainFrame(GURL("https://foo.com/"));
100
101 LoadResource(main_frame, ResourceCached::NOT_CACHED, 1);
Charlie Harrison 2017/04/24 19:18:26 Optional: I know it's annoying to ask (hence why t
jkarlin 2017/04/25 15:56:51 Done.
102
103 // Assume that the next frame's id will be the main frame + 1 and load a
104 // resource for that frame. Make sure it gets counted.
105 page_load_metrics::ExtraRequestInfo request(
106 GURL("http://foo.com/bar"), main_frame->GetFrameTreeNodeId() + 1,
107 false /* cached */, 1024 /* size */,
108 false /* data_reduction_proxy_used */,
109 0 /* original_network_content_length */);
110 SimulateLoadedResource(request);
111
112 CreateAndNavigateSubFrame(GURL("https://foo.com/frame2"),
113 "google_ads_iframe_1", main_frame);
114
115 // Navigate again to trigger histograms.
116 RenavigateFrame(GURL("https://bar.com/"), main_frame);
117
118 // 2KB total were loaded from network, one of which was in an ad frame.
119 histogram_tester().ExpectUniqueSample(
120 "PageLoad.Clients.Ads.Google.AdFrameCount", 1, 1);
121 histogram_tester().ExpectUniqueSample(
122 "PageLoad.Clients.Ads.Google.SubFrameCount.TopLevel", 1, 1);
123 histogram_tester().ExpectUniqueSample(
124 "PageLoad.Clients.Ads.Google.AdFrameCount.TopLevel", 1, 1);
125 histogram_tester().ExpectUniqueSample(
126 "PageLoad.Clients.Ads.Google.PercentSubFramesAreAdFrames.TopLevel", 100,
127 1);
128
129 // Individual Ad Frame Metrics
130 histogram_tester().ExpectUniqueSample(
131 "PageLoad.Clients.Ads.Google.Bytes.PerAdFrame.Total", 1, 1);
132 histogram_tester().ExpectUniqueSample(
133 "PageLoad.Clients.Ads.Google.Bytes.PerAdFrame.Network", 1, 1);
134 histogram_tester().ExpectUniqueSample(
135 "PageLoad.Clients.Ads.Google.Bytes.PercentAdFrame.Network", 100, 1);
136
137 // Page percentages
138 histogram_tester().ExpectUniqueSample(
139 "PageLoad.Clients.Ads.Google.Bytes.PercentPage.AllAdFrames.Total", 50, 1);
140 histogram_tester().ExpectUniqueSample(
141 "PageLoad.Clients.Ads.Google.Bytes.PercentAllAdFrames.Network", 100, 1);
142 histogram_tester().ExpectUniqueSample(
143 "PageLoad.Clients.Ads.Google.Bytes."
144 "PercentPage.AllAdFrames.Network",
145 50, 1);
146
147 // Page byte counts
148 histogram_tester().ExpectUniqueSample(
149 "PageLoad.Clients.Ads.Google.Bytes.AllAdFrames.Total", 1, 1);
150 histogram_tester().ExpectUniqueSample(
151 "PageLoad.Clients.Ads.Google.Bytes.AllAdFrames.Network", 1, 1);
152 histogram_tester().ExpectUniqueSample(
153 "PageLoad.Clients.Ads.Google.Bytes.Total", 2, 1);
154 histogram_tester().ExpectUniqueSample(
155 "PageLoad.Clients.Ads.Google.Bytes.Network", 2, 1);
156 histogram_tester().ExpectUniqueSample(
157 "PageLoad.Clients.Ads.Google.Bytes.NonAdFrames.Total", 1, 1);
158 }
159
160 TEST_F(AdsPageLoadMetricsObserverTest, PageWithAdFrames) {
161 RenderFrameHost* main_frame = NavigateMainFrame(GURL("http://foo.com/"));
162 RenderFrameHost* non_ad_frame = CreateAndNavigateSubFrame(
163 GURL("https://foo.com/frame1"), "foo name", main_frame);
164
165 // Create 5 ad frames with the 5th nested inside the 4th. Verify that the
166 // nested ad frame doesn't get counted separately (but that its bytes are
167 // still counted). Also verify that the various ad signals (urls and names)
168 // are properly detected.
169 RenderFrameHost* ad_frame1 = CreateAndNavigateSubFrame(
170 GURL("http://foo.com/iframe1"), "google_ads_iframe_1", main_frame);
171 RenderFrameHost* ad_frame2 = CreateAndNavigateSubFrame(
172 GURL("https://bar.com/frame1"), "google_ads_frame_1", main_frame);
173 RenderFrameHost* ad_frame3 = CreateAndNavigateSubFrame(
174 GURL("http://tpc.googlesyndication.com/safeframe/"), "", main_frame);
175 RenderFrameHost* ad_frame4 = CreateAndNavigateSubFrame(
176 GURL("https://tpc.googlesyndication.com/safeframe/1"), "", main_frame);
177 RenderFrameHost* nested_ad_frame4 = CreateAndNavigateSubFrame(
178 GURL("https://tpc.googlesyndication.com/safeframe/2"), "", ad_frame4);
179
180 // Create an addditional ad frame without content, it shouldn't be counted
181 // in some percentage calculations.
182 CreateAndNavigateSubFrame(
183 GURL("https://tpc.googlesyndication.com/safeframe/3"), "", main_frame);
184
185 // 7 bytes total in page, 5 from ads. 4 total bytes from network, 3 of those
186 // are from ads.
187 LoadResource(main_frame, ResourceCached::NOT_CACHED, 1);
188 LoadResource(non_ad_frame, ResourceCached::CACHED, 1);
189 LoadResource(ad_frame1, ResourceCached::CACHED, 1);
190 LoadResource(ad_frame2, ResourceCached::NOT_CACHED, 1);
191 LoadResource(ad_frame3, ResourceCached::NOT_CACHED, 1);
192 LoadResource(ad_frame4, ResourceCached::NOT_CACHED, 1);
193 LoadResource(nested_ad_frame4, ResourceCached::CACHED, 1);
194
195 // Navigate again to trigger histograms.
196 RenavigateFrame(GURL("https://bar.com/"), main_frame);
197
198 // Individual Ad Frame Metrics
199 histogram_tester().ExpectBucketCount(
200 "PageLoad.Clients.Ads.Google.Bytes.PerAdFrame.Total", 1, 3);
201 histogram_tester().ExpectBucketCount(
202 "PageLoad.Clients.Ads.Google.Bytes.PerAdFrame.Total", 2, 1);
203 histogram_tester().ExpectBucketCount(
204 "PageLoad.Clients.Ads.Google.Bytes.PerAdFrame.Network", 1, 3);
205 histogram_tester().ExpectBucketCount(
206 "PageLoad.Clients.Ads.Google.Bytes.PerAdFrame.Network", 0, 2);
207 histogram_tester().ExpectBucketCount(
208 "PageLoad.Clients.Ads.Google.Bytes.PercentAdFrame.Network", 0, 1);
209 histogram_tester().ExpectBucketCount(
210 "PageLoad.Clients.Ads.Google.Bytes.PercentAdFrame.Network", 100, 2);
211 histogram_tester().ExpectBucketCount(
212 "PageLoad.Clients.Ads.Google.Bytes.PercentAdFrame.Network", 50, 1);
213
214 // Counts
215 histogram_tester().ExpectUniqueSample(
216 "PageLoad.Clients.Ads.Google.AdFrameCount", 5, 1);
217 histogram_tester().ExpectUniqueSample(
218 "PageLoad.Clients.Ads.Google.SubFrameCount.TopLevel", 6, 1);
219 histogram_tester().ExpectUniqueSample(
220 "PageLoad.Clients.Ads.Google.AdFrameCount.TopLevel", 5, 1);
221 histogram_tester().ExpectUniqueSample(
222 "PageLoad.Clients.Ads.Google.PercentSubFramesAreAdFrames.TopLevel", 83,
223 1);
224
225 // Page percentages
226 histogram_tester().ExpectUniqueSample(
227 "PageLoad.Clients.Ads.Google.Bytes.PercentPage.AllAdFrames.Total", 71, 1);
228 histogram_tester().ExpectUniqueSample(
229 "PageLoad.Clients.Ads.Google.Bytes.PercentAllAdFrames.Network", 60, 1);
230 histogram_tester().ExpectUniqueSample(
231 "PageLoad.Clients.Ads.Google.Bytes."
232 "PercentPage.AllAdFrames.Network",
233 75, 1);
234
235 // Page byte counts
236 histogram_tester().ExpectUniqueSample(
237 "PageLoad.Clients.Ads.Google.Bytes.AllAdFrames.Total", 5, 1);
238 histogram_tester().ExpectUniqueSample(
239 "PageLoad.Clients.Ads.Google.Bytes.AllAdFrames.Network", 3, 1);
240 histogram_tester().ExpectUniqueSample(
241 "PageLoad.Clients.Ads.Google.Bytes.Total", 7, 1);
242 histogram_tester().ExpectUniqueSample(
243 "PageLoad.Clients.Ads.Google.Bytes.Network", 4, 1);
244 histogram_tester().ExpectUniqueSample(
245 "PageLoad.Clients.Ads.Google.Bytes.NonAdFrames.Total", 2, 1);
246 }
247
248 TEST_F(AdsPageLoadMetricsObserverTest, PageWithAdFrameThatRenavigates) {
249 RenderFrameHost* main_frame = NavigateMainFrame(GURL("http://foo.com/"));
250 RenderFrameHost* ad_frame = CreateAndNavigateSubFrame(
251 GURL("http://foo.com/iframe1"), "google_ads_iframe_1", main_frame);
252
253 LoadResource(main_frame, ResourceCached::NOT_CACHED, 1);
254 LoadResource(ad_frame, ResourceCached::NOT_CACHED, 1);
255
256 // Navigate the ad frame again.
257 ad_frame = RenavigateFrame(GURL("https://bar.com/iframe1"), ad_frame);
258
259 // In total, 3 bytes for entire page and 2 bytes in one ad frame.
260 LoadResource(ad_frame, ResourceCached::NOT_CACHED, 1);
261
262 // Navigate again to trigger histograms.
263 RenavigateFrame(GURL("https://bar.com/"), main_frame);
264
265 // Individual Ad Frame Metrics
266 histogram_tester().ExpectUniqueSample(
267 "PageLoad.Clients.Ads.Google.Bytes.PerAdFrame.Total", 2, 1);
268 histogram_tester().ExpectUniqueSample(
269 "PageLoad.Clients.Ads.Google.Bytes.PerAdFrame.Network", 2, 1);
270 histogram_tester().ExpectUniqueSample(
271 "PageLoad.Clients.Ads.Google.Bytes.PercentAdFrame.Network", 100, 1);
272
273 // Counts
274 histogram_tester().ExpectUniqueSample(
275 "PageLoad.Clients.Ads.Google.AdFrameCount", 1, 1);
276 histogram_tester().ExpectUniqueSample(
277 "PageLoad.Clients.Ads.Google.SubFrameCount.TopLevel", 1, 1);
278 histogram_tester().ExpectUniqueSample(
279 "PageLoad.Clients.Ads.Google.AdFrameCount.TopLevel", 1, 1);
280 histogram_tester().ExpectUniqueSample(
281 "PageLoad.Clients.Ads.Google.PercentSubFramesAreAdFrames.TopLevel", 100,
282 1);
283
284 // Page percentages
285 histogram_tester().ExpectUniqueSample(
286 "PageLoad.Clients.Ads.Google.Bytes.PercentPage.AllAdFrames.Total", 66, 1);
287 histogram_tester().ExpectUniqueSample(
288 "PageLoad.Clients.Ads.Google.Bytes.PercentAllAdFrames.Network", 100, 1);
289 histogram_tester().ExpectUniqueSample(
290 "PageLoad.Clients.Ads.Google.Bytes."
291 "PercentPage.AllAdFrames.Network",
292 66, 1);
293
294 // Page byte counts
295 histogram_tester().ExpectUniqueSample(
296 "PageLoad.Clients.Ads.Google.Bytes.AllAdFrames.Total", 2, 1);
297 histogram_tester().ExpectUniqueSample(
298 "PageLoad.Clients.Ads.Google.Bytes.AllAdFrames.Network", 2, 1);
299 histogram_tester().ExpectUniqueSample(
300 "PageLoad.Clients.Ads.Google.Bytes.Total", 3, 1);
301 histogram_tester().ExpectUniqueSample(
302 "PageLoad.Clients.Ads.Google.Bytes.Network", 3, 1);
303 histogram_tester().ExpectUniqueSample(
304 "PageLoad.Clients.Ads.Google.Bytes.NonAdFrames.Total", 1, 1);
305 }
306
307 TEST_F(AdsPageLoadMetricsObserverTest, PageWithNonAdFrameThatRenavigatesToAd) {
308 // Main frame.
309 RenderFrameHost* main_frame = NavigateMainFrame(GURL("http://foo.com/"));
310
311 // Sub frame that is not an ad.
312 RenderFrameHost* sub_frame = CreateAndNavigateSubFrame(
313 GURL("http://foo.com/iframe1"), "foo", main_frame);
314
315 // Child of the sub-frame that is an ad.
316 RenderFrameHost* sub_frame_child_ad = CreateAndNavigateSubFrame(
317 GURL("http://bar.com/iframe1"), "google_ads_iframe_1", sub_frame);
318
319 LoadResource(main_frame, ResourceCached::NOT_CACHED, 1);
320 LoadResource(sub_frame, ResourceCached::NOT_CACHED, 1);
321 LoadResource(sub_frame_child_ad, ResourceCached::NOT_CACHED, 1);
322
323 // Navigate the subframe again, this time it's an ad.
324 sub_frame = RenavigateFrame(
325 GURL("https://tpc.googlesyndication.com/safeframe/1"), sub_frame);
326
327 LoadResource(sub_frame, ResourceCached::NOT_CACHED, 1);
328
329 // In total, 4 bytes were loaded for the entire page and 2 bytes from ad
330 // frames (the original child ad frame and the renavigated frame which
331 // turned into an ad).
332
333 // Navigate again to trigger histograms.
334 RenavigateFrame(GURL("https://bar.com/"), main_frame);
335
336 // Individual Ad Frame Metrics
337 histogram_tester().ExpectUniqueSample(
338 "PageLoad.Clients.Ads.Google.Bytes.PerAdFrame.Total", 1, 2);
339 histogram_tester().ExpectUniqueSample(
340 "PageLoad.Clients.Ads.Google.Bytes.PerAdFrame.Network", 1, 2);
341 histogram_tester().ExpectUniqueSample(
342 "PageLoad.Clients.Ads.Google.Bytes.PercentAdFrame.Network", 100, 2);
343
344 // Counts
345 histogram_tester().ExpectUniqueSample(
346 "PageLoad.Clients.Ads.Google.AdFrameCount", 2, 1);
347 histogram_tester().ExpectUniqueSample(
348 "PageLoad.Clients.Ads.Google.SubFrameCount.TopLevel", 1, 1);
349 histogram_tester().ExpectUniqueSample(
350 "PageLoad.Clients.Ads.Google.AdFrameCount.TopLevel", 1, 1);
351 histogram_tester().ExpectUniqueSample(
352 "PageLoad.Clients.Ads.Google.PercentSubFramesAreAdFrames.TopLevel", 100,
353 1);
354
355 // Page percentages
356 histogram_tester().ExpectUniqueSample(
357 "PageLoad.Clients.Ads.Google.Bytes.PercentPage.AllAdFrames.Total", 50, 1);
358 histogram_tester().ExpectUniqueSample(
359 "PageLoad.Clients.Ads.Google.Bytes.PercentAllAdFrames.Network", 100, 1);
360 histogram_tester().ExpectUniqueSample(
361 "PageLoad.Clients.Ads.Google.Bytes."
362 "PercentPage.AllAdFrames.Network",
363 50, 1);
364
365 // Page byte counts
366 histogram_tester().ExpectUniqueSample(
367 "PageLoad.Clients.Ads.Google.Bytes.AllAdFrames.Total", 2, 1);
368 histogram_tester().ExpectUniqueSample(
369 "PageLoad.Clients.Ads.Google.Bytes.AllAdFrames.Network", 2, 1);
370 histogram_tester().ExpectUniqueSample(
371 "PageLoad.Clients.Ads.Google.Bytes.Total", 4, 1);
372 histogram_tester().ExpectUniqueSample(
373 "PageLoad.Clients.Ads.Google.Bytes.Network", 4, 1);
374 histogram_tester().ExpectUniqueSample(
375 "PageLoad.Clients.Ads.Google.Bytes.NonAdFrames.Total", 2, 1);
376 }
377
378 TEST_F(AdsPageLoadMetricsObserverTest, TwoResourceLoadsBeforeCommit) {
379 // Main frame.
380 RenderFrameHost* main_frame = NavigateMainFrame(GURL("http://foo.com/"));
381 LoadResource(main_frame, ResourceCached::NOT_CACHED, 1);
382
383 // Now open a subframe and have its resource load before notification of
384 // navigation finishing.
385 page_load_metrics::ExtraRequestInfo request(
386 GURL("http://foo.com/bar"), main_frame->GetFrameTreeNodeId() + 1,
387 false /* cached */, 1024 /* size */,
388 false /* data_reduction_proxy_used */,
389 0 /* original_network_content_length */);
390 SimulateLoadedResource(request);
391 RenderFrameHost* subframe_ad = RenderFrameHostTester::For(main_frame)
392 ->AppendChild("google_ads_iframe_1");
393 auto navigation_simulator = NavigationSimulator::CreateRendererInitiated(
394 GURL("http://bar.com/iframe1"), subframe_ad);
395
396 // The sub-frame renavigates before it commits.
397 navigation_simulator->Start();
398 navigation_simulator->Fail(net::ERR_ABORTED);
399
400 // Renavigate the subframe to a successful commit. But again, the resource
401 // loads before the observer sees the finished navigation.
402 SimulateLoadedResource(request);
403 RenavigateFrame(GURL("http://bar.com/iframe2"), subframe_ad);
404
405 // Navigate again to trigger histograms.
406 RenavigateFrame(GURL("https://bar.com/"), main_frame);
407
408 // 3 bytes in total were loaded. One for the main page, one for an aborted
409 // ad subframe, and one for a successful ad subframe. The aborted ad
410 // subframe's bytes don't count.
411
412 // Individual Ad Frame Metrics
413 histogram_tester().ExpectUniqueSample(
414 "PageLoad.Clients.Ads.Google.Bytes.PerAdFrame.Total", 1, 1);
415 histogram_tester().ExpectUniqueSample(
416 "PageLoad.Clients.Ads.Google.Bytes.PerAdFrame.Network", 1, 1);
417 histogram_tester().ExpectUniqueSample(
418 "PageLoad.Clients.Ads.Google.Bytes.PercentAdFrame.Network", 100, 1);
419
420 // Counts
421 histogram_tester().ExpectUniqueSample(
422 "PageLoad.Clients.Ads.Google.AdFrameCount", 1, 1);
423 histogram_tester().ExpectUniqueSample(
424 "PageLoad.Clients.Ads.Google.SubFrameCount.TopLevel", 1, 1);
425 histogram_tester().ExpectUniqueSample(
426 "PageLoad.Clients.Ads.Google.AdFrameCount.TopLevel", 1, 1);
427 histogram_tester().ExpectUniqueSample(
428 "PageLoad.Clients.Ads.Google.PercentSubFramesAreAdFrames.TopLevel", 100,
429 1);
430
431 // Page percentages
432 histogram_tester().ExpectUniqueSample(
433 "PageLoad.Clients.Ads.Google.Bytes.PercentPage.AllAdFrames.Total", 50, 1);
434 histogram_tester().ExpectUniqueSample(
435 "PageLoad.Clients.Ads.Google.Bytes.PercentAllAdFrames.Network", 100, 1);
436 histogram_tester().ExpectUniqueSample(
437 "PageLoad.Clients.Ads.Google.Bytes."
438 "PercentPage.AllAdFrames.Network",
439 50, 1);
440
441 // Page byte counts
442 histogram_tester().ExpectUniqueSample(
443 "PageLoad.Clients.Ads.Google.Bytes.AllAdFrames.Total", 1, 1);
444 histogram_tester().ExpectUniqueSample(
445 "PageLoad.Clients.Ads.Google.Bytes.AllAdFrames.Network", 1, 1);
446 histogram_tester().ExpectUniqueSample(
447 "PageLoad.Clients.Ads.Google.Bytes.Total", 2, 1);
448 histogram_tester().ExpectUniqueSample(
449 "PageLoad.Clients.Ads.Google.Bytes.Network", 2, 1);
450 histogram_tester().ExpectUniqueSample(
451 "PageLoad.Clients.Ads.Google.Bytes.NonAdFrames.Total", 1, 1);
452 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698