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 "components/page_load_metrics/browser/metrics_web_contents_observer.h" | 5 #include "components/page_load_metrics/browser/metrics_web_contents_observer.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 RenderViewHostTestHarness::SetUp(); | 108 RenderViewHostTestHarness::SetUp(); |
109 AttachObserver(); | 109 AttachObserver(); |
110 } | 110 } |
111 | 111 |
112 void SimulateTimingUpdate(const PageLoadTiming& timing) { | 112 void SimulateTimingUpdate(const PageLoadTiming& timing) { |
113 SimulateTimingUpdate(timing, web_contents()->GetMainFrame()); | 113 SimulateTimingUpdate(timing, web_contents()->GetMainFrame()); |
114 } | 114 } |
115 | 115 |
116 void SimulateTimingUpdate(const PageLoadTiming& timing, | 116 void SimulateTimingUpdate(const PageLoadTiming& timing, |
117 content::RenderFrameHost* render_frame_host) { | 117 content::RenderFrameHost* render_frame_host) { |
118 ASSERT_TRUE(observer_->OnMessageReceived( | 118 observer_->OnTimingUpdated(render_frame_host, timing, PageLoadMetadata()); |
119 PageLoadMetricsMsg_TimingUpdated(observer_->routing_id(), timing, | |
120 PageLoadMetadata()), | |
121 render_frame_host)); | |
122 } | 119 } |
123 | 120 |
124 void AttachObserver() { | 121 void AttachObserver() { |
125 embedder_interface_ = new TestPageLoadMetricsEmbedderInterface(); | 122 embedder_interface_ = new TestPageLoadMetricsEmbedderInterface(); |
126 observer_.reset(new MetricsWebContentsObserver( | 123 observer_.reset(new MetricsWebContentsObserver( |
127 web_contents(), base::WrapUnique(embedder_interface_))); | 124 web_contents(), base::WrapUnique(embedder_interface_))); |
128 observer_->WasShown(); | 125 observer_->WasShown(); |
129 } | 126 } |
130 | 127 |
131 void CheckErrorEvent(InternalErrorLoadEvent error, int count) { | 128 void CheckErrorEvent(InternalErrorLoadEvent error, int count) { |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 rfh_tester->SimulateNavigationStop(); | 439 rfh_tester->SimulateNavigationStop(); |
443 | 440 |
444 web_contents()->Stop(); | 441 web_contents()->Stop(); |
445 | 442 |
446 histogram_tester_.ExpectTotalCount(internal::kAbortChainSizeNoCommit, 1); | 443 histogram_tester_.ExpectTotalCount(internal::kAbortChainSizeNoCommit, 1); |
447 histogram_tester_.ExpectBucketCount(internal::kAbortChainSizeNoCommit, 3, | 444 histogram_tester_.ExpectBucketCount(internal::kAbortChainSizeNoCommit, 3, |
448 1); | 445 1); |
449 } | 446 } |
450 | 447 |
451 } // namespace page_load_metrics | 448 } // namespace page_load_metrics |
OLD | NEW |