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

Side by Side Diff: chrome/browser/page_load_metrics/observers/page_load_metrics_observer_test_harness.h

Issue 2874663005: [Page Load Metrics] Add mojom file to page load metrics. (Closed)
Patch Set: Remove unnecessary variable Created 3 years, 7 months 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
OLDNEW
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 #ifndef CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_PAGE_LOAD_METRICS_OBSERVER_TE ST_HARNESS_H_ 5 #ifndef CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_PAGE_LOAD_METRICS_OBSERVER_TE ST_HARNESS_H_
6 #define CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_PAGE_LOAD_METRICS_OBSERVER_TE ST_HARNESS_H_ 6 #define CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_PAGE_LOAD_METRICS_OBSERVER_TE ST_HARNESS_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/test/histogram_tester.h" 9 #include "base/test/histogram_tester.h"
10 #include "chrome/browser/page_load_metrics/metrics_web_contents_observer.h" 10 #include "chrome/browser/page_load_metrics/metrics_web_contents_observer.h"
(...skipping 10 matching lines...) Expand all
21 // an observer, override RegisterObservers and call tracker->AddObserver. This 21 // an observer, override RegisterObservers and call tracker->AddObserver. This
22 // will attach the observer to all main frame navigations. 22 // will attach the observer to all main frame navigations.
23 class PageLoadMetricsObserverTestHarness 23 class PageLoadMetricsObserverTestHarness
24 : public ChromeRenderViewHostTestHarness { 24 : public ChromeRenderViewHostTestHarness {
25 public: 25 public:
26 PageLoadMetricsObserverTestHarness(); 26 PageLoadMetricsObserverTestHarness();
27 ~PageLoadMetricsObserverTestHarness() override; 27 ~PageLoadMetricsObserverTestHarness() override;
28 28
29 // Helper that fills in any timing fields that MWCO requires but that are 29 // Helper that fills in any timing fields that MWCO requires but that are
30 // currently missing. 30 // currently missing.
31 static void PopulateRequiredTimingFields(PageLoadTiming* inout_timing); 31 static void PopulateRequiredTimingFields(mojom::PageLoadTiming* inout_timing);
32 32
33 void SetUp() override; 33 void SetUp() override;
34 34
35 virtual void RegisterObservers(PageLoadTracker* tracker) {} 35 virtual void RegisterObservers(PageLoadTracker* tracker) {}
36 36
37 // Simulates starting a navigation to the given gurl, without committing the 37 // Simulates starting a navigation to the given gurl, without committing the
38 // navigation. 38 // navigation.
39 void StartNavigation(const GURL& gurl); 39 void StartNavigation(const GURL& gurl);
40 40
41 // Simulates committing a navigation to the given URL with the given 41 // Simulates committing a navigation to the given URL with the given
42 // PageTransition. 42 // PageTransition.
43 void NavigateWithPageTransitionAndCommit(const GURL& url, 43 void NavigateWithPageTransitionAndCommit(const GURL& url,
44 ui::PageTransition transition); 44 ui::PageTransition transition);
45 45
46 // Navigates to a URL that is not tracked by page_load_metrics. Useful for 46 // Navigates to a URL that is not tracked by page_load_metrics. Useful for
47 // forcing the OnComplete method of a PageLoadMetricsObserver to run. 47 // forcing the OnComplete method of a PageLoadMetricsObserver to run.
48 void NavigateToUntrackedUrl() { 48 void NavigateToUntrackedUrl() {
49 NavigateAndCommit(GURL(url::kAboutBlankURL)); 49 NavigateAndCommit(GURL(url::kAboutBlankURL));
50 } 50 }
51 51
52 // Call this to simulate sending a PageLoadTiming IPC from the render process 52 // Call this to simulate sending a PageLoadTiming IPC from the render process
53 // to the browser process. These will update the timing information for the 53 // to the browser process. These will update the timing information for the
54 // most recently committed navigation. 54 // most recently committed navigation.
55 void SimulateTimingUpdate(const PageLoadTiming& timing); 55 void SimulateTimingUpdate(const mojom::PageLoadTiming& timing);
56 void SimulateTimingAndMetadataUpdate(const PageLoadTiming& timing, 56 void SimulateTimingAndMetadataUpdate(const mojom::PageLoadTiming& timing,
57 const PageLoadMetadata& metadata); 57 const mojom::PageLoadMetadata& metadata);
58 58
59 // Simulates a loaded resource. 59 // Simulates a loaded resource.
60 void SimulateStartedResource(const ExtraRequestStartInfo& info); 60 void SimulateStartedResource(const ExtraRequestStartInfo& info);
61 61
62 // Simulates a loaded resource. 62 // Simulates a loaded resource.
63 void SimulateLoadedResource(const ExtraRequestCompleteInfo& info); 63 void SimulateLoadedResource(const ExtraRequestCompleteInfo& info);
64 64
65 // Simulates a user input. 65 // Simulates a user input.
66 void SimulateInputEvent(const blink::WebInputEvent& event); 66 void SimulateInputEvent(const blink::WebInputEvent& event);
67 67
(...skipping 11 matching lines...) Expand all
79 private: 79 private:
80 base::HistogramTester histogram_tester_; 80 base::HistogramTester histogram_tester_;
81 MetricsWebContentsObserver* observer_; 81 MetricsWebContentsObserver* observer_;
82 82
83 DISALLOW_COPY_AND_ASSIGN(PageLoadMetricsObserverTestHarness); 83 DISALLOW_COPY_AND_ASSIGN(PageLoadMetricsObserverTestHarness);
84 }; 84 };
85 85
86 } // namespace page_load_metrics 86 } // namespace page_load_metrics
87 87
88 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_PAGE_LOAD_METRICS_OBSERVER _TEST_HARNESS_H_ 88 #endif // CHROME_BROWSER_PAGE_LOAD_METRICS_OBSERVERS_PAGE_LOAD_METRICS_OBSERVER _TEST_HARNESS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698