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/utf_string_conversions.h" | 5 #include "base/utf_string_conversions.h" |
6 #include "content/browser/child_process_security_policy_impl.h" | 6 #include "content/browser/child_process_security_policy_impl.h" |
7 #include "content/browser/renderer_host/test_render_view_host.h" | 7 #include "content/browser/renderer_host/test_render_view_host.h" |
8 #include "content/browser/web_contents/navigation_controller_impl.h" | 8 #include "content/browser/web_contents/navigation_controller_impl.h" |
9 #include "content/browser/web_contents/test_web_contents.h" | 9 #include "content/browser/web_contents/test_web_contents.h" |
10 #include "content/common/view_messages.h" | 10 #include "content/common/view_messages.h" |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 drop_data.html_base_url = http_url; | 148 drop_data.html_base_url = http_url; |
149 test_rvh()->TestOnMsgStartDragging(drop_data); | 149 test_rvh()->TestOnMsgStartDragging(drop_data); |
150 EXPECT_EQ(javascript_url, delegate_view.drag_url()); | 150 EXPECT_EQ(javascript_url, delegate_view.drag_url()); |
151 EXPECT_EQ(http_url, delegate_view.html_base_url()); | 151 EXPECT_EQ(http_url, delegate_view.html_base_url()); |
152 } | 152 } |
153 | 153 |
154 TEST_F(RenderViewHostTest, DragEnteredFileURLsStillBlocked) { | 154 TEST_F(RenderViewHostTest, DragEnteredFileURLsStillBlocked) { |
155 WebDropData dropped_data; | 155 WebDropData dropped_data; |
156 gfx::Point client_point; | 156 gfx::Point client_point; |
157 gfx::Point screen_point; | 157 gfx::Point screen_point; |
158 // We use "//foo/bar" path (rather than "/foo/bar") since dragged paths are | 158 FilePath highlighted_file_path(FILE_PATH_LITERAL("/tmp/foo.html")); |
159 // expected to be absolute on any platforms. | 159 FilePath dragged_file_path(FILE_PATH_LITERAL("/tmp/image.jpg")); |
160 FilePath highlighted_file_path(FILE_PATH_LITERAL("//tmp/foo.html")); | 160 FilePath sensitive_file_path(FILE_PATH_LITERAL("/etc/passwd")); |
161 FilePath dragged_file_path(FILE_PATH_LITERAL("//tmp/image.jpg")); | |
162 FilePath sensitive_file_path(FILE_PATH_LITERAL("//etc/passwd")); | |
163 GURL highlighted_file_url = net::FilePathToFileURL(highlighted_file_path); | 161 GURL highlighted_file_url = net::FilePathToFileURL(highlighted_file_path); |
164 GURL dragged_file_url = net::FilePathToFileURL(dragged_file_path); | 162 GURL dragged_file_url = net::FilePathToFileURL(dragged_file_path); |
165 GURL sensitive_file_url = net::FilePathToFileURL(sensitive_file_path); | 163 GURL sensitive_file_url = net::FilePathToFileURL(sensitive_file_path); |
166 dropped_data.url = highlighted_file_url; | 164 dropped_data.url = highlighted_file_url; |
167 dropped_data.filenames.push_back(WebDropData::FileInfo( | 165 dropped_data.filenames.push_back(WebDropData::FileInfo( |
168 UTF8ToUTF16(dragged_file_path.AsUTF8Unsafe()), string16())); | 166 UTF8ToUTF16(dragged_file_path.AsUTF8Unsafe()), string16())); |
169 | 167 |
170 rvh()->DragTargetDragEnter(dropped_data, client_point, screen_point, | 168 rvh()->DragTargetDragEnter(dropped_data, client_point, screen_point, |
171 WebKit::WebDragOperationNone, 0); | 169 WebKit::WebDragOperationNone, 0); |
172 | 170 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 // the code actually expects it to have at least one int para, this this | 214 // the code actually expects it to have at least one int para, this this |
217 // bogus message will not fail at de-serialization but should fail in | 215 // bogus message will not fail at de-serialization but should fail in |
218 // OnMsgInputEventAck() processing. | 216 // OnMsgInputEventAck() processing. |
219 IPC::Message message(0, ViewHostMsg_HandleInputEvent_ACK::ID, | 217 IPC::Message message(0, ViewHostMsg_HandleInputEvent_ACK::ID, |
220 IPC::Message::PRIORITY_NORMAL); | 218 IPC::Message::PRIORITY_NORMAL); |
221 test_rvh()->OnMessageReceived(message); | 219 test_rvh()->OnMessageReceived(message); |
222 EXPECT_EQ(1, process()->bad_msg_count()); | 220 EXPECT_EQ(1, process()->bad_msg_count()); |
223 } | 221 } |
224 | 222 |
225 #endif | 223 #endif |
OLD | NEW |