Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "base/files/scoped_temp_dir.h" | 5 #include "base/files/scoped_temp_dir.h" |
| 6 #include "base/macros.h" | 6 #include "base/macros.h" |
| 7 #include "base/test/histogram_tester.h" | 7 #include "base/test/histogram_tester.h" |
| 8 #include "base/time/time.h" | 8 #include "base/time/time.h" |
| 9 #include "chrome/browser/page_load_metrics/metrics_web_contents_observer.h" | 9 #include "chrome/browser/page_load_metrics/metrics_web_contents_observer.h" |
| 10 #include "chrome/browser/page_load_metrics/observers/aborts_page_load_metrics_ob server.h" | 10 #include "chrome/browser/page_load_metrics/observers/aborts_page_load_metrics_ob server.h" |
| (...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 432 | 432 |
| 433 EXPECT_TRUE(manager3.WaitForRequestStart()); | 433 EXPECT_TRUE(manager3.WaitForRequestStart()); |
| 434 manager2.WaitForNavigationFinished(); | 434 manager2.WaitForNavigationFinished(); |
| 435 | 435 |
| 436 manager3.WaitForNavigationFinished(); | 436 manager3.WaitForNavigationFinished(); |
| 437 | 437 |
| 438 histogram_tester_.ExpectTotalCount( | 438 histogram_tester_.ExpectTotalCount( |
| 439 internal::kHistogramAbortNewNavigationBeforeCommit, 2); | 439 internal::kHistogramAbortNewNavigationBeforeCommit, 2); |
| 440 } | 440 } |
| 441 | 441 |
| 442 IN_PROC_BROWSER_TEST_F(PageLoadMetricsBrowserTest, AbortClientRedirect) { | |
|
Charlie Harrison
2017/02/17 22:36:49
Please keep this test ans just assert we don't log
Bryan McQuade
2017/02/18 00:30:15
Done
| |
| 443 ASSERT_TRUE(embedded_test_server()->Start()); | |
| 444 | |
| 445 GURL first_url(embedded_test_server()->GetURL("/title1.html")); | |
| 446 ui_test_utils::NavigateToURL(browser(), first_url); | |
| 447 | |
| 448 GURL second_url(embedded_test_server()->GetURL("/title2.html")); | |
| 449 chrome::NavigateParams params(browser(), second_url, | |
| 450 ui::PAGE_TRANSITION_LINK); | |
| 451 content::TestNavigationManager manager( | |
| 452 browser()->tab_strip_model()->GetActiveWebContents(), second_url); | |
| 453 chrome::Navigate(¶ms); | |
| 454 EXPECT_TRUE(manager.WaitForRequestStart()); | |
| 455 | |
| 456 { | |
| 457 content::TestNavigationManager reload_manager( | |
| 458 browser()->tab_strip_model()->GetActiveWebContents(), first_url); | |
| 459 EXPECT_TRUE(content::ExecuteScript( | |
| 460 browser()->tab_strip_model()->GetActiveWebContents(), | |
| 461 "window.location.reload();")); | |
| 462 } | |
| 463 | |
| 464 manager.WaitForNavigationFinished(); | |
| 465 | |
| 466 histogram_tester_.ExpectTotalCount( | |
| 467 internal::kHistogramAbortClientRedirectBeforeCommit, 1); | |
| 468 } | |
| 469 | |
| 470 IN_PROC_BROWSER_TEST_F(PageLoadMetricsBrowserTest, | 442 IN_PROC_BROWSER_TEST_F(PageLoadMetricsBrowserTest, |
| 471 FirstMeaningfulPaintRecorded) { | 443 FirstMeaningfulPaintRecorded) { |
| 472 ASSERT_TRUE(embedded_test_server()->Start()); | 444 ASSERT_TRUE(embedded_test_server()->Start()); |
| 473 | 445 |
| 474 ui_test_utils::NavigateToURL(browser(), | 446 ui_test_utils::NavigateToURL(browser(), |
| 475 embedded_test_server()->GetURL("/title1.html")); | 447 embedded_test_server()->GetURL("/title1.html")); |
| 476 | 448 |
| 477 // Wait until the renderer finishes observing layouts. | 449 // Wait until the renderer finishes observing layouts. |
| 478 const int kNetworkIdleTime = 500; | 450 const int kNetworkIdleTime = 500; |
| 479 const int kMargin = 500; | 451 const int kMargin = 500; |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 584 ui_test_utils::NavigateToURL(browser(), embedded_test_server()->GetURL( | 556 ui_test_utils::NavigateToURL(browser(), embedded_test_server()->GetURL( |
| 585 "/page_load_metrics/large.html")); | 557 "/page_load_metrics/large.html")); |
| 586 NavigateToUntrackedUrl(); | 558 NavigateToUntrackedUrl(); |
| 587 | 559 |
| 588 histogram_tester_.ExpectTotalCount(internal::kHistogramTotalBytes, 1); | 560 histogram_tester_.ExpectTotalCount(internal::kHistogramTotalBytes, 1); |
| 589 | 561 |
| 590 // Verify that there is a single sample recorded in the 10kB bucket (the size | 562 // Verify that there is a single sample recorded in the 10kB bucket (the size |
| 591 // of the main HTML response). | 563 // of the main HTML response). |
| 592 histogram_tester_.ExpectBucketCount(internal::kHistogramTotalBytes, 10, 1); | 564 histogram_tester_.ExpectBucketCount(internal::kHistogramTotalBytes, 10, 1); |
| 593 } | 565 } |
| OLD | NEW |