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

Unified Diff: chrome/browser/ui/browser_browsertest.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_browsertest.cc
diff --git a/chrome/browser/ui/browser_browsertest.cc b/chrome/browser/ui/browser_browsertest.cc
index 7f6fa033d5c58ddc9102abb1a97b718c9ba352ba..0fd477c7073a0737e50615f004a0262c4af0aa38 100644
--- a/chrome/browser/ui/browser_browsertest.cc
+++ b/chrome/browser/ui/browser_browsertest.cc
@@ -283,11 +283,23 @@ class RenderViewSizeObserver : public content::WebContentsObserver {
render_view_host->GetWidget()->GetView()->GetViewBounds().size();
}
+ void DidStartNavigationToPendingEntry(
+ const GURL& url,
+ content::ReloadType reload_type) override {
+ // TODO: remove this method when PlzNavigate is turned on by default.
+ if (!content::IsBrowserSideNavigationEnabled())
+ Resize();
+ }
+
// Enlarge WebContentsView by |wcv_resize_insets_| while the navigation entry
// is pending.
- void DidStartNavigationToPendingEntry(
- const GURL& url,
- content::ReloadType reload_type) override {
+ void DidStartNavigation(
+ content::NavigationHandle* navigation_handle) override {
+ if (content::IsBrowserSideNavigationEnabled())
+ Resize();
+ }
+
+ void Resize() {
if (wcv_resize_insets_.IsEmpty())
return;
// Resizing the main browser window by |wcv_resize_insets_| will
@@ -327,7 +339,7 @@ class RenderViewSizeObserver : public content::WebContentsObserver {
typedef std::map<content::RenderViewHost*, Sizes> RenderViewSizes;
RenderViewSizes render_view_sizes_;
// Enlarge WebContentsView by this size insets in
- // DidStartNavigationToPendingEntry.
+ // DidStartNavigation.
gfx::Size wcv_resize_insets_;
BrowserWindow* browser_window_; // Weak ptr.

Powered by Google App Engine
This is Rietveld 408576698