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

Side by Side Diff: chrome/browser/page_load_metrics/metrics_web_contents_observer_unittest.cc

Issue 2354703002: Instantiate PageLoadTrackers for prerenders (Closed)
Patch Set: fix test Created 4 years, 3 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
« no previous file with comments | « chrome/browser/page_load_metrics/metrics_web_contents_observer.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "chrome/browser/page_load_metrics/metrics_web_contents_observer.h" 5 #include "chrome/browser/page_load_metrics/metrics_web_contents_observer.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 CheckNoErrorEvents(); 270 CheckNoErrorEvents();
271 } 271 }
272 272
273 TEST_F(MetricsWebContentsObserverTest, DontLogPrerender) { 273 TEST_F(MetricsWebContentsObserverTest, DontLogPrerender) {
274 PageLoadTiming timing; 274 PageLoadTiming timing;
275 timing.navigation_start = base::Time::FromDoubleT(1); 275 timing.navigation_start = base::Time::FromDoubleT(1);
276 276
277 content::WebContentsTester* web_contents_tester = 277 content::WebContentsTester* web_contents_tester =
278 content::WebContentsTester::For(web_contents()); 278 content::WebContentsTester::For(web_contents());
279 embedder_interface_->set_is_prerendering(true); 279 embedder_interface_->set_is_prerendering(true);
280 observer_->WasHidden();
Charlie Harrison 2016/09/22 14:51:24 Does removing this cause the test to fail?
Bryan McQuade 2016/09/22 15:14:37 I added a DCHECK(!started_in_foreground_); for the
Charlie Harrison 2016/09/22 15:16:31 Ahh, right! LGTM that's what I want.
280 281
281 web_contents_tester->NavigateAndCommit(GURL(kDefaultTestUrl)); 282 web_contents_tester->NavigateAndCommit(GURL(kDefaultTestUrl));
282 SimulateTimingUpdate(timing); 283 SimulateTimingUpdate(timing);
283 web_contents_tester->NavigateAndCommit(GURL(kDefaultTestUrl2)); 284 web_contents_tester->NavigateAndCommit(GURL(kDefaultTestUrl2));
284 ASSERT_EQ(0, CountUpdatedTimingReported()); 285 ASSERT_EQ(0, CountUpdatedTimingReported());
285 ASSERT_EQ(0, CountCompleteTimingReported()); 286 ASSERT_EQ(0, CountCompleteTimingReported());
286 CheckErrorEvent(ERR_IPC_WITH_NO_RELEVANT_LOAD, 1); 287 CheckNoErrorEvents();
287 CheckTotalErrorEvents();
288 } 288 }
289 289
290 TEST_F(MetricsWebContentsObserverTest, DontLogNewTabPage) { 290 TEST_F(MetricsWebContentsObserverTest, DontLogNewTabPage) {
291 PageLoadTiming timing; 291 PageLoadTiming timing;
292 timing.navigation_start = base::Time::FromDoubleT(1); 292 timing.navigation_start = base::Time::FromDoubleT(1);
293 293
294 content::WebContentsTester* web_contents_tester = 294 content::WebContentsTester* web_contents_tester =
295 content::WebContentsTester::For(web_contents()); 295 content::WebContentsTester::For(web_contents());
296 embedder_interface_->set_is_ntp(true); 296 embedder_interface_->set_is_ntp(true);
297 297
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 502
503 histogram_tester_.ExpectTotalCount( 503 histogram_tester_.ExpectTotalCount(
504 internal::kPageLoadCompletedAfterAppBackground, 2); 504 internal::kPageLoadCompletedAfterAppBackground, 2);
505 histogram_tester_.ExpectBucketCount( 505 histogram_tester_.ExpectBucketCount(
506 internal::kPageLoadCompletedAfterAppBackground, false, 1); 506 internal::kPageLoadCompletedAfterAppBackground, false, 1);
507 histogram_tester_.ExpectBucketCount( 507 histogram_tester_.ExpectBucketCount(
508 internal::kPageLoadCompletedAfterAppBackground, true, 1); 508 internal::kPageLoadCompletedAfterAppBackground, true, 1);
509 } 509 }
510 510
511 } // namespace page_load_metrics 511 } // namespace page_load_metrics
OLDNEW
« no previous file with comments | « chrome/browser/page_load_metrics/metrics_web_contents_observer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698