| OLD | NEW |
| 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 "base/test/histogram_tester.h" | 5 #include "base/test/histogram_tester.h" |
| 6 #include "chrome/test/base/in_process_browser_test.h" | 6 #include "chrome/test/base/in_process_browser_test.h" |
| 7 #include "chrome/test/base/ui_test_utils.h" | 7 #include "chrome/test/base/ui_test_utils.h" |
| 8 #include "net/test/spawned_test_server/spawned_test_server.h" | 8 #include "net/test/spawned_test_server/spawned_test_server.h" |
| 9 | 9 |
| 10 namespace page_load_metrics { | 10 namespace page_load_metrics { |
| 11 | 11 |
| 12 class MetricsWebContentsObserverBrowserTest : public InProcessBrowserTest { | 12 class MetricsWebContentsObserverBrowserTest : public InProcessBrowserTest { |
| 13 public: | 13 public: |
| 14 const char* kHistogramNameFirstLayout = | 14 const char* kHistogramNameFirstLayout = |
| 15 "PageLoad.Timing.NavigationToFirstLayout"; | 15 "PageLoad.Timing2.NavigationToFirstLayout"; |
| 16 const char* kHistogramNameDomContent = | 16 const char* kHistogramNameDomContent = |
| 17 "PageLoad.Timing.NavigationToDOMContentLoadedEventFired"; | 17 "PageLoad.Timing2.NavigationToDOMContentLoadedEventFired"; |
| 18 const char* kHistogramNameLoad = "PageLoad.Timing.NavigationToLoadEventFired"; | 18 const char* kHistogramNameLoad = |
| 19 "PageLoad.Timing2.NavigationToLoadEventFired"; |
| 19 MetricsWebContentsObserverBrowserTest() {}; | 20 MetricsWebContentsObserverBrowserTest() {}; |
| 20 ~MetricsWebContentsObserverBrowserTest() override {}; | 21 ~MetricsWebContentsObserverBrowserTest() override {}; |
| 21 | 22 |
| 22 protected: | 23 protected: |
| 23 base::HistogramTester histogram_tester_; | 24 base::HistogramTester histogram_tester_; |
| 24 | 25 |
| 25 DISALLOW_COPY_AND_ASSIGN(MetricsWebContentsObserverBrowserTest); | 26 DISALLOW_COPY_AND_ASSIGN(MetricsWebContentsObserverBrowserTest); |
| 26 }; | 27 }; |
| 27 | 28 |
| 28 IN_PROC_BROWSER_TEST_F(MetricsWebContentsObserverBrowserTest, NoNavigation) { | 29 IN_PROC_BROWSER_TEST_F(MetricsWebContentsObserverBrowserTest, NoNavigation) { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 55 test_server()->GetURL("/title1.html#hash")); | 56 test_server()->GetURL("/title1.html#hash")); |
| 56 ui_test_utils::NavigateToURL(browser(), | 57 ui_test_utils::NavigateToURL(browser(), |
| 57 test_server()->GetURL("/title2.html")); | 58 test_server()->GetURL("/title2.html")); |
| 58 | 59 |
| 59 histogram_tester_.ExpectTotalCount(kHistogramNameDomContent, 1); | 60 histogram_tester_.ExpectTotalCount(kHistogramNameDomContent, 1); |
| 60 histogram_tester_.ExpectTotalCount(kHistogramNameLoad, 1); | 61 histogram_tester_.ExpectTotalCount(kHistogramNameLoad, 1); |
| 61 histogram_tester_.ExpectTotalCount(kHistogramNameFirstLayout, 1); | 62 histogram_tester_.ExpectTotalCount(kHistogramNameFirstLayout, 1); |
| 62 } | 63 } |
| 63 | 64 |
| 64 } // namespace page_load_metrics | 65 } // namespace page_load_metrics |
| OLD | NEW |