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 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 std::string(), | 353 std::string(), |
354 blink::WebSandboxFlags::None); | 354 blink::WebSandboxFlags::None); |
355 EXPECT_EQ( | 355 EXPECT_EQ( |
356 "RenderFrameHostChanged(new)(23) -> 1: [22: []]\n" | 356 "RenderFrameHostChanged(new)(23) -> 1: [22: []]\n" |
357 "RenderFrameCreated(23) -> 1: [22: [], 23: []]", | 357 "RenderFrameCreated(23) -> 1: [22: [], 23: []]", |
358 activity.GetLog()); | 358 activity.GetLog()); |
359 | 359 |
360 // Crash the renderer | 360 // Crash the renderer |
361 main_test_rfh()->GetProcess()->SimulateCrash(); | 361 main_test_rfh()->GetProcess()->SimulateCrash(); |
362 EXPECT_EQ( | 362 EXPECT_EQ( |
363 "RenderFrameDeleted(23) -> 1: [22: [], 23*: []]\n" | 363 "RenderProcessGone -> 1*: [22*: [], 23*: []]\n" |
364 "RenderFrameDeleted(22) -> 1: [22*: [], 23*: []]\n" | 364 "RenderFrameDeleted(23) -> 1*: [22*: [], 23*: []]\n" |
365 "RenderFrameDeleted(1) -> 1*: []\n" | 365 "RenderFrameDeleted(22) -> 1*: [22*: [], 23*: []]\n" |
366 "RenderProcessGone -> 1*: []", | 366 "RenderFrameDeleted(1) -> 1*: []", |
367 activity.GetLog()); | 367 activity.GetLog()); |
368 } | 368 } |
369 | 369 |
370 // Ensure that frames are not added to the tree, if the process passed in | 370 // Ensure that frames are not added to the tree, if the process passed in |
371 // is different than the process of the parent node. | 371 // is different than the process of the parent node. |
372 TEST_F(FrameTreeTest, FailAddFrameWithWrongProcessId) { | 372 TEST_F(FrameTreeTest, FailAddFrameWithWrongProcessId) { |
373 contents()->NavigateAndCommit(GURL("http://www.google.com")); | 373 contents()->NavigateAndCommit(GURL("http://www.google.com")); |
374 FrameTree* frame_tree = contents()->GetFrameTree(); | 374 FrameTree* frame_tree = contents()->GetFrameTree(); |
375 FrameTreeNode* root = frame_tree->root(); | 375 FrameTreeNode* root = frame_tree->root(); |
376 int process_id = root->current_frame_host()->GetProcess()->GetID(); | 376 int process_id = root->current_frame_host()->GetProcess()->GetID(); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 // Crash the renderer. | 413 // Crash the renderer. |
414 main_test_rfh()->GetProcess()->SimulateCrash(); | 414 main_test_rfh()->GetProcess()->SimulateCrash(); |
415 | 415 |
416 // Ensure they cannot be found by id after the process has crashed. | 416 // Ensure they cannot be found by id after the process has crashed. |
417 EXPECT_FALSE(FrameTreeNode::GloballyFindByID(id1)); | 417 EXPECT_FALSE(FrameTreeNode::GloballyFindByID(id1)); |
418 EXPECT_FALSE(FrameTreeNode::GloballyFindByID(id2)); | 418 EXPECT_FALSE(FrameTreeNode::GloballyFindByID(id2)); |
419 EXPECT_FALSE(FrameTreeNode::GloballyFindByID(id3)); | 419 EXPECT_FALSE(FrameTreeNode::GloballyFindByID(id3)); |
420 } | 420 } |
421 | 421 |
422 } // namespace content | 422 } // namespace content |
OLD | NEW |