| 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 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 } | 633 } |
| 634 | 634 |
| 635 IN_PROC_BROWSER_TEST_F(PageLoadMetricsBrowserTest, | 635 IN_PROC_BROWSER_TEST_F(PageLoadMetricsBrowserTest, |
| 636 FirstMeaningfulPaintRecorded) { | 636 FirstMeaningfulPaintRecorded) { |
| 637 ASSERT_TRUE(embedded_test_server()->Start()); | 637 ASSERT_TRUE(embedded_test_server()->Start()); |
| 638 | 638 |
| 639 ui_test_utils::NavigateToURL(browser(), | 639 ui_test_utils::NavigateToURL(browser(), |
| 640 embedded_test_server()->GetURL("/title1.html")); | 640 embedded_test_server()->GetURL("/title1.html")); |
| 641 | 641 |
| 642 // Wait until the renderer finishes observing layouts. | 642 // Wait until the renderer finishes observing layouts. |
| 643 const int kNetworkIdleTime = 500; | 643 const int kNetworkIdleTime = 3000; |
| 644 const int kMargin = 500; | 644 const int kMargin = 500; |
| 645 const std::string javascript = base::StringPrintf( | 645 const std::string javascript = base::StringPrintf( |
| 646 "setTimeout(() => window.domAutomationController.send(true), %d)", | 646 "setTimeout(() => window.domAutomationController.send(true), %d)", |
| 647 kNetworkIdleTime + kMargin); | 647 kNetworkIdleTime + kMargin); |
| 648 bool result; | 648 bool result; |
| 649 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( | 649 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( |
| 650 browser()->tab_strip_model()->GetActiveWebContents(), | 650 browser()->tab_strip_model()->GetActiveWebContents(), |
| 651 javascript, &result)); | 651 javascript, &result)); |
| 652 EXPECT_TRUE(result); | 652 EXPECT_TRUE(result); |
| 653 | 653 |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 753 ui_test_utils::NavigateToURL(browser(), embedded_test_server()->GetURL( | 753 ui_test_utils::NavigateToURL(browser(), embedded_test_server()->GetURL( |
| 754 "/page_load_metrics/large.html")); | 754 "/page_load_metrics/large.html")); |
| 755 NavigateToUntrackedUrl(); | 755 NavigateToUntrackedUrl(); |
| 756 | 756 |
| 757 histogram_tester_.ExpectTotalCount(internal::kHistogramTotalBytes, 1); | 757 histogram_tester_.ExpectTotalCount(internal::kHistogramTotalBytes, 1); |
| 758 | 758 |
| 759 // Verify that there is a single sample recorded in the 10kB bucket (the size | 759 // Verify that there is a single sample recorded in the 10kB bucket (the size |
| 760 // of the main HTML response). | 760 // of the main HTML response). |
| 761 histogram_tester_.ExpectBucketCount(internal::kHistogramTotalBytes, 10, 1); | 761 histogram_tester_.ExpectBucketCount(internal::kHistogramTotalBytes, 10, 1); |
| 762 } | 762 } |
| OLD | NEW |