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

Unified Diff: chrome/browser/ui/browser_instant_controller_unittest.cc

Issue 2640473003: Convert tests to use the non-deprecated WebContentsObserver navigation methods. (Closed)
Patch Set: review comments Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/browser_instant_controller_unittest.cc
diff --git a/chrome/browser/ui/browser_instant_controller_unittest.cc b/chrome/browser/ui/browser_instant_controller_unittest.cc
index 79be65ec5c90d1afba3741f793685303fb862cbf..723b099fb40d1df35d27faae835dde4ec74e7386 100644
--- a/chrome/browser/ui/browser_instant_controller_unittest.cc
+++ b/chrome/browser/ui/browser_instant_controller_unittest.cc
@@ -16,10 +16,12 @@
#include "chrome/browser/ui/browser_instant_controller.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/url_constants.h"
+#include "content/public/browser/navigation_handle.h"
#include "content/public/browser/reload_type.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_observer.h"
+#include "content/public/common/browser_side_navigation_policy.h"
namespace chrome {
@@ -79,12 +81,24 @@ class FakeWebContentsObserver : public content::WebContentsObserver {
url_(contents->GetURL()),
num_reloads_(0) {}
- void DidStartNavigationToPendingEntry(
- const GURL& url,
- content::ReloadType reload_type) override {
- if (url_ == url)
+ void DidStartNavigation(
+ content::NavigationHandle* navigation_handle) override {
+ if (!content::IsBrowserSideNavigationEnabled())
+ return;
+ if (url_ == navigation_handle->GetURL())
num_reloads_++;
- current_url_ = url;
+ current_url_ = navigation_handle->GetURL();
+ }
+
+ // TODO: remove this method when PlzNavigate is turned on by default.
+ void DidStartNavigationToPendingEntry(
+ const GURL& url,
+ content::ReloadType reload_type) override {
+ if (content::IsBrowserSideNavigationEnabled())
+ return;
+ if (url_ == url)
+ num_reloads_++;
+ current_url_ = url;
}
const GURL& url() const { return url_; }

Powered by Google App Engine
This is Rietveld 408576698