OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/path_service.h" | 5 #include "base/path_service.h" |
6 #include "base/strings/utf_string_conversions.h" | 6 #include "base/strings/utf_string_conversions.h" |
7 #include "base/time/time.h" | 7 #include "base/time/time.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "content/browser/frame_host/render_frame_host_impl.h" | |
10 #include "content/browser/renderer_host/render_view_host_impl.h" | 9 #include "content/browser/renderer_host/render_view_host_impl.h" |
11 #include "content/browser/web_contents/web_contents_impl.h" | 10 #include "content/browser/web_contents/web_contents_impl.h" |
12 #include "content/common/view_messages.h" | 11 #include "content/common/view_messages.h" |
13 #include "content/public/browser/notification_types.h" | 12 #include "content/public/browser/notification_types.h" |
14 #include "content/public/browser/web_contents_observer.h" | 13 #include "content/public/browser/web_contents_observer.h" |
15 #include "content/public/common/content_paths.h" | 14 #include "content/public/common/content_paths.h" |
16 #include "content/public/test/browser_test_utils.h" | 15 #include "content/public/test/browser_test_utils.h" |
17 #include "content/shell/browser/shell.h" | 16 #include "content/shell/browser/shell.h" |
18 #include "content/test/content_browser_test.h" | 17 #include "content/test/content_browser_test.h" |
19 #include "content/test/content_browser_test_utils.h" | 18 #include "content/test/content_browser_test_utils.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 } | 93 } |
95 | 94 |
96 // This test ensures a RenderFrameHost object is created for the top level frame | 95 // This test ensures a RenderFrameHost object is created for the top level frame |
97 // in each RenderViewHost. | 96 // in each RenderViewHost. |
98 IN_PROC_BROWSER_TEST_F(RenderViewHostTest, BasicRenderFrameHost) { | 97 IN_PROC_BROWSER_TEST_F(RenderViewHostTest, BasicRenderFrameHost) { |
99 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 98 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
100 | 99 |
101 GURL test_url = embedded_test_server()->GetURL("/simple_page.html"); | 100 GURL test_url = embedded_test_server()->GetURL("/simple_page.html"); |
102 NavigateToURL(shell(), test_url); | 101 NavigateToURL(shell(), test_url); |
103 | 102 |
104 FrameTreeNode* old_root = static_cast<WebContentsImpl*>( | 103 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( |
105 shell()->web_contents())->GetFrameTree()->root(); | 104 shell()->web_contents()->GetRenderViewHost()); |
106 EXPECT_TRUE(old_root->current_frame_host()); | 105 EXPECT_TRUE(rvh->main_render_frame_host()); |
107 | 106 |
108 ShellAddedObserver new_shell_observer; | 107 ShellAddedObserver new_shell_observer; |
109 EXPECT_TRUE(ExecuteScript(shell()->web_contents(), "window.open();")); | 108 EXPECT_TRUE(ExecuteScript(shell()->web_contents(), "window.open();")); |
110 Shell* new_shell = new_shell_observer.GetShell(); | 109 Shell* new_shell = new_shell_observer.GetShell(); |
111 FrameTreeNode* new_root = static_cast<WebContentsImpl*>( | 110 RenderViewHostImpl* new_rvh = static_cast<RenderViewHostImpl*>( |
112 new_shell->web_contents())->GetFrameTree()->root(); | 111 new_shell->web_contents()->GetRenderViewHost()); |
113 | 112 |
114 EXPECT_TRUE(new_root->current_frame_host()); | 113 EXPECT_TRUE(new_rvh->main_render_frame_host()); |
115 EXPECT_NE(old_root->current_frame_host()->routing_id(), | 114 EXPECT_NE(rvh->main_render_frame_host()->routing_id(), |
116 new_root->current_frame_host()->routing_id()); | 115 new_rvh->main_render_frame_host()->routing_id()); |
117 } | 116 } |
118 | 117 |
119 } // namespace content | 118 } // namespace content |
OLD | NEW |