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 "content/browser/child_process_security_policy_impl.h" | 7 #include "content/browser/child_process_security_policy_impl.h" |
8 #include "content/browser/frame_host/render_frame_host_impl.h" | 8 #include "content/browser/frame_host/render_frame_host_impl.h" |
9 #include "content/browser/renderer_host/render_view_host_delegate_view.h" | 9 #include "content/browser/renderer_host/render_view_host_delegate_view.h" |
10 #include "content/common/input_messages.h" | 10 #include "content/common/input_messages.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 ContentBrowserClient* old_browser_client_; | 56 ContentBrowserClient* old_browser_client_; |
57 | 57 |
58 DISALLOW_COPY_AND_ASSIGN(RenderViewHostTest); | 58 DISALLOW_COPY_AND_ASSIGN(RenderViewHostTest); |
59 }; | 59 }; |
60 | 60 |
61 // All about URLs reported by the renderer should get rewritten to about:blank. | 61 // All about URLs reported by the renderer should get rewritten to about:blank. |
62 // See RenderViewHost::OnNavigate for a discussion. | 62 // See RenderViewHost::OnNavigate for a discussion. |
63 TEST_F(RenderViewHostTest, FilterAbout) { | 63 TEST_F(RenderViewHostTest, FilterAbout) { |
64 test_rvh()->SendNavigate(1, GURL("about:cache")); | 64 test_rvh()->SendNavigate(1, GURL("about:cache")); |
65 ASSERT_TRUE(controller().GetVisibleEntry()); | 65 ASSERT_TRUE(controller().GetVisibleEntry()); |
66 EXPECT_EQ(GURL(kAboutBlankURL), controller().GetVisibleEntry()->GetURL()); | 66 EXPECT_EQ(GURL(url::kAboutBlankURL), controller().GetVisibleEntry()->GetURL())
; |
67 } | 67 } |
68 | 68 |
69 // Create a full screen popup RenderWidgetHost and View. | 69 // Create a full screen popup RenderWidgetHost and View. |
70 TEST_F(RenderViewHostTest, CreateFullscreenWidget) { | 70 TEST_F(RenderViewHostTest, CreateFullscreenWidget) { |
71 int routing_id = process()->GetNextRoutingID(); | 71 int routing_id = process()->GetNextRoutingID(); |
72 test_rvh()->CreateNewFullscreenWidget(routing_id); | 72 test_rvh()->CreateNewFullscreenWidget(routing_id); |
73 } | 73 } |
74 | 74 |
75 // Makes sure that the RenderViewHost is not waiting for an unload ack when | 75 // Makes sure that the RenderViewHost is not waiting for an unload ack when |
76 // reloading a page. If this is not the case, when reloading, the contents may | 76 // reloading a page. If this is not the case, when reloading, the contents may |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 TEST_F(RenderViewHostTest, StartDragging) { | 145 TEST_F(RenderViewHostTest, StartDragging) { |
146 TestWebContents* web_contents = contents(); | 146 TestWebContents* web_contents = contents(); |
147 MockDraggingRenderViewHostDelegateView delegate_view; | 147 MockDraggingRenderViewHostDelegateView delegate_view; |
148 web_contents->set_delegate_view(&delegate_view); | 148 web_contents->set_delegate_view(&delegate_view); |
149 | 149 |
150 DropData drop_data; | 150 DropData drop_data; |
151 GURL file_url = GURL("file:///home/user/secrets.txt"); | 151 GURL file_url = GURL("file:///home/user/secrets.txt"); |
152 drop_data.url = file_url; | 152 drop_data.url = file_url; |
153 drop_data.html_base_url = file_url; | 153 drop_data.html_base_url = file_url; |
154 test_rvh()->TestOnStartDragging(drop_data); | 154 test_rvh()->TestOnStartDragging(drop_data); |
155 EXPECT_EQ(GURL(kAboutBlankURL), delegate_view.drag_url()); | 155 EXPECT_EQ(GURL(url::kAboutBlankURL), delegate_view.drag_url()); |
156 EXPECT_EQ(GURL(kAboutBlankURL), delegate_view.html_base_url()); | 156 EXPECT_EQ(GURL(url::kAboutBlankURL), delegate_view.html_base_url()); |
157 | 157 |
158 GURL http_url = GURL("http://www.domain.com/index.html"); | 158 GURL http_url = GURL("http://www.domain.com/index.html"); |
159 drop_data.url = http_url; | 159 drop_data.url = http_url; |
160 drop_data.html_base_url = http_url; | 160 drop_data.html_base_url = http_url; |
161 test_rvh()->TestOnStartDragging(drop_data); | 161 test_rvh()->TestOnStartDragging(drop_data); |
162 EXPECT_EQ(http_url, delegate_view.drag_url()); | 162 EXPECT_EQ(http_url, delegate_view.drag_url()); |
163 EXPECT_EQ(http_url, delegate_view.html_base_url()); | 163 EXPECT_EQ(http_url, delegate_view.html_base_url()); |
164 | 164 |
165 GURL https_url = GURL("https://www.domain.com/index.html"); | 165 GURL https_url = GURL("https://www.domain.com/index.html"); |
166 drop_data.url = https_url; | 166 drop_data.url = https_url; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 } | 238 } |
239 | 239 |
240 TEST_F(RenderViewHostTest, RoutingIdSane) { | 240 TEST_F(RenderViewHostTest, RoutingIdSane) { |
241 RenderFrameHostImpl* root_rfh = | 241 RenderFrameHostImpl* root_rfh = |
242 contents()->GetFrameTree()->root()->current_frame_host(); | 242 contents()->GetFrameTree()->root()->current_frame_host(); |
243 EXPECT_EQ(test_rvh()->GetProcess(), root_rfh->GetProcess()); | 243 EXPECT_EQ(test_rvh()->GetProcess(), root_rfh->GetProcess()); |
244 EXPECT_NE(test_rvh()->GetRoutingID(), root_rfh->routing_id()); | 244 EXPECT_NE(test_rvh()->GetRoutingID(), root_rfh->routing_id()); |
245 } | 245 } |
246 | 246 |
247 } // namespace content | 247 } // namespace content |
OLD | NEW |