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

Side by Side Diff: chrome/browser/page_load_metrics/observers/resource_tracking_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 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/resource_tracking_page_load _metrics_observer.h" 5 #include "chrome/browser/page_load_metrics/observers/resource_tracking_page_load _metrics_observer.h"
6 6
7 #include "chrome/browser/page_load_metrics/observers/page_load_metrics_observer_ test_harness.h" 7 #include "chrome/browser/page_load_metrics/observers/page_load_metrics_observer_ test_harness.h"
8 8
9 namespace { 9 namespace {
10 const char kFakeUrl[] = "http://www.google.com/nothingotseehere.html"; 10 const char kFakeUrl[] = "http://www.google.com/nothingotseehere.html";
(...skipping 27 matching lines...) Expand all
38 }; 38 };
39 39
40 TEST_F(ResourceTrackingPageLoadMetricsObserverTest, StartAndFinish) { 40 TEST_F(ResourceTrackingPageLoadMetricsObserverTest, StartAndFinish) {
41 page_load_metrics::ExtraRequestStartInfo start_info_1{ 41 page_load_metrics::ExtraRequestStartInfo start_info_1{
42 content::ResourceType::RESOURCE_TYPE_IMAGE}; 42 content::ResourceType::RESOURCE_TYPE_IMAGE};
43 43
44 page_load_metrics::ExtraRequestStartInfo start_info_2{ 44 page_load_metrics::ExtraRequestStartInfo start_info_2{
45 content::ResourceType::RESOURCE_TYPE_IMAGE}; 45 content::ResourceType::RESOURCE_TYPE_IMAGE};
46 46
47 page_load_metrics::ExtraRequestCompleteInfo done_info{ 47 page_load_metrics::ExtraRequestCompleteInfo done_info{
48 GURL(), 48 false /*was_cached*/, 1024 * 40 /* raw_body_bytes */,
49 -1 /*frame_tree_node_id*/,
50 false /*was_cached*/,
51 1024 * 40 /* raw_body_bytes */,
52 1024 * 40 /* original_network_content_length */, 49 1024 * 40 /* original_network_content_length */,
53 nullptr /* data reduction_proxy */, 50 nullptr /* data reduction_proxy */,
54 content::ResourceType::RESOURCE_TYPE_IMAGE, 51 content::ResourceType::RESOURCE_TYPE_IMAGE};
55 };
56 52
57 // Start the navigation. This will create the page load tracker and register 53 // Start the navigation. This will create the page load tracker and register
58 // the observers. 54 // the observers.
59 NavigateAndCommit(GURL(kFakeUrl)); 55 NavigateAndCommit(GURL(kFakeUrl));
60 56
61 // Simulate starting two images, and completing one. 57 // Simulate starting two images, and completing one.
62 SimulateStartedResource(start_info_1); 58 SimulateStartedResource(start_info_1);
63 SimulateStartedResource(start_info_2); 59 SimulateStartedResource(start_info_2);
64 SimulateLoadedResource(done_info); 60 SimulateLoadedResource(done_info);
65 61
66 int64_t started = -1; 62 int64_t started = -1;
67 int64_t completed = -1; 63 int64_t completed = -1;
68 EXPECT_NE(nullptr, observer()); 64 EXPECT_NE(nullptr, observer());
69 observer()->GetCountsForTypeForTesting( 65 observer()->GetCountsForTypeForTesting(
70 content::ResourceType::RESOURCE_TYPE_IMAGE, &started, &completed); 66 content::ResourceType::RESOURCE_TYPE_IMAGE, &started, &completed);
71 EXPECT_EQ(2, started); 67 EXPECT_EQ(2, started);
72 EXPECT_EQ(1, completed); 68 EXPECT_EQ(1, completed);
73 } 69 }
74 70
75 } // namespace page_load_metrics 71 } // namespace page_load_metrics
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698