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

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

Issue 1837233002: Optional <TimeDelta> since they may be non existent. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Need to add Optional changes as well in this issue otherwise bots fail in compilation Created 4 years, 8 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 <vector> 7 #include <vector>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 AssertNoTimingReported(); 277 AssertNoTimingReported();
278 CheckErrorEvent(ERR_IPC_WITH_NO_RELEVANT_LOAD, 1); 278 CheckErrorEvent(ERR_IPC_WITH_NO_RELEVANT_LOAD, 1);
279 CheckTotalErrorEvents(); 279 CheckTotalErrorEvents();
280 } 280 }
281 281
282 TEST_F(MetricsWebContentsObserverTest, DontLogAbortChains) { 282 TEST_F(MetricsWebContentsObserverTest, DontLogAbortChains) {
283 NavigateAndCommit(GURL(kDefaultTestUrl)); 283 NavigateAndCommit(GURL(kDefaultTestUrl));
284 NavigateAndCommit(GURL(kDefaultTestUrl2)); 284 NavigateAndCommit(GURL(kDefaultTestUrl2));
285 NavigateAndCommit(GURL(kDefaultTestUrl)); 285 NavigateAndCommit(GURL(kDefaultTestUrl));
286 histogram_tester_.ExpectTotalCount(internal::kAbortChainSizeNewNavigation, 0); 286 histogram_tester_.ExpectTotalCount(internal::kAbortChainSizeNewNavigation, 0);
287 CheckErrorEvent(ERR_NO_IPCS_RECEIVED, 2); 287 CheckNoErrorEvents();
288 CheckTotalErrorEvents(); 288 CheckTotalErrorEvents();
289 } 289 }
290 290
291 TEST_F(MetricsWebContentsObserverTest, LogAbortChains) { 291 TEST_F(MetricsWebContentsObserverTest, LogAbortChains) {
292 content::WebContentsTester* web_contents_tester = 292 content::WebContentsTester* web_contents_tester =
293 content::WebContentsTester::For(web_contents()); 293 content::WebContentsTester::For(web_contents());
294 content::RenderFrameHostTester* rfh_tester = 294 content::RenderFrameHostTester* rfh_tester =
295 content::RenderFrameHostTester::For(main_rfh()); 295 content::RenderFrameHostTester::For(main_rfh());
296 // Start and abort three loads before one finally commits. 296 // Start and abort three loads before one finally commits.
297 web_contents_tester->StartNavigation(GURL(kDefaultTestUrl)); 297 web_contents_tester->StartNavigation(GURL(kDefaultTestUrl));
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 rfh_tester->SimulateNavigationStop(); 358 rfh_tester->SimulateNavigationStop();
359 359
360 web_contents()->Stop(); 360 web_contents()->Stop();
361 361
362 histogram_tester_.ExpectTotalCount(internal::kAbortChainSizeNoCommit, 1); 362 histogram_tester_.ExpectTotalCount(internal::kAbortChainSizeNoCommit, 1);
363 histogram_tester_.ExpectBucketCount(internal::kAbortChainSizeNoCommit, 3, 363 histogram_tester_.ExpectBucketCount(internal::kAbortChainSizeNoCommit, 3,
364 1); 364 1);
365 } 365 }
366 366
367 } // namespace page_load_metrics 367 } // namespace page_load_metrics
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698