OLD | NEW |
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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 "components/page_load_metrics/browser/metrics_web_contents_observer.h" | 5 #include "components/page_load_metrics/browser/metrics_web_contents_observer.h" |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/process/kill.h" | 8 #include "base/process/kill.h" |
9 #include "base/test/histogram_tester.h" | 9 #include "base/test/histogram_tester.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 const char kDefaultTestUrlAnchor[] = "https://google.com#samepage"; | 22 const char kDefaultTestUrlAnchor[] = "https://google.com#samepage"; |
23 const char kDefaultTestUrl2[] = "https://whatever.com"; | 23 const char kDefaultTestUrl2[] = "https://whatever.com"; |
24 | 24 |
25 const char kHistogramNameFirstLayout[] = | 25 const char kHistogramNameFirstLayout[] = |
26 "PageLoad.Timing.NavigationToFirstLayout"; | 26 "PageLoad.Timing.NavigationToFirstLayout"; |
27 const char kHistogramNameDomContent[] = | 27 const char kHistogramNameDomContent[] = |
28 "PageLoad.Timing.NavigationToDOMContentLoadedEventFired"; | 28 "PageLoad.Timing.NavigationToDOMContentLoadedEventFired"; |
29 const char kHistogramNameLoad[] = | 29 const char kHistogramNameLoad[] = |
30 "PageLoad.Timing.NavigationToLoadEventFired"; | 30 "PageLoad.Timing.NavigationToLoadEventFired"; |
31 | 31 |
| 32 const char kBGHistogramNameFirstLayout[] = |
| 33 "PageLoad.Timing.NavigationToFirstLayout.BG"; |
| 34 const char kBGHistogramNameDomContent[] = |
| 35 "PageLoad.Timing.NavigationToDOMContentLoadedEventFired.BG"; |
| 36 const char kBGHistogramNameLoad[] = |
| 37 "PageLoad.Timing.NavigationToLoadEventFired.BG"; |
32 } // namespace | 38 } // namespace |
33 | 39 |
34 class MetricsWebContentsObserverTest | 40 class MetricsWebContentsObserverTest |
35 : public content::RenderViewHostTestHarness { | 41 : public content::RenderViewHostTestHarness { |
36 public: | 42 public: |
37 MetricsWebContentsObserverTest() {} | 43 MetricsWebContentsObserverTest() {} |
38 | 44 |
39 void SetUp() override { | 45 void SetUp() override { |
40 RenderViewHostTestHarness::SetUp(); | 46 RenderViewHostTestHarness::SetUp(); |
41 observer_ = make_scoped_ptr(new MetricsWebContentsObserver(web_contents())); | 47 observer_ = make_scoped_ptr(new MetricsWebContentsObserver(web_contents())); |
| 48 observer_->WasShown(); |
42 } | 49 } |
43 | 50 |
44 void AssertNoHistogramsLogged() { | 51 void AssertNoHistogramsLogged() { |
45 histogram_tester_.ExpectTotalCount(kHistogramNameDomContent, 0); | 52 histogram_tester_.ExpectTotalCount(kHistogramNameDomContent, 0); |
46 histogram_tester_.ExpectTotalCount(kHistogramNameLoad, 0); | 53 histogram_tester_.ExpectTotalCount(kHistogramNameLoad, 0); |
47 histogram_tester_.ExpectTotalCount(kHistogramNameFirstLayout, 0); | 54 histogram_tester_.ExpectTotalCount(kHistogramNameFirstLayout, 0); |
48 } | 55 } |
49 | 56 |
50 protected: | 57 protected: |
51 base::HistogramTester histogram_tester_; | 58 base::HistogramTester histogram_tester_; |
(...skipping 20 matching lines...) Expand all Loading... |
72 content::RenderFrameHost* subframe = rfh_tester->AppendChild("subframe"); | 79 content::RenderFrameHost* subframe = rfh_tester->AppendChild("subframe"); |
73 | 80 |
74 content::RenderFrameHostTester* subframe_tester = | 81 content::RenderFrameHostTester* subframe_tester = |
75 content::RenderFrameHostTester::For(subframe); | 82 content::RenderFrameHostTester::For(subframe); |
76 subframe_tester->SimulateNavigationStart(GURL(kDefaultTestUrl2)); | 83 subframe_tester->SimulateNavigationStart(GURL(kDefaultTestUrl2)); |
77 subframe_tester->SimulateNavigationCommit(GURL(kDefaultTestUrl2)); | 84 subframe_tester->SimulateNavigationCommit(GURL(kDefaultTestUrl2)); |
78 observer_->OnMessageReceived( | 85 observer_->OnMessageReceived( |
79 PageLoadMetricsMsg_TimingUpdated(observer_->routing_id(), timing), | 86 PageLoadMetricsMsg_TimingUpdated(observer_->routing_id(), timing), |
80 subframe); | 87 subframe); |
81 subframe_tester->SimulateNavigationStop(); | 88 subframe_tester->SimulateNavigationStop(); |
| 89 observer_->DidFinishLoad(web_contents()->GetMainFrame(), |
| 90 GURL(kDefaultTestUrl2)); |
82 | 91 |
83 // Navigate again to see if the timing updated for a subframe message. | 92 // Navigate again to see if the timing updated for a subframe message. |
84 web_contents_tester->NavigateAndCommit(GURL(kDefaultTestUrl)); | 93 web_contents_tester->NavigateAndCommit(GURL(kDefaultTestUrl)); |
85 | 94 |
86 AssertNoHistogramsLogged(); | 95 AssertNoHistogramsLogged(); |
87 } | 96 } |
88 | 97 |
89 TEST_F(MetricsWebContentsObserverTest, SamePageNoTrigger) { | 98 TEST_F(MetricsWebContentsObserverTest, SamePageNoTrigger) { |
90 base::TimeDelta first_layout = base::TimeDelta::FromMilliseconds(1); | 99 base::TimeDelta first_layout = base::TimeDelta::FromMilliseconds(1); |
91 | 100 |
92 PageLoadTiming timing; | 101 PageLoadTiming timing; |
93 timing.navigation_start = base::Time::FromDoubleT(1); | 102 timing.navigation_start = base::Time::FromDoubleT(1); |
94 timing.first_layout = first_layout; | 103 timing.first_layout = first_layout; |
95 | 104 |
96 content::WebContentsTester* web_contents_tester = | 105 content::WebContentsTester* web_contents_tester = |
97 content::WebContentsTester::For(web_contents()); | 106 content::WebContentsTester::For(web_contents()); |
98 web_contents_tester->NavigateAndCommit(GURL(kDefaultTestUrl)); | 107 web_contents_tester->NavigateAndCommit(GURL(kDefaultTestUrl)); |
99 | 108 |
100 observer_->OnMessageReceived( | 109 observer_->OnMessageReceived( |
101 PageLoadMetricsMsg_TimingUpdated(observer_->routing_id(), timing), | 110 PageLoadMetricsMsg_TimingUpdated(observer_->routing_id(), timing), |
102 web_contents()->GetMainFrame()); | 111 web_contents()->GetMainFrame()); |
| 112 observer_->DidFinishLoad(web_contents()->GetMainFrame(), |
| 113 GURL(kDefaultTestUrl)); |
103 web_contents_tester->NavigateAndCommit(GURL(kDefaultTestUrlAnchor)); | 114 web_contents_tester->NavigateAndCommit(GURL(kDefaultTestUrlAnchor)); |
104 // A same page navigation shouldn't trigger logging UMA for the original. | 115 // A same page navigation shouldn't trigger logging UMA for the original. |
105 AssertNoHistogramsLogged(); | 116 AssertNoHistogramsLogged(); |
106 } | 117 } |
107 | 118 |
108 TEST_F(MetricsWebContentsObserverTest, SamePageNoTriggerUntilTrueNavCommit) { | 119 TEST_F(MetricsWebContentsObserverTest, SamePageNoTriggerUntilTrueNavCommit) { |
109 base::TimeDelta first_layout = base::TimeDelta::FromMilliseconds(1); | 120 base::TimeDelta first_layout = base::TimeDelta::FromMilliseconds(1); |
110 | 121 |
111 PageLoadTiming timing; | 122 PageLoadTiming timing; |
112 timing.navigation_start = base::Time::FromDoubleT(1); | 123 timing.navigation_start = base::Time::FromDoubleT(1); |
113 timing.first_layout = first_layout; | 124 timing.first_layout = first_layout; |
114 | 125 |
115 content::WebContentsTester* web_contents_tester = | 126 content::WebContentsTester* web_contents_tester = |
116 content::WebContentsTester::For(web_contents()); | 127 content::WebContentsTester::For(web_contents()); |
117 web_contents_tester->NavigateAndCommit(GURL(kDefaultTestUrl)); | 128 web_contents_tester->NavigateAndCommit(GURL(kDefaultTestUrl)); |
118 | 129 |
119 observer_->OnMessageReceived( | 130 observer_->OnMessageReceived( |
120 PageLoadMetricsMsg_TimingUpdated(observer_->routing_id(), timing), | 131 PageLoadMetricsMsg_TimingUpdated(observer_->routing_id(), timing), |
121 web_contents()->GetMainFrame()); | 132 web_contents()->GetMainFrame()); |
| 133 observer_->DidFinishLoad(web_contents()->GetMainFrame(), |
| 134 GURL(kDefaultTestUrl)); |
122 web_contents_tester->NavigateAndCommit(GURL(kDefaultTestUrlAnchor)); | 135 web_contents_tester->NavigateAndCommit(GURL(kDefaultTestUrlAnchor)); |
| 136 observer_->DidFinishLoad(web_contents()->GetMainFrame(), |
| 137 GURL(kDefaultTestUrlAnchor)); |
123 // A same page navigation shouldn't trigger logging UMA for the original. | 138 // A same page navigation shouldn't trigger logging UMA for the original. |
124 AssertNoHistogramsLogged(); | 139 AssertNoHistogramsLogged(); |
125 | 140 |
126 // But we should keep the timing info and log it when we get another | 141 // But we should keep the timing info and log it when we get another |
127 // navigation. | 142 // navigation. |
128 web_contents_tester->NavigateAndCommit(GURL(kDefaultTestUrl2)); | 143 web_contents_tester->NavigateAndCommit(GURL(kDefaultTestUrl2)); |
129 histogram_tester_.ExpectTotalCount(kHistogramNameDomContent, 0); | 144 histogram_tester_.ExpectTotalCount(kHistogramNameDomContent, 0); |
130 histogram_tester_.ExpectTotalCount(kHistogramNameLoad, 0); | 145 histogram_tester_.ExpectTotalCount(kHistogramNameLoad, 0); |
131 histogram_tester_.ExpectTotalCount(kHistogramNameFirstLayout, 1); | 146 histogram_tester_.ExpectTotalCount(kHistogramNameFirstLayout, 1); |
132 histogram_tester_.ExpectBucketCount(kHistogramNameFirstLayout, | 147 histogram_tester_.ExpectBucketCount(kHistogramNameFirstLayout, |
133 first_layout.InMilliseconds(), 1); | 148 first_layout.InMilliseconds(), 1); |
134 } | 149 } |
135 | 150 |
136 TEST_F(MetricsWebContentsObserverTest, SingleMetricAfterCommit) { | 151 TEST_F(MetricsWebContentsObserverTest, SingleMetricAfterCommit) { |
137 base::TimeDelta first_layout = base::TimeDelta::FromMilliseconds(1); | 152 base::TimeDelta first_layout = base::TimeDelta::FromMilliseconds(1); |
138 | 153 |
139 PageLoadTiming timing; | 154 PageLoadTiming timing; |
140 timing.navigation_start = base::Time::FromDoubleT(1); | 155 timing.navigation_start = base::Time::FromDoubleT(1); |
141 timing.first_layout = first_layout; | 156 timing.first_layout = first_layout; |
142 | 157 |
143 content::WebContentsTester* web_contents_tester = | 158 content::WebContentsTester* web_contents_tester = |
144 content::WebContentsTester::For(web_contents()); | 159 content::WebContentsTester::For(web_contents()); |
145 web_contents_tester->NavigateAndCommit(GURL(kDefaultTestUrl)); | 160 web_contents_tester->NavigateAndCommit(GURL(kDefaultTestUrl)); |
146 | 161 |
147 observer_->OnMessageReceived( | 162 observer_->OnMessageReceived( |
148 PageLoadMetricsMsg_TimingUpdated(observer_->routing_id(), timing), | 163 PageLoadMetricsMsg_TimingUpdated(observer_->routing_id(), timing), |
149 web_contents()->GetMainFrame()); | 164 web_contents()->GetMainFrame()); |
| 165 observer_->DidFinishLoad(web_contents()->GetMainFrame(), |
| 166 GURL(kDefaultTestUrl)); |
150 | 167 |
151 AssertNoHistogramsLogged(); | 168 AssertNoHistogramsLogged(); |
152 | 169 |
153 // Navigate again to force histogram recording. | 170 // Navigate again to force histogram recording. |
154 web_contents_tester->NavigateAndCommit(GURL(kDefaultTestUrl2)); | 171 web_contents_tester->NavigateAndCommit(GURL(kDefaultTestUrl2)); |
155 | 172 |
156 histogram_tester_.ExpectTotalCount(kHistogramNameDomContent, 0); | 173 histogram_tester_.ExpectTotalCount(kHistogramNameDomContent, 0); |
157 histogram_tester_.ExpectTotalCount(kHistogramNameLoad, 0); | 174 histogram_tester_.ExpectTotalCount(kHistogramNameLoad, 0); |
158 histogram_tester_.ExpectTotalCount(kHistogramNameFirstLayout, 1); | 175 histogram_tester_.ExpectTotalCount(kHistogramNameFirstLayout, 1); |
159 histogram_tester_.ExpectBucketCount(kHistogramNameFirstLayout, | 176 histogram_tester_.ExpectBucketCount(kHistogramNameFirstLayout, |
(...skipping 14 matching lines...) Expand all Loading... |
174 timing.dom_content_loaded_event_start = dom_content; | 191 timing.dom_content_loaded_event_start = dom_content; |
175 timing.load_event_start = load; | 192 timing.load_event_start = load; |
176 | 193 |
177 content::WebContentsTester* web_contents_tester = | 194 content::WebContentsTester* web_contents_tester = |
178 content::WebContentsTester::For(web_contents()); | 195 content::WebContentsTester::For(web_contents()); |
179 web_contents_tester->NavigateAndCommit(GURL(kDefaultTestUrl)); | 196 web_contents_tester->NavigateAndCommit(GURL(kDefaultTestUrl)); |
180 | 197 |
181 observer_->OnMessageReceived( | 198 observer_->OnMessageReceived( |
182 PageLoadMetricsMsg_TimingUpdated(observer_->routing_id(), timing), | 199 PageLoadMetricsMsg_TimingUpdated(observer_->routing_id(), timing), |
183 web_contents()->GetMainFrame()); | 200 web_contents()->GetMainFrame()); |
| 201 observer_->DidFinishLoad(web_contents()->GetMainFrame(), |
| 202 GURL(kDefaultTestUrl)); |
184 | 203 |
185 web_contents_tester->NavigateAndCommit(GURL(kDefaultTestUrl2)); | 204 web_contents_tester->NavigateAndCommit(GURL(kDefaultTestUrl2)); |
186 | 205 |
187 PageLoadTiming timing2; | 206 PageLoadTiming timing2; |
188 timing2.navigation_start = base::Time::FromDoubleT(200); | 207 timing2.navigation_start = base::Time::FromDoubleT(200); |
189 timing2.first_layout = first_layout_2; | 208 timing2.first_layout = first_layout_2; |
190 | 209 |
191 observer_->OnMessageReceived( | 210 observer_->OnMessageReceived( |
192 PageLoadMetricsMsg_TimingUpdated(observer_->routing_id(), timing2), | 211 PageLoadMetricsMsg_TimingUpdated(observer_->routing_id(), timing2), |
193 web_contents()->GetMainFrame()); | 212 web_contents()->GetMainFrame()); |
| 213 observer_->DidFinishLoad(web_contents()->GetMainFrame(), |
| 214 GURL(kDefaultTestUrl2)); |
194 | 215 |
195 web_contents_tester->NavigateAndCommit(GURL(kDefaultTestUrl)); | 216 web_contents_tester->NavigateAndCommit(GURL(kDefaultTestUrl)); |
196 | 217 |
197 histogram_tester_.ExpectBucketCount(kHistogramNameFirstLayout, | 218 histogram_tester_.ExpectBucketCount(kHistogramNameFirstLayout, |
198 first_layout_1.InMilliseconds(), 1); | 219 first_layout_1.InMilliseconds(), 1); |
199 histogram_tester_.ExpectTotalCount(kHistogramNameFirstLayout, 2); | 220 histogram_tester_.ExpectTotalCount(kHistogramNameFirstLayout, 2); |
200 histogram_tester_.ExpectBucketCount(kHistogramNameFirstLayout, | 221 histogram_tester_.ExpectBucketCount(kHistogramNameFirstLayout, |
201 first_layout_1.InMilliseconds(), 1); | 222 first_layout_1.InMilliseconds(), 1); |
202 histogram_tester_.ExpectBucketCount(kHistogramNameFirstLayout, | 223 histogram_tester_.ExpectBucketCount(kHistogramNameFirstLayout, |
203 first_layout_2.InMilliseconds(), 1); | 224 first_layout_2.InMilliseconds(), 1); |
204 | 225 |
205 histogram_tester_.ExpectTotalCount(kHistogramNameDomContent, 1); | 226 histogram_tester_.ExpectTotalCount(kHistogramNameDomContent, 1); |
206 histogram_tester_.ExpectBucketCount(kHistogramNameDomContent, | 227 histogram_tester_.ExpectBucketCount(kHistogramNameDomContent, |
207 dom_content.InMilliseconds(), 1); | 228 dom_content.InMilliseconds(), 1); |
208 | 229 |
209 histogram_tester_.ExpectTotalCount(kHistogramNameLoad, 1); | 230 histogram_tester_.ExpectTotalCount(kHistogramNameLoad, 1); |
210 histogram_tester_.ExpectBucketCount(kHistogramNameLoad, load.InMilliseconds(), | 231 histogram_tester_.ExpectBucketCount(kHistogramNameLoad, load.InMilliseconds(), |
211 1); | 232 1); |
212 } | 233 } |
213 | 234 |
| 235 TEST_F(MetricsWebContentsObserverTest, BackgroundDifferentHistogram) { |
| 236 base::TimeDelta first_layout = base::TimeDelta::FromMilliseconds(1); |
| 237 |
| 238 PageLoadTiming timing; |
| 239 timing.navigation_start = base::Time::FromDoubleT(1); |
| 240 timing.first_layout = first_layout; |
| 241 |
| 242 content::WebContentsTester* web_contents_tester = |
| 243 content::WebContentsTester::For(web_contents()); |
| 244 |
| 245 // Simulate "Open link in new tab." |
| 246 observer_->WasHidden(); |
| 247 web_contents_tester->NavigateAndCommit(GURL(kDefaultTestUrl)); |
| 248 |
| 249 observer_->OnMessageReceived( |
| 250 PageLoadMetricsMsg_TimingUpdated(observer_->routing_id(), timing), |
| 251 web_contents()->GetMainFrame()); |
| 252 |
| 253 // Simulate switching to the tab and making another navigation. |
| 254 observer_->WasShown(); |
| 255 observer_->DidFinishLoad(web_contents()->GetMainFrame(), |
| 256 GURL(kDefaultTestUrl)); |
| 257 AssertNoHistogramsLogged(); |
| 258 |
| 259 // Navigate again to force histogram recording. |
| 260 web_contents_tester->NavigateAndCommit(GURL(kDefaultTestUrl2)); |
| 261 |
| 262 histogram_tester_.ExpectTotalCount(kBGHistogramNameDomContent, 0); |
| 263 histogram_tester_.ExpectTotalCount(kBGHistogramNameLoad, 0); |
| 264 histogram_tester_.ExpectTotalCount(kBGHistogramNameFirstLayout, 1); |
| 265 histogram_tester_.ExpectBucketCount(kBGHistogramNameFirstLayout, |
| 266 first_layout.InMilliseconds(), 1); |
| 267 |
| 268 histogram_tester_.ExpectTotalCount(kHistogramNameDomContent, 0); |
| 269 histogram_tester_.ExpectTotalCount(kHistogramNameLoad, 0); |
| 270 histogram_tester_.ExpectTotalCount(kHistogramNameFirstLayout, 0); |
| 271 } |
| 272 |
| 273 TEST_F(MetricsWebContentsObserverTest, OnlyBackgroundLaterEvents) { |
| 274 PageLoadTiming timing; |
| 275 timing.navigation_start = base::Time::FromDoubleT( |
| 276 (base::TimeTicks::Now() - base::TimeTicks::UnixEpoch()).InSecondsF() - 1); |
| 277 |
| 278 timing.response_start = base::TimeDelta::FromMilliseconds(10); |
| 279 timing.dom_content_loaded_event_start = base::TimeDelta::FromMilliseconds(50); |
| 280 |
| 281 content::WebContentsTester* web_contents_tester = |
| 282 content::WebContentsTester::For(web_contents()); |
| 283 |
| 284 web_contents_tester->NavigateAndCommit(GURL(kDefaultTestUrl)); |
| 285 observer_->OnMessageReceived( |
| 286 PageLoadMetricsMsg_TimingUpdated(observer_->routing_id(), timing), |
| 287 web_contents()->GetMainFrame()); |
| 288 |
| 289 // Background the tab, then forground it. |
| 290 observer_->WasHidden(); |
| 291 observer_->WasShown(); |
| 292 timing.first_layout = base::TimeDelta::FromMilliseconds(2000); |
| 293 observer_->OnMessageReceived( |
| 294 PageLoadMetricsMsg_TimingUpdated(observer_->routing_id(), timing), |
| 295 web_contents()->GetMainFrame()); |
| 296 |
| 297 // Navigate again to force histogram recording. |
| 298 web_contents_tester->NavigateAndCommit(GURL(kDefaultTestUrl2)); |
| 299 |
| 300 histogram_tester_.ExpectTotalCount(kBGHistogramNameDomContent, 0); |
| 301 histogram_tester_.ExpectTotalCount(kBGHistogramNameLoad, 0); |
| 302 histogram_tester_.ExpectTotalCount(kBGHistogramNameFirstLayout, 1); |
| 303 histogram_tester_.ExpectBucketCount(kBGHistogramNameFirstLayout, |
| 304 timing.first_layout.InMilliseconds(), 1); |
| 305 |
| 306 histogram_tester_.ExpectTotalCount(kHistogramNameDomContent, 1); |
| 307 histogram_tester_.ExpectBucketCount( |
| 308 kHistogramNameDomContent, |
| 309 timing.dom_content_loaded_event_start.InMilliseconds(), 1); |
| 310 histogram_tester_.ExpectTotalCount(kHistogramNameLoad, 0); |
| 311 histogram_tester_.ExpectTotalCount(kHistogramNameFirstLayout, 0); |
| 312 } |
| 313 |
| 314 TEST_F(MetricsWebContentsObserverTest, DontBackgroundQuickerLoad) { |
| 315 base::TimeDelta first_layout = base::TimeDelta::FromMilliseconds(1); |
| 316 |
| 317 PageLoadTiming timing; |
| 318 timing.navigation_start = base::Time::FromDoubleT(1); |
| 319 timing.first_layout = first_layout; |
| 320 |
| 321 observer_->WasHidden(); |
| 322 |
| 323 // Open in new tab |
| 324 content::WebContentsTester* web_contents_tester = |
| 325 content::WebContentsTester::For(web_contents()); |
| 326 |
| 327 web_contents_tester->StartNavigation(GURL(kDefaultTestUrl)); |
| 328 |
| 329 content::RenderFrameHostTester* rfh_tester = |
| 330 content::RenderFrameHostTester::For(main_rfh()); |
| 331 |
| 332 // Switch to the tab |
| 333 observer_->WasShown(); |
| 334 |
| 335 // Start another provisional load |
| 336 web_contents_tester->StartNavigation(GURL(kDefaultTestUrl2)); |
| 337 rfh_tester->SimulateNavigationCommit(GURL(kDefaultTestUrl2)); |
| 338 observer_->OnMessageReceived( |
| 339 PageLoadMetricsMsg_TimingUpdated(observer_->routing_id(), timing), |
| 340 main_rfh()); |
| 341 rfh_tester->SimulateNavigationStop(); |
| 342 |
| 343 observer_->DidFinishLoad(web_contents()->GetMainFrame(), |
| 344 GURL(kDefaultTestUrl2)); |
| 345 |
| 346 // Navigate again to see if the timing updated for a subframe message. |
| 347 web_contents_tester->NavigateAndCommit(GURL(kDefaultTestUrl)); |
| 348 |
| 349 histogram_tester_.ExpectTotalCount(kHistogramNameDomContent, 0); |
| 350 histogram_tester_.ExpectTotalCount(kHistogramNameLoad, 0); |
| 351 histogram_tester_.ExpectTotalCount(kHistogramNameFirstLayout, 1); |
| 352 histogram_tester_.ExpectBucketCount(kHistogramNameFirstLayout, |
| 353 first_layout.InMilliseconds(), 1); |
| 354 } |
214 } // namespace page_load_metrics | 355 } // namespace page_load_metrics |
OLD | NEW |