Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(190)

Unified Diff: content/browser/frame_host/frame_tree_unittest.cc

Issue 917793006: Resetting FrameTreeNode must remove child FrameTreeNodes from global map. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698