| OLD | NEW |
| 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/renderer_host/render_view_host_impl.h" | 6 #include "content/browser/renderer_host/render_view_host_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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 // the renderer and builds proper frame tree. | 233 // the renderer and builds proper frame tree. |
| 234 IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest, FrameTree) { | 234 IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest, FrameTree) { |
| 235 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 235 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
| 236 | 236 |
| 237 NavigateToURL(shell(), | 237 NavigateToURL(shell(), |
| 238 embedded_test_server()->GetURL("/frame_tree/top.html")); | 238 embedded_test_server()->GetURL("/frame_tree/top.html")); |
| 239 | 239 |
| 240 WebContentsImpl* wc = static_cast<WebContentsImpl*>(shell()->web_contents()); | 240 WebContentsImpl* wc = static_cast<WebContentsImpl*>(shell()->web_contents()); |
| 241 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( | 241 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( |
| 242 wc->GetRenderViewHost()); | 242 wc->GetRenderViewHost()); |
| 243 FrameTreeNode* root = wc->GetFrameTreeRootForTesting(); | 243 FrameTreeNode* root = wc->GetFrameTree()->GetRootForTesting(); |
| 244 | 244 |
| 245 // Check that the root node is properly created with the frame id of the | 245 // Check that the root node is properly created with the frame id of the |
| 246 // initial navigation. | 246 // initial navigation. |
| 247 EXPECT_EQ(3UL, root->child_count()); | 247 EXPECT_EQ(3UL, root->child_count()); |
| 248 EXPECT_EQ(std::string(), root->frame_name()); | 248 EXPECT_EQ(std::string(), root->frame_name()); |
| 249 EXPECT_EQ(rvh->main_frame_id(), root->frame_id()); | 249 EXPECT_EQ(rvh->main_frame_id(), root->frame_id()); |
| 250 | 250 |
| 251 EXPECT_EQ(2UL, root->child_at(0)->child_count()); | 251 EXPECT_EQ(2UL, root->child_at(0)->child_count()); |
| 252 EXPECT_STREQ("1-1-name", root->child_at(0)->frame_name().c_str()); | 252 EXPECT_STREQ("1-1-name", root->child_at(0)->frame_name().c_str()); |
| 253 | 253 |
| 254 // Verify the deepest node exists and has the right name. | 254 // Verify the deepest node exists and has the right name. |
| 255 EXPECT_EQ(2UL, root->child_at(2)->child_count()); | 255 EXPECT_EQ(2UL, root->child_at(2)->child_count()); |
| 256 EXPECT_EQ(1UL, root->child_at(2)->child_at(1)->child_count()); | 256 EXPECT_EQ(1UL, root->child_at(2)->child_at(1)->child_count()); |
| 257 EXPECT_EQ(0UL, root->child_at(2)->child_at(1)->child_at(0)->child_count()); | 257 EXPECT_EQ(0UL, root->child_at(2)->child_at(1)->child_at(0)->child_count()); |
| 258 EXPECT_STREQ("3-1-id", | 258 EXPECT_STREQ("3-1-id", |
| 259 root->child_at(2)->child_at(1)->child_at(0)->frame_name().c_str()); | 259 root->child_at(2)->child_at(1)->child_at(0)->frame_name().c_str()); |
| 260 | 260 |
| 261 // Navigate to about:blank, which should leave only the root node of the frame | 261 // Navigate to about:blank, which should leave only the root node of the frame |
| 262 // tree in the browser process. | 262 // tree in the browser process. |
| 263 NavigateToURL(shell(), embedded_test_server()->GetURL("/title1.html")); | 263 NavigateToURL(shell(), embedded_test_server()->GetURL("/title1.html")); |
| 264 | 264 |
| 265 root = wc->GetFrameTreeRootForTesting(); | 265 root = wc->GetFrameTree()->GetRootForTesting(); |
| 266 EXPECT_EQ(0UL, root->child_count()); | 266 EXPECT_EQ(0UL, root->child_count()); |
| 267 EXPECT_EQ(std::string(), root->frame_name()); | 267 EXPECT_EQ(std::string(), root->frame_name()); |
| 268 EXPECT_EQ(rvh->main_frame_id(), root->frame_id()); | 268 EXPECT_EQ(rvh->main_frame_id(), root->frame_id()); |
| 269 } | 269 } |
| 270 | 270 |
| 271 // TODO(sail): enable this for MAC when auto resizing of WebContentsViewCocoa is | 271 // TODO(sail): enable this for MAC when auto resizing of WebContentsViewCocoa is |
| 272 // fixed. | 272 // fixed. |
| 273 // TODO(shrikant): enable this for Windows when issue with | 273 // TODO(shrikant): enable this for Windows when issue with |
| 274 // force-compositing-mode is resolved (http://crbug.com/281726). | 274 // force-compositing-mode is resolved (http://crbug.com/281726). |
| 275 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_ANDROID) | 275 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_ANDROID) |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 // RenderViewSizeObserver resizes WebContentsView in NavigateToPendingEntry, | 329 // RenderViewSizeObserver resizes WebContentsView in NavigateToPendingEntry, |
| 330 // so both WebContentsView and RenderWidgetHostView adopt this new size. | 330 // so both WebContentsView and RenderWidgetHostView adopt this new size. |
| 331 new_size.Enlarge(size_insets.width(), size_insets.height()); | 331 new_size.Enlarge(size_insets.width(), size_insets.height()); |
| 332 EXPECT_EQ(new_size, | 332 EXPECT_EQ(new_size, |
| 333 shell()->web_contents()->GetRenderWidgetHostView()->GetViewBounds(). | 333 shell()->web_contents()->GetRenderWidgetHostView()->GetViewBounds(). |
| 334 size()); | 334 size()); |
| 335 EXPECT_EQ(new_size, shell()->web_contents()->GetView()->GetContainerSize()); | 335 EXPECT_EQ(new_size, shell()->web_contents()->GetView()->GetContainerSize()); |
| 336 } | 336 } |
| 337 | 337 |
| 338 } // namespace content | 338 } // namespace content |
| OLD | NEW |