| 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 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 658 histogram_tester_.ExpectTotalCount( | 658 histogram_tester_.ExpectTotalCount( |
| 659 internal::kHistogramFirstMeaningfulPaint, 1); | 659 internal::kHistogramFirstMeaningfulPaint, 1); |
| 660 histogram_tester_.ExpectTotalCount( | 660 histogram_tester_.ExpectTotalCount( |
| 661 internal::kHistogramParseStartToFirstMeaningfulPaint, 1); | 661 internal::kHistogramParseStartToFirstMeaningfulPaint, 1); |
| 662 } | 662 } |
| 663 | 663 |
| 664 IN_PROC_BROWSER_TEST_F(PageLoadMetricsBrowserTest, | 664 IN_PROC_BROWSER_TEST_F(PageLoadMetricsBrowserTest, |
| 665 FirstMeaningfulPaintNotRecorded) { | 665 FirstMeaningfulPaintNotRecorded) { |
| 666 ASSERT_TRUE(embedded_test_server()->Start()); | 666 ASSERT_TRUE(embedded_test_server()->Start()); |
| 667 | 667 |
| 668 ui_test_utils::NavigateToURL(browser(), | 668 scoped_refptr<TimingUpdatedObserver> fcp_observer = |
| 669 embedded_test_server()->GetURL("/title1.html")); | 669 CreateTimingUpdatedObserver(); |
| 670 fcp_observer->AddMatchingFields( |
| 671 TimingUpdatedObserver::FIRST_CONTENTFUL_PAINT); |
| 672 |
| 673 ui_test_utils::NavigateToURL( |
| 674 browser(), embedded_test_server()->GetURL( |
| 675 "/page_load_metrics/page_with_active_connections.html")); |
| 676 fcp_observer->WaitForMatchingIPC(); |
| 670 | 677 |
| 671 // Navigate away before a FMP is reported. | 678 // Navigate away before a FMP is reported. |
| 672 NavigateToUntrackedUrl(); | 679 NavigateToUntrackedUrl(); |
| 673 | 680 |
| 674 histogram_tester_.ExpectUniqueSample( | 681 histogram_tester_.ExpectUniqueSample( |
| 675 internal::kHistogramFirstMeaningfulPaintStatus, | 682 internal::kHistogramFirstMeaningfulPaintStatus, |
| 676 internal::FIRST_MEANINGFUL_PAINT_DID_NOT_REACH_NETWORK_STABLE, 1); | 683 internal::FIRST_MEANINGFUL_PAINT_DID_NOT_REACH_NETWORK_STABLE, 1); |
| 677 histogram_tester_.ExpectTotalCount( | 684 histogram_tester_.ExpectTotalCount( |
| 678 internal::kHistogramFirstMeaningfulPaint, 0); | 685 internal::kHistogramFirstMeaningfulPaint, 0); |
| 679 histogram_tester_.ExpectTotalCount( | 686 histogram_tester_.ExpectTotalCount( |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 753 ui_test_utils::NavigateToURL(browser(), embedded_test_server()->GetURL( | 760 ui_test_utils::NavigateToURL(browser(), embedded_test_server()->GetURL( |
| 754 "/page_load_metrics/large.html")); | 761 "/page_load_metrics/large.html")); |
| 755 NavigateToUntrackedUrl(); | 762 NavigateToUntrackedUrl(); |
| 756 | 763 |
| 757 histogram_tester_.ExpectTotalCount(internal::kHistogramTotalBytes, 1); | 764 histogram_tester_.ExpectTotalCount(internal::kHistogramTotalBytes, 1); |
| 758 | 765 |
| 759 // Verify that there is a single sample recorded in the 10kB bucket (the size | 766 // Verify that there is a single sample recorded in the 10kB bucket (the size |
| 760 // of the main HTML response). | 767 // of the main HTML response). |
| 761 histogram_tester_.ExpectBucketCount(internal::kHistogramTotalBytes, 10, 1); | 768 histogram_tester_.ExpectBucketCount(internal::kHistogramTotalBytes, 10, 1); |
| 762 } | 769 } |
| OLD | NEW |