| 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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 // the renderer and builds proper frame tree. | 217 // the renderer and builds proper frame tree. |
| 218 IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest, FrameTree) { | 218 IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest, FrameTree) { |
| 219 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 219 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
| 220 | 220 |
| 221 NavigateToURL(shell(), | 221 NavigateToURL(shell(), |
| 222 embedded_test_server()->GetURL("/frame_tree/top.html")); | 222 embedded_test_server()->GetURL("/frame_tree/top.html")); |
| 223 | 223 |
| 224 WebContentsImpl* wc = static_cast<WebContentsImpl*>(shell()->web_contents()); | 224 WebContentsImpl* wc = static_cast<WebContentsImpl*>(shell()->web_contents()); |
| 225 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( | 225 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( |
| 226 wc->GetRenderViewHost()); | 226 wc->GetRenderViewHost()); |
| 227 FrameTreeNode* root = wc->GetFrameTreeRootForTesting(); | 227 FrameTreeNode* root = wc->GetFrameTree()->GetRootForTesting(); |
| 228 | 228 |
| 229 // Check that the root node is properly created with the frame id of the | 229 // Check that the root node is properly created with the frame id of the |
| 230 // initial navigation. | 230 // initial navigation. |
| 231 EXPECT_EQ(3UL, root->child_count()); | 231 EXPECT_EQ(3UL, root->child_count()); |
| 232 EXPECT_EQ(std::string(), root->frame_name()); | 232 EXPECT_EQ(std::string(), root->frame_name()); |
| 233 EXPECT_EQ(rvh->main_frame_id(), root->frame_id()); | 233 EXPECT_EQ(rvh->main_frame_id(), root->frame_id()); |
| 234 | 234 |
| 235 EXPECT_EQ(2UL, root->child_at(0)->child_count()); | 235 EXPECT_EQ(2UL, root->child_at(0)->child_count()); |
| 236 EXPECT_STREQ("1-1-name", root->child_at(0)->frame_name().c_str()); | 236 EXPECT_STREQ("1-1-name", root->child_at(0)->frame_name().c_str()); |
| 237 | 237 |
| 238 // Verify the deepest node exists and has the right name. | 238 // Verify the deepest node exists and has the right name. |
| 239 EXPECT_EQ(2UL, root->child_at(2)->child_count()); | 239 EXPECT_EQ(2UL, root->child_at(2)->child_count()); |
| 240 EXPECT_EQ(1UL, root->child_at(2)->child_at(1)->child_count()); | 240 EXPECT_EQ(1UL, root->child_at(2)->child_at(1)->child_count()); |
| 241 EXPECT_EQ(0UL, root->child_at(2)->child_at(1)->child_at(0)->child_count()); | 241 EXPECT_EQ(0UL, root->child_at(2)->child_at(1)->child_at(0)->child_count()); |
| 242 EXPECT_STREQ("3-1-id", | 242 EXPECT_STREQ("3-1-id", |
| 243 root->child_at(2)->child_at(1)->child_at(0)->frame_name().c_str()); | 243 root->child_at(2)->child_at(1)->child_at(0)->frame_name().c_str()); |
| 244 | 244 |
| 245 // Navigate to about:blank, which should leave only the root node of the frame | 245 // Navigate to about:blank, which should leave only the root node of the frame |
| 246 // tree in the browser process. | 246 // tree in the browser process. |
| 247 NavigateToURL(shell(), embedded_test_server()->GetURL("/title1.html")); | 247 NavigateToURL(shell(), embedded_test_server()->GetURL("/title1.html")); |
| 248 | 248 |
| 249 root = wc->GetFrameTreeRootForTesting(); | 249 root = wc->GetFrameTree()->GetRootForTesting(); |
| 250 EXPECT_EQ(0UL, root->child_count()); | 250 EXPECT_EQ(0UL, root->child_count()); |
| 251 EXPECT_EQ(std::string(), root->frame_name()); | 251 EXPECT_EQ(std::string(), root->frame_name()); |
| 252 EXPECT_EQ(rvh->main_frame_id(), root->frame_id()); | 252 EXPECT_EQ(rvh->main_frame_id(), root->frame_id()); |
| 253 } | 253 } |
| 254 | 254 |
| 255 // TODO(sail): enable this for MAC when auto resizing of WebContentsViewCocoa is | 255 // TODO(sail): enable this for MAC when auto resizing of WebContentsViewCocoa is |
| 256 // fixed. | 256 // fixed. |
| 257 // TODO(shrikant): enable this for Windows when issue with | 257 // TODO(shrikant): enable this for Windows when issue with |
| 258 // force-compositing-mode is resolved (http://crbug.com/281726). | 258 // force-compositing-mode is resolved (http://crbug.com/281726). |
| 259 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_ANDROID) | 259 #if defined(OS_WIN) || defined(OS_MACOSX) || defined(OS_ANDROID) |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 // RenderViewSizeObserver resizes WebContentsView in NavigateToPendingEntry, | 305 // RenderViewSizeObserver resizes WebContentsView in NavigateToPendingEntry, |
| 306 // so both WebContentsView and RenderWidgetHostView adopt this new size. | 306 // so both WebContentsView and RenderWidgetHostView adopt this new size. |
| 307 new_size.Enlarge(size_insets.width(), size_insets.height()); | 307 new_size.Enlarge(size_insets.width(), size_insets.height()); |
| 308 EXPECT_EQ(new_size, | 308 EXPECT_EQ(new_size, |
| 309 shell()->web_contents()->GetRenderWidgetHostView()->GetViewBounds(). | 309 shell()->web_contents()->GetRenderWidgetHostView()->GetViewBounds(). |
| 310 size()); | 310 size()); |
| 311 EXPECT_EQ(new_size, shell()->web_contents()->GetView()->GetContainerSize()); | 311 EXPECT_EQ(new_size, shell()->web_contents()->GetView()->GetContainerSize()); |
| 312 } | 312 } |
| 313 | 313 |
| 314 } // namespace content | 314 } // namespace content |
| OLD | NEW |