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 "content/browser/child_process_security_policy.h" | 5 #include "content/browser/child_process_security_policy_impl.h" |
6 #include "content/browser/renderer_host/test_render_view_host.h" | 6 #include "content/browser/renderer_host/test_render_view_host.h" |
7 #include "content/browser/tab_contents/navigation_controller_impl.h" | 7 #include "content/browser/tab_contents/navigation_controller_impl.h" |
8 #include "content/browser/tab_contents/test_tab_contents.h" | 8 #include "content/browser/tab_contents/test_tab_contents.h" |
9 #include "content/common/view_messages.h" | 9 #include "content/common/view_messages.h" |
10 #include "content/public/browser/navigation_entry.h" | 10 #include "content/public/browser/navigation_entry.h" |
11 #include "content/public/common/page_transition_types.h" | 11 #include "content/public/common/page_transition_types.h" |
12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDragOperation.h" | 12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDragOperation.h" |
13 #include "webkit/glue/webdropdata.h" | 13 #include "webkit/glue/webdropdata.h" |
14 | 14 |
15 class RenderViewHostTest : public RenderViewHostTestHarness { | 15 class RenderViewHostTest : public RenderViewHostTestHarness { |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 } | 145 } |
146 | 146 |
147 TEST_F(RenderViewHostTest, DragEnteredFileURLsStillBlocked) { | 147 TEST_F(RenderViewHostTest, DragEnteredFileURLsStillBlocked) { |
148 WebDropData dropped_data; | 148 WebDropData dropped_data; |
149 gfx::Point client_point; | 149 gfx::Point client_point; |
150 gfx::Point screen_point; | 150 gfx::Point screen_point; |
151 GURL file_url = GURL("file:///etc/passwd"); | 151 GURL file_url = GURL("file:///etc/passwd"); |
152 dropped_data.url = file_url; | 152 dropped_data.url = file_url; |
153 rvh()->DragTargetDragEnter(dropped_data, client_point, screen_point, | 153 rvh()->DragTargetDragEnter(dropped_data, client_point, screen_point, |
154 WebKit::WebDragOperationNone); | 154 WebKit::WebDragOperationNone); |
155 EXPECT_FALSE(ChildProcessSecurityPolicy::GetInstance()->CanRequestURL( | 155 EXPECT_FALSE(ChildProcessSecurityPolicyImpl::GetInstance()->CanRequestURL( |
156 process()->GetID(), file_url)); | 156 process()->GetID(), file_url)); |
157 } | 157 } |
158 | 158 |
159 // The test that follow trigger DCHECKS in debug build. | 159 // The test that follow trigger DCHECKS in debug build. |
160 #if defined(NDEBUG) && !defined(DCHECK_ALWAYS_ON) | 160 #if defined(NDEBUG) && !defined(DCHECK_ALWAYS_ON) |
161 | 161 |
162 // Test that when we fail to de-serialize a message, RenderViewHost calls the | 162 // Test that when we fail to de-serialize a message, RenderViewHost calls the |
163 // ReceivedBadMessage() handler. | 163 // ReceivedBadMessage() handler. |
164 TEST_F(RenderViewHostTest, BadMessageHandlerRenderViewHost) { | 164 TEST_F(RenderViewHostTest, BadMessageHandlerRenderViewHost) { |
165 EXPECT_EQ(0, process()->bad_msg_count()); | 165 EXPECT_EQ(0, process()->bad_msg_count()); |
(...skipping 24 matching lines...) Expand all Loading... |
190 // the code actually expects it to have at least one int para, this this | 190 // the code actually expects it to have at least one int para, this this |
191 // bogus message will not fail at de-serialization but should fail in | 191 // bogus message will not fail at de-serialization but should fail in |
192 // OnMsgInputEventAck() processing. | 192 // OnMsgInputEventAck() processing. |
193 IPC::Message message(0, ViewHostMsg_HandleInputEvent_ACK::ID, | 193 IPC::Message message(0, ViewHostMsg_HandleInputEvent_ACK::ID, |
194 IPC::Message::PRIORITY_NORMAL); | 194 IPC::Message::PRIORITY_NORMAL); |
195 rvh()->TestOnMessageReceived(message); | 195 rvh()->TestOnMessageReceived(message); |
196 EXPECT_EQ(1, process()->bad_msg_count()); | 196 EXPECT_EQ(1, process()->bad_msg_count()); |
197 } | 197 } |
198 | 198 |
199 #endif | 199 #endif |
OLD | NEW |