| 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), |
| 67 controller().GetVisibleEntry()->GetURL()); |
| 67 } | 68 } |
| 68 | 69 |
| 69 // Create a full screen popup RenderWidgetHost and View. | 70 // Create a full screen popup RenderWidgetHost and View. |
| 70 TEST_F(RenderViewHostTest, CreateFullscreenWidget) { | 71 TEST_F(RenderViewHostTest, CreateFullscreenWidget) { |
| 71 int routing_id = process()->GetNextRoutingID(); | 72 int routing_id = process()->GetNextRoutingID(); |
| 72 test_rvh()->CreateNewFullscreenWidget(routing_id); | 73 test_rvh()->CreateNewFullscreenWidget(routing_id); |
| 73 } | 74 } |
| 74 | 75 |
| 75 // Makes sure that the RenderViewHost is not waiting for an unload ack when | 76 // 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 | 77 // 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) { | 146 TEST_F(RenderViewHostTest, StartDragging) { |
| 146 TestWebContents* web_contents = contents(); | 147 TestWebContents* web_contents = contents(); |
| 147 MockDraggingRenderViewHostDelegateView delegate_view; | 148 MockDraggingRenderViewHostDelegateView delegate_view; |
| 148 web_contents->set_delegate_view(&delegate_view); | 149 web_contents->set_delegate_view(&delegate_view); |
| 149 | 150 |
| 150 DropData drop_data; | 151 DropData drop_data; |
| 151 GURL file_url = GURL("file:///home/user/secrets.txt"); | 152 GURL file_url = GURL("file:///home/user/secrets.txt"); |
| 152 drop_data.url = file_url; | 153 drop_data.url = file_url; |
| 153 drop_data.html_base_url = file_url; | 154 drop_data.html_base_url = file_url; |
| 154 test_rvh()->TestOnStartDragging(drop_data); | 155 test_rvh()->TestOnStartDragging(drop_data); |
| 155 EXPECT_EQ(GURL(kAboutBlankURL), delegate_view.drag_url()); | 156 EXPECT_EQ(GURL(url::kAboutBlankURL), delegate_view.drag_url()); |
| 156 EXPECT_EQ(GURL(kAboutBlankURL), delegate_view.html_base_url()); | 157 EXPECT_EQ(GURL(url::kAboutBlankURL), delegate_view.html_base_url()); |
| 157 | 158 |
| 158 GURL http_url = GURL("http://www.domain.com/index.html"); | 159 GURL http_url = GURL("http://www.domain.com/index.html"); |
| 159 drop_data.url = http_url; | 160 drop_data.url = http_url; |
| 160 drop_data.html_base_url = http_url; | 161 drop_data.html_base_url = http_url; |
| 161 test_rvh()->TestOnStartDragging(drop_data); | 162 test_rvh()->TestOnStartDragging(drop_data); |
| 162 EXPECT_EQ(http_url, delegate_view.drag_url()); | 163 EXPECT_EQ(http_url, delegate_view.drag_url()); |
| 163 EXPECT_EQ(http_url, delegate_view.html_base_url()); | 164 EXPECT_EQ(http_url, delegate_view.html_base_url()); |
| 164 | 165 |
| 165 GURL https_url = GURL("https://www.domain.com/index.html"); | 166 GURL https_url = GURL("https://www.domain.com/index.html"); |
| 166 drop_data.url = https_url; | 167 drop_data.url = https_url; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 } | 239 } |
| 239 | 240 |
| 240 TEST_F(RenderViewHostTest, RoutingIdSane) { | 241 TEST_F(RenderViewHostTest, RoutingIdSane) { |
| 241 RenderFrameHostImpl* root_rfh = | 242 RenderFrameHostImpl* root_rfh = |
| 242 contents()->GetFrameTree()->root()->current_frame_host(); | 243 contents()->GetFrameTree()->root()->current_frame_host(); |
| 243 EXPECT_EQ(test_rvh()->GetProcess(), root_rfh->GetProcess()); | 244 EXPECT_EQ(test_rvh()->GetProcess(), root_rfh->GetProcess()); |
| 244 EXPECT_NE(test_rvh()->GetRoutingID(), root_rfh->routing_id()); | 245 EXPECT_NE(test_rvh()->GetRoutingID(), root_rfh->routing_id()); |
| 245 } | 246 } |
| 246 | 247 |
| 247 } // namespace content | 248 } // namespace content |
| OLD | NEW |