Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(86)

Side by Side Diff: chrome/browser/page_load_metrics/page_load_metrics_browsertest.cc

Issue 1417733011: page_load_metrics symbolic constants refactor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@navigation_start_final
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | components/page_load_metrics/browser/metrics_web_contents_observer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "components/page_load_metrics/browser/metrics_web_contents_observer.h" 8 #include "components/page_load_metrics/browser/metrics_web_contents_observer.h"
9 #include "net/test/spawned_test_server/spawned_test_server.h" 9 #include "net/test/spawned_test_server/spawned_test_server.h"
10 10
11 namespace page_load_metrics { 11 namespace page_load_metrics {
12 12
13 class MetricsWebContentsObserverBrowserTest : public InProcessBrowserTest { 13 class MetricsWebContentsObserverBrowserTest : public InProcessBrowserTest {
14 public: 14 public:
15 MetricsWebContentsObserverBrowserTest(){}; 15 MetricsWebContentsObserverBrowserTest(){};
16 ~MetricsWebContentsObserverBrowserTest() override{}; 16 ~MetricsWebContentsObserverBrowserTest() override{};
17 17
18 protected: 18 protected:
19 base::HistogramTester histogram_tester_; 19 base::HistogramTester histogram_tester_;
20 20
21 DISALLOW_COPY_AND_ASSIGN(MetricsWebContentsObserverBrowserTest); 21 DISALLOW_COPY_AND_ASSIGN(MetricsWebContentsObserverBrowserTest);
22 }; 22 };
23 23
24 IN_PROC_BROWSER_TEST_F(MetricsWebContentsObserverBrowserTest, NoNavigation) { 24 IN_PROC_BROWSER_TEST_F(MetricsWebContentsObserverBrowserTest, NoNavigation) {
25 ASSERT_TRUE(test_server()->Start()); 25 ASSERT_TRUE(test_server()->Start());
26 26
27 histogram_tester_.ExpectTotalCount(kHistogramNameDomContent, 0); 27 histogram_tester_.ExpectTotalCount(kHistogramDomContentLoaded, 0);
28 histogram_tester_.ExpectTotalCount(kHistogramNameLoad, 0); 28 histogram_tester_.ExpectTotalCount(kHistogramLoad, 0);
29 histogram_tester_.ExpectTotalCount(kHistogramNameFirstLayout, 0); 29 histogram_tester_.ExpectTotalCount(kHistogramFirstLayout, 0);
30 } 30 }
31 31
32 IN_PROC_BROWSER_TEST_F(MetricsWebContentsObserverBrowserTest, NewPage) { 32 IN_PROC_BROWSER_TEST_F(MetricsWebContentsObserverBrowserTest, NewPage) {
33 ASSERT_TRUE(test_server()->Start()); 33 ASSERT_TRUE(test_server()->Start());
34 34
35 ui_test_utils::NavigateToURL(browser(), 35 ui_test_utils::NavigateToURL(browser(),
36 test_server()->GetURL("/title1.html")); 36 test_server()->GetURL("/title1.html"));
37 ui_test_utils::NavigateToURL(browser(), 37 ui_test_utils::NavigateToURL(browser(),
38 test_server()->GetURL("/title2.html")); 38 test_server()->GetURL("/title2.html"));
39 39
40 histogram_tester_.ExpectTotalCount(kHistogramNameDomContent, 1); 40 histogram_tester_.ExpectTotalCount(kHistogramDomContentLoaded, 1);
41 histogram_tester_.ExpectTotalCount(kHistogramNameLoad, 1); 41 histogram_tester_.ExpectTotalCount(kHistogramLoad, 1);
42 histogram_tester_.ExpectTotalCount(kHistogramNameFirstLayout, 1); 42 histogram_tester_.ExpectTotalCount(kHistogramFirstLayout, 1);
43 } 43 }
44 44
45 IN_PROC_BROWSER_TEST_F(MetricsWebContentsObserverBrowserTest, AnchorLink) { 45 IN_PROC_BROWSER_TEST_F(MetricsWebContentsObserverBrowserTest, AnchorLink) {
46 ASSERT_TRUE(test_server()->Start()); 46 ASSERT_TRUE(test_server()->Start());
47 47
48 ui_test_utils::NavigateToURL(browser(), 48 ui_test_utils::NavigateToURL(browser(),
49 test_server()->GetURL("/title1.html")); 49 test_server()->GetURL("/title1.html"));
50 ui_test_utils::NavigateToURL(browser(), 50 ui_test_utils::NavigateToURL(browser(),
51 test_server()->GetURL("/title1.html#hash")); 51 test_server()->GetURL("/title1.html#hash"));
52 ui_test_utils::NavigateToURL(browser(), 52 ui_test_utils::NavigateToURL(browser(),
53 test_server()->GetURL("/title2.html")); 53 test_server()->GetURL("/title2.html"));
54 54
55 histogram_tester_.ExpectTotalCount(kHistogramNameDomContent, 1); 55 histogram_tester_.ExpectTotalCount(kHistogramDomContentLoaded, 1);
56 histogram_tester_.ExpectTotalCount(kHistogramNameLoad, 1); 56 histogram_tester_.ExpectTotalCount(kHistogramLoad, 1);
57 histogram_tester_.ExpectTotalCount(kHistogramNameFirstLayout, 1); 57 histogram_tester_.ExpectTotalCount(kHistogramFirstLayout, 1);
58 } 58 }
59 59
60 } // namespace page_load_metrics 60 } // namespace page_load_metrics
OLDNEW
« no previous file with comments | « no previous file | components/page_load_metrics/browser/metrics_web_contents_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698