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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/page_load_metrics/observers/ads_page_load_metrics_observer_unittest.cc
diff --git a/chrome/browser/page_load_metrics/observers/ads_page_load_metrics_observer_unittest.cc b/chrome/browser/page_load_metrics/observers/ads_page_load_metrics_observer_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..f1c8c2225797a963e720e67dfe8f93bf7b6509ad
--- /dev/null
+++ b/chrome/browser/page_load_metrics/observers/ads_page_load_metrics_observer_unittest.cc
@@ -0,0 +1,452 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/page_load_metrics/observers/ads_page_load_metrics_observer.h"
+
+#include <string>
+
+#include "base/macros.h"
+#include "chrome/browser/page_load_metrics/observers/page_load_metrics_observer_test_harness.h"
+#include "chrome/browser/page_load_metrics/page_load_tracker.h"
+#include "content/public/browser/render_frame_host.h"
+#include "content/public/test/navigation_simulator.h"
+#include "content/public/test/test_renderer_host.h"
+#include "url/gurl.h"
+
+using content::RenderFrameHost;
+using content::RenderFrameHostTester;
+using content::NavigationSimulator;
+
+namespace {
+
+enum class ResourceCached { NOT_CACHED, CACHED };
+
+} // namespace
+
+class AdsPageLoadMetricsObserverTest
+ : public page_load_metrics::PageLoadMetricsObserverTestHarness {
+ public:
+ AdsPageLoadMetricsObserverTest() {}
+
+ 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.
+ 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.
+ auto navigation_simulator =
+ NavigationSimulator::CreateRendererInitiated(url, main_frame);
+ navigation_simulator->Commit();
+ return navigation_simulator->GetFinalRenderFrameHost();
+ }
+
+ 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.
+ content::RenderFrameHost* frame) {
+ auto navigation_simulator =
+ NavigationSimulator::CreateRendererInitiated(url, frame);
+ navigation_simulator->Commit();
+ return navigation_simulator->GetFinalRenderFrameHost();
+ }
+
+ RenderFrameHost* CreateAndNavigateSubFrame(const GURL& url,
+ 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
+ content::RenderFrameHost* parent) {
+ RenderFrameHost* subframe =
+ RenderFrameHostTester::For(parent)->AppendChild(frame_name);
+ auto navigation_simulator =
+ NavigationSimulator::CreateRendererInitiated(url, subframe);
+ navigation_simulator->Commit();
+ return navigation_simulator->GetFinalRenderFrameHost();
+ }
+
+ void LoadResource(RenderFrameHost* frame,
+ ResourceCached resource_cached,
+ int resource_size_in_kb) {
+ 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.
+ GURL("http://foo.com/bar"), frame->GetFrameTreeNodeId(),
+ resource_cached == ResourceCached::CACHED, resource_size_in_kb * 1024,
+ false /* data_reduction_proxy_used */,
+ 0 /* original_network_content_length */);
+ SimulateLoadedResource(request);
+ }
+
+ protected:
+ void RegisterObservers(page_load_metrics::PageLoadTracker* tracker) override {
+ tracker->AddObserver(base::MakeUnique<AdsPageLoadMetricsObserver>());
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(AdsPageLoadMetricsObserverTest);
+};
+
+TEST_F(AdsPageLoadMetricsObserverTest, PageWithNoAds) {
+ RenderFrameHost* main_frame = NavigateMainFrame(GURL("https://foo.com/"));
+ RenderFrameHost* frame1 = CreateAndNavigateSubFrame(
+ GURL("https://bar.com/frame1"), "foo name", main_frame);
+ RenderFrameHost* frame2 =
+ CreateAndNavigateSubFrame(GURL("https://bar.com/frame2"), "", main_frame);
+ LoadResource(main_frame, ResourceCached::NOT_CACHED, 1);
+ LoadResource(frame1, ResourceCached::NOT_CACHED, 1);
+ LoadResource(frame2, ResourceCached::NOT_CACHED, 1);
+
+ // Navigate again to trigger histograms.
+ RenavigateFrame(GURL("https://bar.com/"), main_frame);
+
+ histogram_tester().ExpectUniqueSample(
+ "PageLoad.Clients.Ads.Google.AdFrameCount", 0, 1);
+ histogram_tester().ExpectTotalCount(
+ "PageLoad.Clients.Ads.Google.Bytes.AllAdFrames.Total", 0);
+}
+
+TEST_F(AdsPageLoadMetricsObserverTest, ResourceBeforeAdFrameCommits) {
+ RenderFrameHost* main_frame = NavigateMainFrame(GURL("https://foo.com/"));
+
+ 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.
+
+ // Assume that the next frame's id will be the main frame + 1 and load a
+ // resource for that frame. Make sure it gets counted.
+ page_load_metrics::ExtraRequestInfo request(
+ GURL("http://foo.com/bar"), main_frame->GetFrameTreeNodeId() + 1,
+ false /* cached */, 1024 /* size */,
+ false /* data_reduction_proxy_used */,
+ 0 /* original_network_content_length */);
+ SimulateLoadedResource(request);
+
+ CreateAndNavigateSubFrame(GURL("https://foo.com/frame2"),
+ "google_ads_iframe_1", main_frame);
+
+ // Navigate again to trigger histograms.
+ RenavigateFrame(GURL("https://bar.com/"), main_frame);
+
+ // 2KB total were loaded from network, one of which was in an ad frame.
+ histogram_tester().ExpectUniqueSample(
+ "PageLoad.Clients.Ads.Google.AdFrameCount", 1, 1);
+ histogram_tester().ExpectUniqueSample(
+ "PageLoad.Clients.Ads.Google.SubFrameCount.TopLevel", 1, 1);
+ histogram_tester().ExpectUniqueSample(
+ "PageLoad.Clients.Ads.Google.AdFrameCount.TopLevel", 1, 1);
+ histogram_tester().ExpectUniqueSample(
+ "PageLoad.Clients.Ads.Google.PercentSubFramesAreAdFrames.TopLevel", 100,
+ 1);
+
+ // Individual Ad Frame Metrics
+ histogram_tester().ExpectUniqueSample(
+ "PageLoad.Clients.Ads.Google.Bytes.PerAdFrame.Total", 1, 1);
+ histogram_tester().ExpectUniqueSample(
+ "PageLoad.Clients.Ads.Google.Bytes.PerAdFrame.Network", 1, 1);
+ histogram_tester().ExpectUniqueSample(
+ "PageLoad.Clients.Ads.Google.Bytes.PercentAdFrame.Network", 100, 1);
+
+ // Page percentages
+ histogram_tester().ExpectUniqueSample(
+ "PageLoad.Clients.Ads.Google.Bytes.PercentPage.AllAdFrames.Total", 50, 1);
+ histogram_tester().ExpectUniqueSample(
+ "PageLoad.Clients.Ads.Google.Bytes.PercentAllAdFrames.Network", 100, 1);
+ histogram_tester().ExpectUniqueSample(
+ "PageLoad.Clients.Ads.Google.Bytes."
+ "PercentPage.AllAdFrames.Network",
+ 50, 1);
+
+ // Page byte counts
+ histogram_tester().ExpectUniqueSample(
+ "PageLoad.Clients.Ads.Google.Bytes.AllAdFrames.Total", 1, 1);
+ histogram_tester().ExpectUniqueSample(
+ "PageLoad.Clients.Ads.Google.Bytes.AllAdFrames.Network", 1, 1);
+ histogram_tester().ExpectUniqueSample(
+ "PageLoad.Clients.Ads.Google.Bytes.Total", 2, 1);
+ histogram_tester().ExpectUniqueSample(
+ "PageLoad.Clients.Ads.Google.Bytes.Network", 2, 1);
+ histogram_tester().ExpectUniqueSample(
+ "PageLoad.Clients.Ads.Google.Bytes.NonAdFrames.Total", 1, 1);
+}
+
+TEST_F(AdsPageLoadMetricsObserverTest, PageWithAdFrames) {
+ RenderFrameHost* main_frame = NavigateMainFrame(GURL("http://foo.com/"));
+ RenderFrameHost* non_ad_frame = CreateAndNavigateSubFrame(
+ GURL("https://foo.com/frame1"), "foo name", main_frame);
+
+ // Create 5 ad frames with the 5th nested inside the 4th. Verify that the
+ // nested ad frame doesn't get counted separately (but that its bytes are
+ // still counted). Also verify that the various ad signals (urls and names)
+ // are properly detected.
+ RenderFrameHost* ad_frame1 = CreateAndNavigateSubFrame(
+ GURL("http://foo.com/iframe1"), "google_ads_iframe_1", main_frame);
+ RenderFrameHost* ad_frame2 = CreateAndNavigateSubFrame(
+ GURL("https://bar.com/frame1"), "google_ads_frame_1", main_frame);
+ RenderFrameHost* ad_frame3 = CreateAndNavigateSubFrame(
+ GURL("http://tpc.googlesyndication.com/safeframe/"), "", main_frame);
+ RenderFrameHost* ad_frame4 = CreateAndNavigateSubFrame(
+ GURL("https://tpc.googlesyndication.com/safeframe/1"), "", main_frame);
+ RenderFrameHost* nested_ad_frame4 = CreateAndNavigateSubFrame(
+ GURL("https://tpc.googlesyndication.com/safeframe/2"), "", ad_frame4);
+
+ // Create an addditional ad frame without content, it shouldn't be counted
+ // in some percentage calculations.
+ CreateAndNavigateSubFrame(
+ GURL("https://tpc.googlesyndication.com/safeframe/3"), "", main_frame);
+
+ // 7 bytes total in page, 5 from ads. 4 total bytes from network, 3 of those
+ // are from ads.
+ LoadResource(main_frame, ResourceCached::NOT_CACHED, 1);
+ LoadResource(non_ad_frame, ResourceCached::CACHED, 1);
+ LoadResource(ad_frame1, ResourceCached::CACHED, 1);
+ LoadResource(ad_frame2, ResourceCached::NOT_CACHED, 1);
+ LoadResource(ad_frame3, ResourceCached::NOT_CACHED, 1);
+ LoadResource(ad_frame4, ResourceCached::NOT_CACHED, 1);
+ LoadResource(nested_ad_frame4, ResourceCached::CACHED, 1);
+
+ // Navigate again to trigger histograms.
+ RenavigateFrame(GURL("https://bar.com/"), main_frame);
+
+ // Individual Ad Frame Metrics
+ histogram_tester().ExpectBucketCount(
+ "PageLoad.Clients.Ads.Google.Bytes.PerAdFrame.Total", 1, 3);
+ histogram_tester().ExpectBucketCount(
+ "PageLoad.Clients.Ads.Google.Bytes.PerAdFrame.Total", 2, 1);
+ histogram_tester().ExpectBucketCount(
+ "PageLoad.Clients.Ads.Google.Bytes.PerAdFrame.Network", 1, 3);
+ histogram_tester().ExpectBucketCount(
+ "PageLoad.Clients.Ads.Google.Bytes.PerAdFrame.Network", 0, 2);
+ histogram_tester().ExpectBucketCount(
+ "PageLoad.Clients.Ads.Google.Bytes.PercentAdFrame.Network", 0, 1);
+ histogram_tester().ExpectBucketCount(
+ "PageLoad.Clients.Ads.Google.Bytes.PercentAdFrame.Network", 100, 2);
+ histogram_tester().ExpectBucketCount(
+ "PageLoad.Clients.Ads.Google.Bytes.PercentAdFrame.Network", 50, 1);
+
+ // Counts
+ histogram_tester().ExpectUniqueSample(
+ "PageLoad.Clients.Ads.Google.AdFrameCount", 5, 1);
+ histogram_tester().ExpectUniqueSample(
+ "PageLoad.Clients.Ads.Google.SubFrameCount.TopLevel", 6, 1);
+ histogram_tester().ExpectUniqueSample(
+ "PageLoad.Clients.Ads.Google.AdFrameCount.TopLevel", 5, 1);
+ histogram_tester().ExpectUniqueSample(
+ "PageLoad.Clients.Ads.Google.PercentSubFramesAreAdFrames.TopLevel", 83,
+ 1);
+
+ // Page percentages
+ histogram_tester().ExpectUniqueSample(
+ "PageLoad.Clients.Ads.Google.Bytes.PercentPage.AllAdFrames.Total", 71, 1);
+ histogram_tester().ExpectUniqueSample(
+ "PageLoad.Clients.Ads.Google.Bytes.PercentAllAdFrames.Network", 60, 1);
+ histogram_tester().ExpectUniqueSample(
+ "PageLoad.Clients.Ads.Google.Bytes."
+ "PercentPage.AllAdFrames.Network",
+ 75, 1);
+
+ // Page byte counts
+ histogram_tester().ExpectUniqueSample(
+ "PageLoad.Clients.Ads.Google.Bytes.AllAdFrames.Total", 5, 1);
+ histogram_tester().ExpectUniqueSample(
+ "PageLoad.Clients.Ads.Google.Bytes.AllAdFrames.Network", 3, 1);
+ histogram_tester().ExpectUniqueSample(
+ "PageLoad.Clients.Ads.Google.Bytes.Total", 7, 1);
+ histogram_tester().ExpectUniqueSample(
+ "PageLoad.Clients.Ads.Google.Bytes.Network", 4, 1);
+ histogram_tester().ExpectUniqueSample(
+ "PageLoad.Clients.Ads.Google.Bytes.NonAdFrames.Total", 2, 1);
+}
+
+TEST_F(AdsPageLoadMetricsObserverTest, PageWithAdFrameThatRenavigates) {
+ RenderFrameHost* main_frame = NavigateMainFrame(GURL("http://foo.com/"));
+ RenderFrameHost* ad_frame = CreateAndNavigateSubFrame(
+ GURL("http://foo.com/iframe1"), "google_ads_iframe_1", main_frame);
+
+ LoadResource(main_frame, ResourceCached::NOT_CACHED, 1);
+ LoadResource(ad_frame, ResourceCached::NOT_CACHED, 1);
+
+ // Navigate the ad frame again.
+ ad_frame = RenavigateFrame(GURL("https://bar.com/iframe1"), ad_frame);
+
+ // In total, 3 bytes for entire page and 2 bytes in one ad frame.
+ LoadResource(ad_frame, ResourceCached::NOT_CACHED, 1);
+
+ // Navigate again to trigger histograms.
+ RenavigateFrame(GURL("https://bar.com/"), main_frame);
+
+ // Individual Ad Frame Metrics
+ histogram_tester().ExpectUniqueSample(
+ "PageLoad.Clients.Ads.Google.Bytes.PerAdFrame.Total", 2, 1);
+ histogram_tester().ExpectUniqueSample(
+ "PageLoad.Clients.Ads.Google.Bytes.PerAdFrame.Network", 2, 1);
+ histogram_tester().ExpectUniqueSample(
+ "PageLoad.Clients.Ads.Google.Bytes.PercentAdFrame.Network", 100, 1);
+
+ // Counts
+ histogram_tester().ExpectUniqueSample(
+ "PageLoad.Clients.Ads.Google.AdFrameCount", 1, 1);
+ histogram_tester().ExpectUniqueSample(
+ "PageLoad.Clients.Ads.Google.SubFrameCount.TopLevel", 1, 1);
+ histogram_tester().ExpectUniqueSample(
+ "PageLoad.Clients.Ads.Google.AdFrameCount.TopLevel", 1, 1);
+ histogram_tester().ExpectUniqueSample(
+ "PageLoad.Clients.Ads.Google.PercentSubFramesAreAdFrames.TopLevel", 100,
+ 1);
+
+ // Page percentages
+ histogram_tester().ExpectUniqueSample(
+ "PageLoad.Clients.Ads.Google.Bytes.PercentPage.AllAdFrames.Total", 66, 1);
+ histogram_tester().ExpectUniqueSample(
+ "PageLoad.Clients.Ads.Google.Bytes.PercentAllAdFrames.Network", 100, 1);
+ histogram_tester().ExpectUniqueSample(
+ "PageLoad.Clients.Ads.Google.Bytes."
+ "PercentPage.AllAdFrames.Network",
+ 66, 1);
+
+ // Page byte counts
+ histogram_tester().ExpectUniqueSample(
+ "PageLoad.Clients.Ads.Google.Bytes.AllAdFrames.Total", 2, 1);
+ histogram_tester().ExpectUniqueSample(
+ "PageLoad.Clients.Ads.Google.Bytes.AllAdFrames.Network", 2, 1);
+ histogram_tester().ExpectUniqueSample(
+ "PageLoad.Clients.Ads.Google.Bytes.Total", 3, 1);
+ histogram_tester().ExpectUniqueSample(
+ "PageLoad.Clients.Ads.Google.Bytes.Network", 3, 1);
+ histogram_tester().ExpectUniqueSample(
+ "PageLoad.Clients.Ads.Google.Bytes.NonAdFrames.Total", 1, 1);
+}
+
+TEST_F(AdsPageLoadMetricsObserverTest, PageWithNonAdFrameThatRenavigatesToAd) {
+ // Main frame.
+ RenderFrameHost* main_frame = NavigateMainFrame(GURL("http://foo.com/"));
+
+ // Sub frame that is not an ad.
+ RenderFrameHost* sub_frame = CreateAndNavigateSubFrame(
+ GURL("http://foo.com/iframe1"), "foo", main_frame);
+
+ // Child of the sub-frame that is an ad.
+ RenderFrameHost* sub_frame_child_ad = CreateAndNavigateSubFrame(
+ GURL("http://bar.com/iframe1"), "google_ads_iframe_1", sub_frame);
+
+ LoadResource(main_frame, ResourceCached::NOT_CACHED, 1);
+ LoadResource(sub_frame, ResourceCached::NOT_CACHED, 1);
+ LoadResource(sub_frame_child_ad, ResourceCached::NOT_CACHED, 1);
+
+ // Navigate the subframe again, this time it's an ad.
+ sub_frame = RenavigateFrame(
+ GURL("https://tpc.googlesyndication.com/safeframe/1"), sub_frame);
+
+ LoadResource(sub_frame, ResourceCached::NOT_CACHED, 1);
+
+ // In total, 4 bytes were loaded for the entire page and 2 bytes from ad
+ // frames (the original child ad frame and the renavigated frame which
+ // turned into an ad).
+
+ // Navigate again to trigger histograms.
+ RenavigateFrame(GURL("https://bar.com/"), main_frame);
+
+ // Individual Ad Frame Metrics
+ histogram_tester().ExpectUniqueSample(
+ "PageLoad.Clients.Ads.Google.Bytes.PerAdFrame.Total", 1, 2);
+ histogram_tester().ExpectUniqueSample(
+ "PageLoad.Clients.Ads.Google.Bytes.PerAdFrame.Network", 1, 2);
+ histogram_tester().ExpectUniqueSample(
+ "PageLoad.Clients.Ads.Google.Bytes.PercentAdFrame.Network", 100, 2);
+
+ // Counts
+ histogram_tester().ExpectUniqueSample(
+ "PageLoad.Clients.Ads.Google.AdFrameCount", 2, 1);
+ histogram_tester().ExpectUniqueSample(
+ "PageLoad.Clients.Ads.Google.SubFrameCount.TopLevel", 1, 1);
+ histogram_tester().ExpectUniqueSample(
+ "PageLoad.Clients.Ads.Google.AdFrameCount.TopLevel", 1, 1);
+ histogram_tester().ExpectUniqueSample(
+ "PageLoad.Clients.Ads.Google.PercentSubFramesAreAdFrames.TopLevel", 100,
+ 1);
+
+ // Page percentages
+ histogram_tester().ExpectUniqueSample(
+ "PageLoad.Clients.Ads.Google.Bytes.PercentPage.AllAdFrames.Total", 50, 1);
+ histogram_tester().ExpectUniqueSample(
+ "PageLoad.Clients.Ads.Google.Bytes.PercentAllAdFrames.Network", 100, 1);
+ histogram_tester().ExpectUniqueSample(
+ "PageLoad.Clients.Ads.Google.Bytes."
+ "PercentPage.AllAdFrames.Network",
+ 50, 1);
+
+ // Page byte counts
+ histogram_tester().ExpectUniqueSample(
+ "PageLoad.Clients.Ads.Google.Bytes.AllAdFrames.Total", 2, 1);
+ histogram_tester().ExpectUniqueSample(
+ "PageLoad.Clients.Ads.Google.Bytes.AllAdFrames.Network", 2, 1);
+ histogram_tester().ExpectUniqueSample(
+ "PageLoad.Clients.Ads.Google.Bytes.Total", 4, 1);
+ histogram_tester().ExpectUniqueSample(
+ "PageLoad.Clients.Ads.Google.Bytes.Network", 4, 1);
+ histogram_tester().ExpectUniqueSample(
+ "PageLoad.Clients.Ads.Google.Bytes.NonAdFrames.Total", 2, 1);
+}
+
+TEST_F(AdsPageLoadMetricsObserverTest, TwoResourceLoadsBeforeCommit) {
+ // Main frame.
+ RenderFrameHost* main_frame = NavigateMainFrame(GURL("http://foo.com/"));
+ LoadResource(main_frame, ResourceCached::NOT_CACHED, 1);
+
+ // Now open a subframe and have its resource load before notification of
+ // navigation finishing.
+ page_load_metrics::ExtraRequestInfo request(
+ GURL("http://foo.com/bar"), main_frame->GetFrameTreeNodeId() + 1,
+ false /* cached */, 1024 /* size */,
+ false /* data_reduction_proxy_used */,
+ 0 /* original_network_content_length */);
+ SimulateLoadedResource(request);
+ RenderFrameHost* subframe_ad = RenderFrameHostTester::For(main_frame)
+ ->AppendChild("google_ads_iframe_1");
+ auto navigation_simulator = NavigationSimulator::CreateRendererInitiated(
+ GURL("http://bar.com/iframe1"), subframe_ad);
+
+ // The sub-frame renavigates before it commits.
+ navigation_simulator->Start();
+ navigation_simulator->Fail(net::ERR_ABORTED);
+
+ // Renavigate the subframe to a successful commit. But again, the resource
+ // loads before the observer sees the finished navigation.
+ SimulateLoadedResource(request);
+ RenavigateFrame(GURL("http://bar.com/iframe2"), subframe_ad);
+
+ // Navigate again to trigger histograms.
+ RenavigateFrame(GURL("https://bar.com/"), main_frame);
+
+ // 3 bytes in total were loaded. One for the main page, one for an aborted
+ // ad subframe, and one for a successful ad subframe. The aborted ad
+ // subframe's bytes don't count.
+
+ // Individual Ad Frame Metrics
+ histogram_tester().ExpectUniqueSample(
+ "PageLoad.Clients.Ads.Google.Bytes.PerAdFrame.Total", 1, 1);
+ histogram_tester().ExpectUniqueSample(
+ "PageLoad.Clients.Ads.Google.Bytes.PerAdFrame.Network", 1, 1);
+ histogram_tester().ExpectUniqueSample(
+ "PageLoad.Clients.Ads.Google.Bytes.PercentAdFrame.Network", 100, 1);
+
+ // Counts
+ histogram_tester().ExpectUniqueSample(
+ "PageLoad.Clients.Ads.Google.AdFrameCount", 1, 1);
+ histogram_tester().ExpectUniqueSample(
+ "PageLoad.Clients.Ads.Google.SubFrameCount.TopLevel", 1, 1);
+ histogram_tester().ExpectUniqueSample(
+ "PageLoad.Clients.Ads.Google.AdFrameCount.TopLevel", 1, 1);
+ histogram_tester().ExpectUniqueSample(
+ "PageLoad.Clients.Ads.Google.PercentSubFramesAreAdFrames.TopLevel", 100,
+ 1);
+
+ // Page percentages
+ histogram_tester().ExpectUniqueSample(
+ "PageLoad.Clients.Ads.Google.Bytes.PercentPage.AllAdFrames.Total", 50, 1);
+ histogram_tester().ExpectUniqueSample(
+ "PageLoad.Clients.Ads.Google.Bytes.PercentAllAdFrames.Network", 100, 1);
+ histogram_tester().ExpectUniqueSample(
+ "PageLoad.Clients.Ads.Google.Bytes."
+ "PercentPage.AllAdFrames.Network",
+ 50, 1);
+
+ // Page byte counts
+ histogram_tester().ExpectUniqueSample(
+ "PageLoad.Clients.Ads.Google.Bytes.AllAdFrames.Total", 1, 1);
+ histogram_tester().ExpectUniqueSample(
+ "PageLoad.Clients.Ads.Google.Bytes.AllAdFrames.Network", 1, 1);
+ histogram_tester().ExpectUniqueSample(
+ "PageLoad.Clients.Ads.Google.Bytes.Total", 2, 1);
+ histogram_tester().ExpectUniqueSample(
+ "PageLoad.Clients.Ads.Google.Bytes.Network", 2, 1);
+ histogram_tester().ExpectUniqueSample(
+ "PageLoad.Clients.Ads.Google.Bytes.NonAdFrames.Total", 1, 1);
+}

Powered by Google App Engine
This is Rietveld 408576698