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 "content/browser/frame_host/frame_tree.h" | 5 #include "content/browser/frame_host/frame_tree.h" |
6 | 6 |
7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "content/browser/frame_host/navigator.h" | 9 #include "content/browser/frame_host/navigator.h" |
10 #include "content/browser/frame_host/render_frame_host_factory.h" | 10 #include "content/browser/frame_host/render_frame_host_factory.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 FrameTree frame_tree(new Navigator(NULL, NULL), NULL, NULL, NULL); | 102 FrameTree frame_tree(new Navigator(NULL, NULL), NULL, NULL, NULL); |
103 | 103 |
104 std::string no_children_node("no children node"); | 104 std::string no_children_node("no children node"); |
105 std::string deep_subtree("node with deep subtree"); | 105 std::string deep_subtree("node with deep subtree"); |
106 | 106 |
107 // Ensure the top-level node of the FrameTree is initialized by simulating a | 107 // Ensure the top-level node of the FrameTree is initialized by simulating a |
108 // main frame swap here. | 108 // main frame swap here. |
109 scoped_ptr<RenderFrameHostImpl> render_frame_host = | 109 scoped_ptr<RenderFrameHostImpl> render_frame_host = |
110 RenderFrameHostFactory::Create(static_cast<RenderViewHostImpl*>(rvh()), | 110 RenderFrameHostFactory::Create(static_cast<RenderViewHostImpl*>(rvh()), |
111 &frame_tree, | 111 &frame_tree, |
| 112 frame_tree.root(), |
112 process()->GetNextRoutingID(), | 113 process()->GetNextRoutingID(), |
113 false); | 114 false); |
114 frame_tree.SwapMainFrame(render_frame_host.get()); | 115 frame_tree.SwapMainFrame(render_frame_host.get()); |
115 frame_tree.OnFirstNavigationAfterSwap(5); | 116 frame_tree.OnFirstNavigationAfterSwap(5); |
116 | 117 |
117 ASSERT_EQ("5: []", GetTreeState(&frame_tree)); | 118 ASSERT_EQ("5: []", GetTreeState(&frame_tree)); |
118 | 119 |
119 // Simulate attaching a series of frames to build the frame tree. | 120 // Simulate attaching a series of frames to build the frame tree. |
120 frame_tree.AddFrame(process()->GetNextRoutingID(), 5, 14, std::string()); | 121 frame_tree.AddFrame(process()->GetNextRoutingID(), 5, 14, std::string()); |
121 frame_tree.AddFrame(process()->GetNextRoutingID(), 5, 15, std::string()); | 122 frame_tree.AddFrame(process()->GetNextRoutingID(), 5, 15, std::string()); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 frame_tree.RemoveFrame(5, 15); | 170 frame_tree.RemoveFrame(5, 15); |
170 ASSERT_EQ("5: [14: [244: [], 245: []], " | 171 ASSERT_EQ("5: [14: [244: [], 245: []], " |
171 "16: [264: [], 266: [], " | 172 "16: [264: [], 266: [], " |
172 "267 'node with deep subtree': " | 173 "267 'node with deep subtree': " |
173 "[365: [455: [555: []]]], 268: []]]", | 174 "[365: [455: [555: []]]], 268: []]]", |
174 GetTreeState(&frame_tree)); | 175 GetTreeState(&frame_tree)); |
175 } | 176 } |
176 | 177 |
177 } // namespace | 178 } // namespace |
178 } // namespace content | 179 } // namespace content |
OLD | NEW |