| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/logging.h" | 5 #include "base/logging.h" |
| 6 #include "base/strings/utf_string_conversions.h" | 6 #include "base/strings/utf_string_conversions.h" |
| 7 #include "content/browser/renderer_host/frame_tree_node.h" |
| 7 #include "content/browser/renderer_host/render_view_host_impl.h" | 8 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 8 #include "content/browser/renderer_host/test_render_view_host.h" | 9 #include "content/browser/renderer_host/test_render_view_host.h" |
| 9 #include "content/browser/site_instance_impl.h" | 10 #include "content/browser/site_instance_impl.h" |
| 10 #include "content/browser/web_contents/frame_tree_node.h" | |
| 11 #include "content/browser/web_contents/interstitial_page_impl.h" | 11 #include "content/browser/web_contents/interstitial_page_impl.h" |
| 12 #include "content/browser/web_contents/navigation_entry_impl.h" | 12 #include "content/browser/web_contents/navigation_entry_impl.h" |
| 13 #include "content/browser/webui/web_ui_controller_factory_registry.h" | 13 #include "content/browser/webui/web_ui_controller_factory_registry.h" |
| 14 #include "content/common/view_messages.h" | 14 #include "content/common/view_messages.h" |
| 15 #include "content/public/browser/global_request_id.h" | 15 #include "content/public/browser/global_request_id.h" |
| 16 #include "content/public/browser/interstitial_page_delegate.h" | 16 #include "content/public/browser/interstitial_page_delegate.h" |
| 17 #include "content/public/browser/navigation_details.h" | 17 #include "content/public/browser/navigation_details.h" |
| 18 #include "content/public/browser/notification_details.h" | 18 #include "content/public/browser/notification_details.h" |
| 19 #include "content/public/browser/notification_source.h" | 19 #include "content/public/browser/notification_source.h" |
| 20 #include "content/public/browser/render_widget_host_view.h" | 20 #include "content/public/browser/render_widget_host_view.h" |
| (...skipping 2118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2139 scoped_ptr<TestWebContents> other_contents( | 2139 scoped_ptr<TestWebContents> other_contents( |
| 2140 static_cast<TestWebContents*>(CreateTestWebContents())); | 2140 static_cast<TestWebContents*>(CreateTestWebContents())); |
| 2141 contents()->AddPendingContents(other_contents.get()); | 2141 contents()->AddPendingContents(other_contents.get()); |
| 2142 int route_id = other_contents->GetRenderViewHost()->GetRoutingID(); | 2142 int route_id = other_contents->GetRenderViewHost()->GetRoutingID(); |
| 2143 other_contents.reset(); | 2143 other_contents.reset(); |
| 2144 EXPECT_EQ(NULL, contents()->GetCreatedWindow(route_id)); | 2144 EXPECT_EQ(NULL, contents()->GetCreatedWindow(route_id)); |
| 2145 } | 2145 } |
| 2146 | 2146 |
| 2147 // This test asserts the shape of the frame tree is correct, based on incoming | 2147 // This test asserts the shape of the frame tree is correct, based on incoming |
| 2148 // frame attached/detached messages. | 2148 // frame attached/detached messages. |
| 2149 #if 0 |
| 2149 TEST_F(WebContentsImplTest, FrameTreeShape) { | 2150 TEST_F(WebContentsImplTest, FrameTreeShape) { |
| 2150 std::string no_children_node("no children node"); | 2151 std::string no_children_node("no children node"); |
| 2151 std::string deep_subtree("node with deep subtree"); | 2152 std::string deep_subtree("node with deep subtree"); |
| 2152 | 2153 |
| 2153 // The initial navigation will create a frame_tree_root_ node with the top | 2154 // The initial navigation will create a frame_tree_root_ node with the top |
| 2154 // level frame id. Simulate that by just creating it here. | 2155 // level frame id. Simulate that by just creating it here. |
| 2155 contents()->frame_tree_root_.reset( | 2156 contents()->frame_tree_root_.reset( |
| 2156 new FrameTreeNode(5, std::string("top-level"))); | 2157 new FrameTreeNode(5, std::string("top-level"))); |
| 2157 | 2158 |
| 2158 // Let's send a series of messages for frame attached and build the | 2159 // Let's send a series of messages for frame attached and build the |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2214 // Test removing of nodes. | 2215 // Test removing of nodes. |
| 2215 contents()->OnFrameDetached(555, 655); | 2216 contents()->OnFrameDetached(555, 655); |
| 2216 EXPECT_EQ(0UL, deep_tree->child_at(0)->child_at(0)->child_count()); | 2217 EXPECT_EQ(0UL, deep_tree->child_at(0)->child_at(0)->child_count()); |
| 2217 | 2218 |
| 2218 contents()->OnFrameDetached(16, 265); | 2219 contents()->OnFrameDetached(16, 265); |
| 2219 EXPECT_EQ(4UL, root->child_at(2)->child_count()); | 2220 EXPECT_EQ(4UL, root->child_at(2)->child_count()); |
| 2220 | 2221 |
| 2221 contents()->OnFrameDetached(5, 15); | 2222 contents()->OnFrameDetached(5, 15); |
| 2222 EXPECT_EQ(2UL, root->child_count()); | 2223 EXPECT_EQ(2UL, root->child_count()); |
| 2223 } | 2224 } |
| 2225 #endif |
| 2224 | 2226 |
| 2225 } // namespace content | 2227 } // namespace content |
| OLD | NEW |