| 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 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 629 } | 629 } |
| 630 | 630 |
| 631 IN_PROC_BROWSER_TEST_F(PageLoadMetricsBrowserTest, | 631 IN_PROC_BROWSER_TEST_F(PageLoadMetricsBrowserTest, |
| 632 FirstMeaningfulPaintRecorded) { | 632 FirstMeaningfulPaintRecorded) { |
| 633 ASSERT_TRUE(embedded_test_server()->Start()); | 633 ASSERT_TRUE(embedded_test_server()->Start()); |
| 634 | 634 |
| 635 ui_test_utils::NavigateToURL(browser(), | 635 ui_test_utils::NavigateToURL(browser(), |
| 636 embedded_test_server()->GetURL("/title1.html")); | 636 embedded_test_server()->GetURL("/title1.html")); |
| 637 | 637 |
| 638 // Wait until the renderer finishes observing layouts. | 638 // Wait until the renderer finishes observing layouts. |
| 639 const int kNetworkIdleTime = 500; | 639 const int kNetworkIdleTime = 3000; |
| 640 const int kMargin = 500; | 640 const int kMargin = 500; |
| 641 const std::string javascript = base::StringPrintf( | 641 const std::string javascript = base::StringPrintf( |
| 642 "setTimeout(() => window.domAutomationController.send(true), %d)", | 642 "setTimeout(() => window.domAutomationController.send(true), %d)", |
| 643 kNetworkIdleTime + kMargin); | 643 kNetworkIdleTime + kMargin); |
| 644 bool result; | 644 bool result; |
| 645 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( | 645 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( |
| 646 browser()->tab_strip_model()->GetActiveWebContents(), | 646 browser()->tab_strip_model()->GetActiveWebContents(), |
| 647 javascript, &result)); | 647 javascript, &result)); |
| 648 EXPECT_TRUE(result); | 648 EXPECT_TRUE(result); |
| 649 | 649 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 743 ui_test_utils::NavigateToURL(browser(), embedded_test_server()->GetURL( | 743 ui_test_utils::NavigateToURL(browser(), embedded_test_server()->GetURL( |
| 744 "/page_load_metrics/large.html")); | 744 "/page_load_metrics/large.html")); |
| 745 NavigateToUntrackedUrl(); | 745 NavigateToUntrackedUrl(); |
| 746 | 746 |
| 747 histogram_tester_.ExpectTotalCount(internal::kHistogramTotalBytes, 1); | 747 histogram_tester_.ExpectTotalCount(internal::kHistogramTotalBytes, 1); |
| 748 | 748 |
| 749 // Verify that there is a single sample recorded in the 10kB bucket (the size | 749 // Verify that there is a single sample recorded in the 10kB bucket (the size |
| 750 // of the main HTML response). | 750 // of the main HTML response). |
| 751 histogram_tester_.ExpectBucketCount(internal::kHistogramTotalBytes, 10, 1); | 751 histogram_tester_.ExpectBucketCount(internal::kHistogramTotalBytes, 10, 1); |
| 752 } | 752 } |
| OLD | NEW |