| OLD | NEW |
| 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 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 | 382 |
| 383 content::WebContentsTester* web_contents_tester = | 383 content::WebContentsTester* web_contents_tester = |
| 384 content::WebContentsTester::For(web_contents()); | 384 content::WebContentsTester::For(web_contents()); |
| 385 web_contents_tester->NavigateAndCommit(GURL(kDefaultTestUrl)); | 385 web_contents_tester->NavigateAndCommit(GURL(kDefaultTestUrl)); |
| 386 | 386 |
| 387 SimulateTimingUpdate(timing); | 387 SimulateTimingUpdate(timing); |
| 388 ASSERT_EQ(1, CountUpdatedTimingReported()); | 388 ASSERT_EQ(1, CountUpdatedTimingReported()); |
| 389 SimulateTimingUpdate(timing2); | 389 SimulateTimingUpdate(timing2); |
| 390 ASSERT_EQ(1, CountUpdatedTimingReported()); | 390 ASSERT_EQ(1, CountUpdatedTimingReported()); |
| 391 | 391 |
| 392 CheckErrorEvent(ERR_BAD_TIMING_IPC, 1); | 392 CheckErrorEvent(ERR_BAD_TIMING_IPC_INVALID_TIMING_DESCENDENT, 1); |
| 393 CheckTotalErrorEvents(); | 393 CheckTotalErrorEvents(); |
| 394 } | 394 } |
| 395 | 395 |
| 396 TEST_F(MetricsWebContentsObserverTest, ObservePartialNavigation) { | 396 TEST_F(MetricsWebContentsObserverTest, ObservePartialNavigation) { |
| 397 // Reset the state of the tests, and attach the MetricsWebContentsObserver in | 397 // Reset the state of the tests, and attach the MetricsWebContentsObserver in |
| 398 // the middle of a navigation. This tests that the class is robust to only | 398 // the middle of a navigation. This tests that the class is robust to only |
| 399 // observing some of a navigation. | 399 // observing some of a navigation. |
| 400 DeleteContents(); | 400 DeleteContents(); |
| 401 SetContents(CreateTestWebContents()); | 401 SetContents(CreateTestWebContents()); |
| 402 | 402 |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 585 web_contents_tester->NavigateAndCommit(GURL(kDefaultTestUrl2)); | 585 web_contents_tester->NavigateAndCommit(GURL(kDefaultTestUrl2)); |
| 586 ASSERT_EQ(std::vector<GURL>({GURL(kDefaultTestUrl)}), | 586 ASSERT_EQ(std::vector<GURL>({GURL(kDefaultTestUrl)}), |
| 587 completed_filtered_urls()); | 587 completed_filtered_urls()); |
| 588 | 588 |
| 589 web_contents_tester->NavigateAndCommit(GURL(kDefaultTestUrl)); | 589 web_contents_tester->NavigateAndCommit(GURL(kDefaultTestUrl)); |
| 590 ASSERT_EQ(std::vector<GURL>({GURL(kDefaultTestUrl), GURL(kDefaultTestUrl2)}), | 590 ASSERT_EQ(std::vector<GURL>({GURL(kDefaultTestUrl), GURL(kDefaultTestUrl2)}), |
| 591 completed_filtered_urls()); | 591 completed_filtered_urls()); |
| 592 } | 592 } |
| 593 | 593 |
| 594 } // namespace page_load_metrics | 594 } // namespace page_load_metrics |
| OLD | NEW |