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

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

Issue 2692373003: Refactor PageLoadExtraInfo::committed_url to url and did_commit fields. (Closed)
Patch Set: address comments Created 3 years, 10 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 } 92 }
93 93
94 ObservePolicy OnCommit(content::NavigationHandle* handle) override { 94 ObservePolicy OnCommit(content::NavigationHandle* handle) override {
95 const bool should_ignore = 95 const bool should_ignore =
96 handle->GetURL().spec().find("ignore-on-commit") != std::string::npos; 96 handle->GetURL().spec().find("ignore-on-commit") != std::string::npos;
97 return should_ignore ? STOP_OBSERVING : CONTINUE_OBSERVING; 97 return should_ignore ? STOP_OBSERVING : CONTINUE_OBSERVING;
98 } 98 }
99 99
100 void OnComplete(const PageLoadTiming& timing, 100 void OnComplete(const PageLoadTiming& timing,
101 const PageLoadExtraInfo& extra_info) override { 101 const PageLoadExtraInfo& extra_info) override {
102 completed_filtered_urls_->push_back(extra_info.committed_url); 102 completed_filtered_urls_->push_back(extra_info.url);
103 } 103 }
104 104
105 private: 105 private:
106 std::vector<GURL>* const completed_filtered_urls_; 106 std::vector<GURL>* const completed_filtered_urls_;
107 }; 107 };
108 108
109 class TestPageLoadMetricsEmbedderInterface 109 class TestPageLoadMetricsEmbedderInterface
110 : public PageLoadMetricsEmbedderInterface { 110 : public PageLoadMetricsEmbedderInterface {
111 public: 111 public:
112 TestPageLoadMetricsEmbedderInterface() : is_ntp_(false) {} 112 TestPageLoadMetricsEmbedderInterface() : is_ntp_(false) {}
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698