| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "content/browser/frame_host/frame_tree_node.h" | 6 #include "content/browser/frame_host/frame_tree_node.h" |
| 7 #include "content/browser/renderer_host/render_view_host_impl.h" | 7 #include "content/browser/renderer_host/render_view_host_impl.h" |
| 8 #include "content/browser/web_contents/web_contents_impl.h" | 8 #include "content/browser/web_contents/web_contents_impl.h" |
| 9 #include "content/public/browser/notification_service.h" | 9 #include "content/public/browser/notification_service.h" |
| 10 #include "content/public/browser/notification_types.h" | 10 #include "content/public/browser/notification_types.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 ASSERT_EQ(3UL, root->child_count()); | 76 ASSERT_EQ(3UL, root->child_count()); |
| 77 EXPECT_EQ(std::string(), root->frame_name()); | 77 EXPECT_EQ(std::string(), root->frame_name()); |
| 78 | 78 |
| 79 ASSERT_EQ(2UL, root->child_at(0)->child_count()); | 79 ASSERT_EQ(2UL, root->child_at(0)->child_count()); |
| 80 EXPECT_STREQ("1-1-name", root->child_at(0)->frame_name().c_str()); | 80 EXPECT_STREQ("1-1-name", root->child_at(0)->frame_name().c_str()); |
| 81 | 81 |
| 82 // Verify the deepest node exists and has the right name. | 82 // Verify the deepest node exists and has the right name. |
| 83 ASSERT_EQ(2UL, root->child_at(2)->child_count()); | 83 ASSERT_EQ(2UL, root->child_at(2)->child_count()); |
| 84 EXPECT_EQ(1UL, root->child_at(2)->child_at(1)->child_count()); | 84 EXPECT_EQ(1UL, root->child_at(2)->child_at(1)->child_count()); |
| 85 EXPECT_EQ(0UL, root->child_at(2)->child_at(1)->child_at(0)->child_count()); | 85 EXPECT_EQ(0UL, root->child_at(2)->child_at(1)->child_at(0)->child_count()); |
| 86 EXPECT_STREQ("3-1-id", | 86 EXPECT_STREQ("3-1-name", |
| 87 root->child_at(2)->child_at(1)->child_at(0)->frame_name().c_str()); | 87 root->child_at(2)->child_at(1)->child_at(0)->frame_name().c_str()); |
| 88 | 88 |
| 89 // Navigate to about:blank, which should leave only the root node of the frame | 89 // Navigate to about:blank, which should leave only the root node of the frame |
| 90 // tree in the browser process. | 90 // tree in the browser process. |
| 91 NavigateToURL(shell(), test_server()->GetURL("files/title1.html")); | 91 NavigateToURL(shell(), test_server()->GetURL("files/title1.html")); |
| 92 | 92 |
| 93 root = wc->GetFrameTree()->root(); | 93 root = wc->GetFrameTree()->root(); |
| 94 EXPECT_EQ(0UL, root->child_count()); | 94 EXPECT_EQ(0UL, root->child_count()); |
| 95 EXPECT_EQ(std::string(), root->frame_name()); | 95 EXPECT_EQ(std::string(), root->frame_name()); |
| 96 } | 96 } |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 // wait for the previous navigation to stop. | 149 // wait for the previous navigation to stop. |
| 150 TestNavigationObserver tab_observer(wc, 1); | 150 TestNavigationObserver tab_observer(wc, 1); |
| 151 shell()->LoadURL(base_url.Resolve("blank.html")); | 151 shell()->LoadURL(base_url.Resolve("blank.html")); |
| 152 tab_observer.Wait(); | 152 tab_observer.Wait(); |
| 153 | 153 |
| 154 // The frame tree should now be cleared. | 154 // The frame tree should now be cleared. |
| 155 EXPECT_EQ(0UL, root->child_count()); | 155 EXPECT_EQ(0UL, root->child_count()); |
| 156 } | 156 } |
| 157 | 157 |
| 158 } // namespace content | 158 } // namespace content |
| OLD | NEW |