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/time.h" | 6 #include "base/time.h" |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "content/browser/renderer_host/render_view_host_impl.h" | 9 #include "content/browser/renderer_host/render_view_host_impl.h" |
10 #include "content/browser/web_contents/web_contents_impl.h" | 10 #include "content/browser/web_contents/web_contents_impl.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
85 | 85 |
86 // But should be set to the original page when reading MHTML. | 86 // But should be set to the original page when reading MHTML. |
87 base::FilePath content_test_data_dir; | 87 base::FilePath content_test_data_dir; |
88 ASSERT_TRUE(PathService::Get(DIR_TEST_DATA, &content_test_data_dir)); | 88 ASSERT_TRUE(PathService::Get(DIR_TEST_DATA, &content_test_data_dir)); |
89 test_url = net::FilePathToFileURL( | 89 test_url = net::FilePathToFileURL( |
90 content_test_data_dir.AppendASCII("google.mht")); | 90 content_test_data_dir.AppendASCII("google.mht")); |
91 NavigateToURL(shell(), test_url); | 91 NavigateToURL(shell(), test_url); |
92 EXPECT_EQ("http://www.google.com/", observer.base_url().spec()); | 92 EXPECT_EQ("http://www.google.com/", observer.base_url().spec()); |
93 } | 93 } |
94 | 94 |
95 // This test ensures a RenderFrameHost object is created for the top level frame | |
96 // in each RenderViewHost. | |
97 IN_PROC_BROWSER_TEST_F(RenderViewHostTest, BasicRenderFrameHost) { | |
98 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | |
99 | |
100 GURL test_url = embedded_test_server()->GetURL("/simple_page.html"); | |
101 NavigateToURL(shell(), test_url); | |
102 | |
103 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( | |
104 shell()->web_contents()->GetRenderViewHost()); | |
105 EXPECT_TRUE(rvh->main_render_frame_host_.get()); | |
106 | |
107 // Since we allocate the routing ids for the RenderViewHost and the top-level | |
108 // RenderFrameHost together, we expect them to be sequential. This will not | |
109 // be true for subframes or if we change how routing ids are allocated. | |
110 EXPECT_EQ(rvh->GetRoutingID() + 1, | |
jam
2013/05/31 17:40:04
nit: ditto from my comment about the other test.
nasko
2013/05/31 17:58:30
See the other test comment.
| |
111 rvh->main_render_frame_host_->routing_id()); | |
112 | |
113 ShellAddedObserver new_shell_observer; | |
114 EXPECT_TRUE(ExecuteScript(shell()->web_contents(), "window.open();")); | |
115 Shell* new_shell = new_shell_observer.GetShell(); | |
116 RenderViewHostImpl* new_rvh = static_cast<RenderViewHostImpl*>( | |
117 new_shell->web_contents()->GetRenderViewHost()); | |
118 | |
119 EXPECT_TRUE(new_rvh->main_render_frame_host_.get()); | |
120 EXPECT_EQ(new_rvh->GetRoutingID() + 1, | |
121 new_rvh->main_render_frame_host_->routing_id()); | |
jam
2013/05/31 17:40:04
ditto
nasko
2013/05/31 17:58:30
See the other test comment.
| |
122 EXPECT_NE(rvh->main_render_frame_host_->routing_id(), | |
123 new_rvh->main_render_frame_host_->routing_id()); | |
124 } | |
125 | |
95 } // namespace content | 126 } // namespace content |
OLD | NEW |