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 "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 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 content::WebContentsTester::For(web_contents()); | 312 content::WebContentsTester::For(web_contents()); |
313 | 313 |
314 GURL about_blank_url = GURL("about:blank"); | 314 GURL about_blank_url = GURL("about:blank"); |
315 web_contents_tester->NavigateAndCommit(about_blank_url); | 315 web_contents_tester->NavigateAndCommit(about_blank_url); |
316 SimulateTimingUpdate(timing); | 316 SimulateTimingUpdate(timing); |
317 ASSERT_EQ(0, CountUpdatedTimingReported()); | 317 ASSERT_EQ(0, CountUpdatedTimingReported()); |
318 web_contents_tester->NavigateAndCommit(GURL(kDefaultTestUrl)); | 318 web_contents_tester->NavigateAndCommit(GURL(kDefaultTestUrl)); |
319 ASSERT_EQ(0, CountUpdatedTimingReported()); | 319 ASSERT_EQ(0, CountUpdatedTimingReported()); |
320 ASSERT_EQ(0, CountCompleteTimingReported()); | 320 ASSERT_EQ(0, CountCompleteTimingReported()); |
321 | 321 |
322 CheckErrorEvent(ERR_IPC_FROM_BAD_URL_SCHEME, 1); | |
323 CheckErrorEvent(ERR_IPC_WITH_NO_RELEVANT_LOAD, 1); | 322 CheckErrorEvent(ERR_IPC_WITH_NO_RELEVANT_LOAD, 1); |
324 CheckTotalErrorEvents(); | 323 CheckTotalErrorEvents(); |
325 } | 324 } |
326 | 325 |
327 TEST_F(MetricsWebContentsObserverTest, NotInMainError) { | 326 TEST_F(MetricsWebContentsObserverTest, NotInMainError) { |
328 PageLoadTiming timing; | 327 PageLoadTiming timing; |
329 timing.navigation_start = base::Time::FromDoubleT(1); | 328 timing.navigation_start = base::Time::FromDoubleT(1); |
330 | 329 |
331 content::WebContentsTester* web_contents_tester = | 330 content::WebContentsTester* web_contents_tester = |
332 content::WebContentsTester::For(web_contents()); | 331 content::WebContentsTester::For(web_contents()); |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
502 | 501 |
503 histogram_tester_.ExpectTotalCount( | 502 histogram_tester_.ExpectTotalCount( |
504 internal::kPageLoadCompletedAfterAppBackground, 2); | 503 internal::kPageLoadCompletedAfterAppBackground, 2); |
505 histogram_tester_.ExpectBucketCount( | 504 histogram_tester_.ExpectBucketCount( |
506 internal::kPageLoadCompletedAfterAppBackground, false, 1); | 505 internal::kPageLoadCompletedAfterAppBackground, false, 1); |
507 histogram_tester_.ExpectBucketCount( | 506 histogram_tester_.ExpectBucketCount( |
508 internal::kPageLoadCompletedAfterAppBackground, true, 1); | 507 internal::kPageLoadCompletedAfterAppBackground, true, 1); |
509 } | 508 } |
510 | 509 |
511 } // namespace page_load_metrics | 510 } // namespace page_load_metrics |
OLD | NEW |