Index: content/browser/frame_host/frame_tree_unittest.cc |
diff --git a/content/browser/frame_host/frame_tree_unittest.cc b/content/browser/frame_host/frame_tree_unittest.cc |
index 6ee69fc52b7e1bbc8e8d7bb9048e0324e637a03a..adb19e093a8c446f8d778530265d0511f9c85526 100644 |
--- a/content/browser/frame_host/frame_tree_unittest.cc |
+++ b/content/browser/frame_host/frame_tree_unittest.cc |
@@ -252,4 +252,30 @@ TEST_F(FrameTreeTest, FailAddFrameWithWrongProcessId) { |
ASSERT_EQ("1: []", GetTreeState(frame_tree)); |
} |
+// Ensure that frames removed while a process has crashed are not preserved in |
+// the global map of id->frame. |
+TEST_F(FrameTreeTest, ProcessCrashClearsGlobalMap) { |
+ // Add a couple of child frmaes to the main frame. |
Charlie Reis
2015/02/12 17:12:43
nit: drop "of"
nit: frames
nasko
2015/02/12 23:21:08
Done.
|
+ FrameTreeNode* root = contents()->GetFrameTree()->root(); |
+ |
+ main_test_rfh()->OnCreateChildFrame(22, std::string(), SandboxFlags::NONE); |
+ main_test_rfh()->OnCreateChildFrame(23, std::string(), SandboxFlags::NONE); |
+ |
+ // Ensure they can be found by id. |
+ int64 id1 = root->child_at(0)->frame_tree_node_id(); |
+ int64 id2 = root->child_at(1)->frame_tree_node_id(); |
+ EXPECT_TRUE(FrameTree::GloballyFindByID(id1)); |
+ EXPECT_TRUE(FrameTree::GloballyFindByID(id2)); |
+ |
+ // Crash the renderer |
Charlie Reis
2015/02/12 17:12:43
nit: End with period.
nasko
2015/02/12 23:21:08
Done.
|
+ main_test_rfh()->OnMessageReceived(FrameHostMsg_RenderProcessGone( |
+ 0, base::TERMINATION_STATUS_PROCESS_CRASHED, -1)); |
+ |
+ // Ensure they cannot be found by id after the process has crashed. |
+ EXPECT_FALSE(FrameTree::GloballyFindByID(id1)); |
+ EXPECT_FALSE(FrameTree::GloballyFindByID(id2)); |
+} |
+ |
Charlie Reis
2015/02/12 17:12:43
nit: Too many blank lines.
nasko
2015/02/12 23:21:08
Done.
|
+ |
+ |
} // namespace content |