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_impl.h" | 9 #include "content/browser/frame_host/navigator_impl.h" |
10 #include "content/browser/frame_host/render_frame_host_factory.h" | 10 #include "content/browser/frame_host/render_frame_host_factory.h" |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 FrameTreeNode* root = contents()->GetFrameTree()->root(); | 321 FrameTreeNode* root = contents()->GetFrameTree()->root(); |
322 | 322 |
323 main_test_rfh()->OnCreateChildFrame(22, std::string(), SandboxFlags::NONE); | 323 main_test_rfh()->OnCreateChildFrame(22, std::string(), SandboxFlags::NONE); |
324 main_test_rfh()->OnCreateChildFrame(23, std::string(), SandboxFlags::NONE); | 324 main_test_rfh()->OnCreateChildFrame(23, std::string(), SandboxFlags::NONE); |
325 | 325 |
326 // Add one grandchild frame. | 326 // Add one grandchild frame. |
327 RenderFrameHostImpl* child1_rfh = root->child_at(0)->current_frame_host(); | 327 RenderFrameHostImpl* child1_rfh = root->child_at(0)->current_frame_host(); |
328 child1_rfh->OnCreateChildFrame(33, std::string(), SandboxFlags::NONE); | 328 child1_rfh->OnCreateChildFrame(33, std::string(), SandboxFlags::NONE); |
329 | 329 |
330 // Ensure they can be found by id. | 330 // Ensure they can be found by id. |
331 int64 id1 = root->child_at(0)->frame_tree_node_id(); | 331 int id1 = root->child_at(0)->frame_tree_node_id(); |
332 int64 id2 = root->child_at(1)->frame_tree_node_id(); | 332 int id2 = root->child_at(1)->frame_tree_node_id(); |
333 int64 id3 = root->child_at(0)->child_at(0)->frame_tree_node_id(); | 333 int id3 = root->child_at(0)->child_at(0)->frame_tree_node_id(); |
334 EXPECT_TRUE(FrameTreeNode::GloballyFindByID(id1)); | 334 EXPECT_TRUE(FrameTreeNode::GloballyFindByID(id1)); |
335 EXPECT_TRUE(FrameTreeNode::GloballyFindByID(id2)); | 335 EXPECT_TRUE(FrameTreeNode::GloballyFindByID(id2)); |
336 EXPECT_TRUE(FrameTreeNode::GloballyFindByID(id3)); | 336 EXPECT_TRUE(FrameTreeNode::GloballyFindByID(id3)); |
337 | 337 |
338 // Crash the renderer. | 338 // Crash the renderer. |
339 main_test_rfh()->GetProcess()->SimulateCrash(); | 339 main_test_rfh()->GetProcess()->SimulateCrash(); |
340 | 340 |
341 // Ensure they cannot be found by id after the process has crashed. | 341 // Ensure they cannot be found by id after the process has crashed. |
342 EXPECT_FALSE(FrameTreeNode::GloballyFindByID(id1)); | 342 EXPECT_FALSE(FrameTreeNode::GloballyFindByID(id1)); |
343 EXPECT_FALSE(FrameTreeNode::GloballyFindByID(id2)); | 343 EXPECT_FALSE(FrameTreeNode::GloballyFindByID(id2)); |
344 EXPECT_FALSE(FrameTreeNode::GloballyFindByID(id3)); | 344 EXPECT_FALSE(FrameTreeNode::GloballyFindByID(id3)); |
345 } | 345 } |
346 | 346 |
347 } // namespace content | 347 } // namespace content |
OLD | NEW |