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

Side by Side Diff: content/browser/web_contents/web_contents_impl_browsertest.cc

Issue 84063003: Rename WebContentsObserver::NavigateToPendingEntry to DidStartNavigationToPendingEntry. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Adding better comment from Charlie. Created 7 years 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "base/values.h" 5 #include "base/values.h"
6 #include "content/browser/frame_host/navigation_entry_impl.h" 6 #include "content/browser/frame_host/navigation_entry_impl.h"
7 #include "content/browser/web_contents/web_contents_impl.h" 7 #include "content/browser/web_contents/web_contents_impl.h"
8 #include "content/public/browser/load_notification_details.h" 8 #include "content/public/browser/load_notification_details.h"
9 #include "content/public/browser/navigation_controller.h" 9 #include "content/public/browser/navigation_controller.h"
10 #include "content/public/browser/notification_details.h" 10 #include "content/public/browser/notification_details.h"
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 : WebContentsObserver(shell->web_contents()), 128 : WebContentsObserver(shell->web_contents()),
129 shell_(shell), 129 shell_(shell),
130 wcv_new_size_(wcv_new_size) { 130 wcv_new_size_(wcv_new_size) {
131 } 131 }
132 132
133 // WebContentsObserver: 133 // WebContentsObserver:
134 virtual void RenderViewCreated(RenderViewHost* rvh) OVERRIDE { 134 virtual void RenderViewCreated(RenderViewHost* rvh) OVERRIDE {
135 rwhv_create_size_ = rvh->GetView()->GetViewBounds().size(); 135 rwhv_create_size_ = rvh->GetView()->GetViewBounds().size();
136 } 136 }
137 137
138 virtual void NavigateToPendingEntry( 138 virtual void DidStartNavigationToPendingEntry(
139 const GURL& url, 139 const GURL& url,
140 NavigationController::ReloadType reload_type) OVERRIDE { 140 NavigationController::ReloadType reload_type) OVERRIDE {
141 ResizeWebContentsView(shell_, wcv_new_size_, false); 141 ResizeWebContentsView(shell_, wcv_new_size_, false);
142 } 142 }
143 143
144 gfx::Size rwhv_create_size() const { return rwhv_create_size_; } 144 gfx::Size rwhv_create_size() const { return rwhv_create_size_; }
145 145
146 private: 146 private:
147 Shell* shell_; // Weak ptr. 147 Shell* shell_; // Weak ptr.
148 gfx::Size wcv_new_size_; 148 gfx::Size wcv_new_size_;
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 gfx::Size init_size(200, 200); 281 gfx::Size init_size(200, 200);
282 gfx::Size new_size(100, 100); 282 gfx::Size new_size(100, 100);
283 size_insets = gfx::Size(-20, -30); 283 size_insets = gfx::Size(-20, -30);
284 ResizeWebContentsView(shell(), init_size, true); 284 ResizeWebContentsView(shell(), init_size, true);
285 delegate->set_size_insets(size_insets); 285 delegate->set_size_insets(size_insets);
286 RenderViewSizeObserver observer(shell(), new_size); 286 RenderViewSizeObserver observer(shell(), new_size);
287 NavigateToURL(shell(), embedded_test_server()->GetURL("/title1.html")); 287 NavigateToURL(shell(), embedded_test_server()->GetURL("/title1.html"));
288 // RenderWidgetHostView is created at specified size. 288 // RenderWidgetHostView is created at specified size.
289 init_size.Enlarge(size_insets.width(), size_insets.height()); 289 init_size.Enlarge(size_insets.width(), size_insets.height());
290 EXPECT_EQ(init_size, observer.rwhv_create_size()); 290 EXPECT_EQ(init_size, observer.rwhv_create_size());
291 // RenderViewSizeObserver resizes WebContentsView in NavigateToPendingEntry, 291 // RenderViewSizeObserver resizes WebContentsView in
292 // so both WebContentsView and RenderWidgetHostView adopt this new size. 292 // DidStartNavigationToPendingEntry, so both WebContentsView and
293 // RenderWidgetHostView adopt this new size.
293 new_size.Enlarge(size_insets.width(), size_insets.height()); 294 new_size.Enlarge(size_insets.width(), size_insets.height());
294 EXPECT_EQ(new_size, 295 EXPECT_EQ(new_size,
295 shell()->web_contents()->GetRenderWidgetHostView()->GetViewBounds(). 296 shell()->web_contents()->GetRenderWidgetHostView()->GetViewBounds().
296 size()); 297 size());
297 EXPECT_EQ(new_size, shell()->web_contents()->GetView()->GetContainerSize()); 298 EXPECT_EQ(new_size, shell()->web_contents()->GetView()->GetContainerSize());
298 } 299 }
299 300
300 IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest, OpenURLSubframe) { 301 IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest, OpenURLSubframe) {
301 302
302 // Navigate with source_frame_id 3, FrameTreeNode ID 4. 303 // Navigate with source_frame_id 3, FrameTreeNode ID 4.
303 const GURL url("http://foo"); 304 const GURL url("http://foo");
304 OpenURLParams params(url, Referrer(), 3, 4, CURRENT_TAB, PAGE_TRANSITION_LINK, 305 OpenURLParams params(url, Referrer(), 3, 4, CURRENT_TAB, PAGE_TRANSITION_LINK,
305 true); 306 true);
306 shell()->web_contents()->OpenURL(params); 307 shell()->web_contents()->OpenURL(params);
307 308
308 // Make sure the NavigationEntry ends up with the FrameTreeNode ID. 309 // Make sure the NavigationEntry ends up with the FrameTreeNode ID.
309 NavigationController* controller = &shell()->web_contents()->GetController(); 310 NavigationController* controller = &shell()->web_contents()->GetController();
310 EXPECT_TRUE(controller->GetPendingEntry()); 311 EXPECT_TRUE(controller->GetPendingEntry());
311 EXPECT_EQ(4, NavigationEntryImpl::FromNavigationEntry( 312 EXPECT_EQ(4, NavigationEntryImpl::FromNavigationEntry(
312 controller->GetPendingEntry())->frame_tree_node_id()); 313 controller->GetPendingEntry())->frame_tree_node_id());
313 } 314 }
314 315
315 316
316 } // namespace content 317 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_impl.cc ('k') | content/public/browser/web_contents_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698