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

Side by Side Diff: components/page_load_metrics/browser/metrics_web_contents_observer_unittest.cc

Issue 2056153002: Convert PageLoadMetrics to Mojo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 5 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 (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"
11 #include "base/memory/ptr_util.h" 11 #include "base/memory/ptr_util.h"
12 #include "base/process/kill.h" 12 #include "base/process/kill.h"
13 #include "base/test/histogram_tester.h" 13 #include "base/test/histogram_tester.h"
14 #include "base/time/time.h" 14 #include "base/time/time.h"
15 #include "components/page_load_metrics/browser/page_load_metrics_observer.h" 15 #include "components/page_load_metrics/browser/page_load_metrics_observer.h"
16 #include "components/page_load_metrics/common/page_load_metrics_messages.h" 16 #include "components/page_load_metrics/common/page_load_metrics_param_traits.h"
17 #include "content/public/browser/navigation_handle.h" 17 #include "content/public/browser/navigation_handle.h"
18 #include "content/public/browser/render_frame_host.h" 18 #include "content/public/browser/render_frame_host.h"
19 #include "content/public/test/test_renderer_host.h" 19 #include "content/public/test/test_renderer_host.h"
20 #include "content/public/test/web_contents_tester.h" 20 #include "content/public/test/web_contents_tester.h"
21 #include "testing/gtest/include/gtest/gtest.h" 21 #include "testing/gtest/include/gtest/gtest.h"
22 #include "url/gurl.h" 22 #include "url/gurl.h"
23 23
24 namespace page_load_metrics { 24 namespace page_load_metrics {
25 25
26 namespace { 26 namespace {
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 RenderViewHostTestHarness::SetUp(); 112 RenderViewHostTestHarness::SetUp();
113 AttachObserver(); 113 AttachObserver();
114 } 114 }
115 115
116 void SimulateTimingUpdate(const PageLoadTiming& timing) { 116 void SimulateTimingUpdate(const PageLoadTiming& timing) {
117 SimulateTimingUpdate(timing, web_contents()->GetMainFrame()); 117 SimulateTimingUpdate(timing, web_contents()->GetMainFrame());
118 } 118 }
119 119
120 void SimulateTimingUpdate(const PageLoadTiming& timing, 120 void SimulateTimingUpdate(const PageLoadTiming& timing,
121 content::RenderFrameHost* render_frame_host) { 121 content::RenderFrameHost* render_frame_host) {
122 ASSERT_TRUE(observer_->OnMessageReceived( 122 observer_->OnTimingUpdated(render_frame_host, timing, PageLoadMetadata());
123 PageLoadMetricsMsg_TimingUpdated(observer_->routing_id(), timing,
124 PageLoadMetadata()),
125 render_frame_host));
126 } 123 }
127 124
128 void AttachObserver() { 125 void AttachObserver() {
129 embedder_interface_ = new TestPageLoadMetricsEmbedderInterface(); 126 embedder_interface_ = new TestPageLoadMetricsEmbedderInterface();
130 observer_.reset(new MetricsWebContentsObserver( 127 observer_.reset(new MetricsWebContentsObserver(
131 web_contents(), base::WrapUnique(embedder_interface_))); 128 web_contents(), base::WrapUnique(embedder_interface_)));
132 observer_->WasShown(); 129 observer_->WasShown();
133 } 130 }
134 131
135 void CheckErrorEvent(InternalErrorLoadEvent error, int count) { 132 void CheckErrorEvent(InternalErrorLoadEvent error, int count) {
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
467 rfh_tester->SimulateNavigationStop(); 464 rfh_tester->SimulateNavigationStop();
468 465
469 web_contents()->Stop(); 466 web_contents()->Stop();
470 467
471 histogram_tester_.ExpectTotalCount(internal::kAbortChainSizeNoCommit, 1); 468 histogram_tester_.ExpectTotalCount(internal::kAbortChainSizeNoCommit, 1);
472 histogram_tester_.ExpectBucketCount(internal::kAbortChainSizeNoCommit, 3, 469 histogram_tester_.ExpectBucketCount(internal::kAbortChainSizeNoCommit, 3,
473 1); 470 1);
474 } 471 }
475 472
476 } // namespace page_load_metrics 473 } // namespace page_load_metrics
OLDNEW
« no previous file with comments | « components/page_load_metrics/browser/metrics_web_contents_observer.cc ('k') | components/page_load_metrics/common/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698