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

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

Issue 2894973002: Provide WebContents::CreateParams to tab helpers. (Closed)
Patch Set: rebase Created 3 years, 6 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 #include "chrome/browser/page_load_metrics/metrics_web_contents_observer.h" 5 #include "chrome/browser/page_load_metrics/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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 } 197 }
198 198
199 void AttachObserver() { 199 void AttachObserver() {
200 embedder_interface_ = 200 embedder_interface_ =
201 new TestPageLoadMetricsEmbedderInterface(web_contents()); 201 new TestPageLoadMetricsEmbedderInterface(web_contents());
202 // Owned by the web_contents. Tests must be careful not to call 202 // Owned by the web_contents. Tests must be careful not to call
203 // SimulateTimingUpdate after they call DeleteContents() without also 203 // SimulateTimingUpdate after they call DeleteContents() without also
204 // calling AttachObserver() again. Otherwise they will use-after-free the 204 // calling AttachObserver() again. Otherwise they will use-after-free the
205 // observer_. 205 // observer_.
206 observer_ = MetricsWebContentsObserver::CreateForWebContents( 206 observer_ = MetricsWebContentsObserver::CreateForWebContents(
207 web_contents(), base::WrapUnique(embedder_interface_)); 207 web_contents(), base::nullopt, base::WrapUnique(embedder_interface_));
208 observer_->WasShown(); 208 observer_->WasShown();
209 } 209 }
210 210
211 void CheckErrorEvent(InternalErrorLoadEvent error, int count) { 211 void CheckErrorEvent(InternalErrorLoadEvent error, int count) {
212 histogram_tester_.ExpectBucketCount(internal::kErrorEvents, error, count); 212 histogram_tester_.ExpectBucketCount(internal::kErrorEvents, error, count);
213 num_errors_ += count; 213 num_errors_ += count;
214 } 214 }
215 215
216 void CheckTotalErrorEvents() { 216 void CheckTotalErrorEvents() {
217 histogram_tester_.ExpectTotalCount(internal::kErrorEvents, num_errors_); 217 histogram_tester_.ExpectTotalCount(internal::kErrorEvents, num_errors_);
(...skipping 583 matching lines...) Expand 10 before | Expand all | Expand 10 after
801 ASSERT_EQ(2, CountUpdatedTimingReported()); 801 ASSERT_EQ(2, CountUpdatedTimingReported());
802 ASSERT_EQ(0, CountEmptyCompleteTimingReported()); 802 ASSERT_EQ(0, CountEmptyCompleteTimingReported());
803 803
804 ASSERT_EQ(1, CountUpdatedSubFrameTimingReported()); 804 ASSERT_EQ(1, CountUpdatedSubFrameTimingReported());
805 EXPECT_TRUE(subframe_timing.Equals(*updated_subframe_timings().back())); 805 EXPECT_TRUE(subframe_timing.Equals(*updated_subframe_timings().back()));
806 806
807 CheckNoErrorEvents(); 807 CheckNoErrorEvents();
808 } 808 }
809 809
810 } // namespace page_load_metrics 810 } // namespace page_load_metrics
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698