| 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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 gfx::Point screen_point; | 167 gfx::Point screen_point; |
| 168 FilePath highlighted_file_path(FILE_PATH_LITERAL("/etc/passwd")); | 168 FilePath highlighted_file_path(FILE_PATH_LITERAL("/etc/passwd")); |
| 169 FilePath selected_file_path(FILE_PATH_LITERAL("/tmp/image.jpg")); | 169 FilePath selected_file_path(FILE_PATH_LITERAL("/tmp/image.jpg")); |
| 170 GURL highlighted_file_url = net::FilePathToFileURL(highlighted_file_path); | 170 GURL highlighted_file_url = net::FilePathToFileURL(highlighted_file_path); |
| 171 GURL selected_file_url = net::FilePathToFileURL(selected_file_path); | 171 GURL selected_file_url = net::FilePathToFileURL(selected_file_path); |
| 172 dropped_data.url = highlighted_file_url; | 172 dropped_data.url = highlighted_file_url; |
| 173 dropped_data.filenames.push_back(WebDropData::FileInfo( | 173 dropped_data.filenames.push_back(WebDropData::FileInfo( |
| 174 UTF8ToUTF16(selected_file_path.AsUTF8Unsafe()), string16())); | 174 UTF8ToUTF16(selected_file_path.AsUTF8Unsafe()), string16())); |
| 175 | 175 |
| 176 rvh()->DragTargetDragEnter(dropped_data, client_point, screen_point, | 176 rvh()->DragTargetDragEnter(dropped_data, client_point, screen_point, |
| 177 WebKit::WebDragOperationNone); | 177 WebKit::WebDragOperationNone, 0); |
| 178 | 178 |
| 179 int id = process()->GetID(); | 179 int id = process()->GetID(); |
| 180 ChildProcessSecurityPolicyImpl* policy = | 180 ChildProcessSecurityPolicyImpl* policy = |
| 181 ChildProcessSecurityPolicyImpl::GetInstance(); | 181 ChildProcessSecurityPolicyImpl::GetInstance(); |
| 182 | 182 |
| 183 EXPECT_FALSE(policy->CanRequestURL(id, highlighted_file_url)); | 183 EXPECT_FALSE(policy->CanRequestURL(id, highlighted_file_url)); |
| 184 EXPECT_FALSE(policy->CanReadFile(id, highlighted_file_path)); | 184 EXPECT_FALSE(policy->CanReadFile(id, highlighted_file_path)); |
| 185 EXPECT_FALSE(policy->CanRequestURL(id, selected_file_url)); | 185 EXPECT_FALSE(policy->CanRequestURL(id, selected_file_url)); |
| 186 EXPECT_TRUE(policy->CanReadFile(id, selected_file_path)); | 186 EXPECT_TRUE(policy->CanReadFile(id, selected_file_path)); |
| 187 } | 187 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 // the code actually expects it to have at least one int para, this this | 220 // the code actually expects it to have at least one int para, this this |
| 221 // bogus message will not fail at de-serialization but should fail in | 221 // bogus message will not fail at de-serialization but should fail in |
| 222 // OnMsgInputEventAck() processing. | 222 // OnMsgInputEventAck() processing. |
| 223 IPC::Message message(0, ViewHostMsg_HandleInputEvent_ACK::ID, | 223 IPC::Message message(0, ViewHostMsg_HandleInputEvent_ACK::ID, |
| 224 IPC::Message::PRIORITY_NORMAL); | 224 IPC::Message::PRIORITY_NORMAL); |
| 225 test_rvh()->OnMessageReceived(message); | 225 test_rvh()->OnMessageReceived(message); |
| 226 EXPECT_EQ(1, process()->bad_msg_count()); | 226 EXPECT_EQ(1, process()->bad_msg_count()); |
| 227 } | 227 } |
| 228 | 228 |
| 229 #endif | 229 #endif |
| OLD | NEW |