| 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 FilePath highlighted_file_path(FILE_PATH_LITERAL("/tmp/foo.html")); | 158 // We use "//foo/bar" path (rather than "/foo/bar") since dragged paths are |
| 159 FilePath dragged_file_path(FILE_PATH_LITERAL("/tmp/image.jpg")); | 159 // expected to be absolute on any platforms. |
| 160 FilePath sensitive_file_path(FILE_PATH_LITERAL("/etc/passwd")); | 160 FilePath highlighted_file_path(FILE_PATH_LITERAL("//tmp/foo.html")); |
| 161 FilePath dragged_file_path(FILE_PATH_LITERAL("//tmp/image.jpg")); |
| 162 FilePath sensitive_file_path(FILE_PATH_LITERAL("//etc/passwd")); |
| 161 GURL highlighted_file_url = net::FilePathToFileURL(highlighted_file_path); | 163 GURL highlighted_file_url = net::FilePathToFileURL(highlighted_file_path); |
| 162 GURL dragged_file_url = net::FilePathToFileURL(dragged_file_path); | 164 GURL dragged_file_url = net::FilePathToFileURL(dragged_file_path); |
| 163 GURL sensitive_file_url = net::FilePathToFileURL(sensitive_file_path); | 165 GURL sensitive_file_url = net::FilePathToFileURL(sensitive_file_path); |
| 164 dropped_data.url = highlighted_file_url; | 166 dropped_data.url = highlighted_file_url; |
| 165 dropped_data.filenames.push_back(WebDropData::FileInfo( | 167 dropped_data.filenames.push_back(WebDropData::FileInfo( |
| 166 UTF8ToUTF16(dragged_file_path.AsUTF8Unsafe()), string16())); | 168 UTF8ToUTF16(dragged_file_path.AsUTF8Unsafe()), string16())); |
| 167 | 169 |
| 168 rvh()->DragTargetDragEnter(dropped_data, client_point, screen_point, | 170 rvh()->DragTargetDragEnter(dropped_data, client_point, screen_point, |
| 169 WebKit::WebDragOperationNone, 0); | 171 WebKit::WebDragOperationNone, 0); |
| 170 | 172 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 // the code actually expects it to have at least one int para, this this | 216 // the code actually expects it to have at least one int para, this this |
| 215 // bogus message will not fail at de-serialization but should fail in | 217 // bogus message will not fail at de-serialization but should fail in |
| 216 // OnMsgInputEventAck() processing. | 218 // OnMsgInputEventAck() processing. |
| 217 IPC::Message message(0, ViewHostMsg_HandleInputEvent_ACK::ID, | 219 IPC::Message message(0, ViewHostMsg_HandleInputEvent_ACK::ID, |
| 218 IPC::Message::PRIORITY_NORMAL); | 220 IPC::Message::PRIORITY_NORMAL); |
| 219 test_rvh()->OnMessageReceived(message); | 221 test_rvh()->OnMessageReceived(message); |
| 220 EXPECT_EQ(1, process()->bad_msg_count()); | 222 EXPECT_EQ(1, process()->bad_msg_count()); |
| 221 } | 223 } |
| 222 | 224 |
| 223 #endif | 225 #endif |
| OLD | NEW |