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/renderer_host/test_render_view_host.h" | 8 #include "content/browser/renderer_host/test_render_view_host.h" |
9 #include "content/common/input_messages.h" | 9 #include "content/common/input_messages.h" |
10 #include "content/common/view_messages.h" | 10 #include "content/common/view_messages.h" |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 // We use "//foo/bar" path (rather than "/foo/bar") since dragged paths are | 192 // We use "//foo/bar" path (rather than "/foo/bar") since dragged paths are |
193 // expected to be absolute on any platforms. | 193 // expected to be absolute on any platforms. |
194 base::FilePath highlighted_file_path(FILE_PATH_LITERAL("//tmp/foo.html")); | 194 base::FilePath highlighted_file_path(FILE_PATH_LITERAL("//tmp/foo.html")); |
195 base::FilePath dragged_file_path(FILE_PATH_LITERAL("//tmp/image.jpg")); | 195 base::FilePath dragged_file_path(FILE_PATH_LITERAL("//tmp/image.jpg")); |
196 base::FilePath sensitive_file_path(FILE_PATH_LITERAL("//etc/passwd")); | 196 base::FilePath sensitive_file_path(FILE_PATH_LITERAL("//etc/passwd")); |
197 GURL highlighted_file_url = net::FilePathToFileURL(highlighted_file_path); | 197 GURL highlighted_file_url = net::FilePathToFileURL(highlighted_file_path); |
198 GURL dragged_file_url = net::FilePathToFileURL(dragged_file_path); | 198 GURL dragged_file_url = net::FilePathToFileURL(dragged_file_path); |
199 GURL sensitive_file_url = net::FilePathToFileURL(sensitive_file_path); | 199 GURL sensitive_file_url = net::FilePathToFileURL(sensitive_file_path); |
200 dropped_data.url = highlighted_file_url; | 200 dropped_data.url = highlighted_file_url; |
201 dropped_data.filenames.push_back(DropData::FileInfo( | 201 dropped_data.filenames.push_back(DropData::FileInfo( |
202 UTF8ToUTF16(dragged_file_path.AsUTF8Unsafe()), string16())); | 202 UTF8ToUTF16(dragged_file_path.AsUTF8Unsafe()), base::string16())); |
203 | 203 |
204 rvh()->DragTargetDragEnter(dropped_data, client_point, screen_point, | 204 rvh()->DragTargetDragEnter(dropped_data, client_point, screen_point, |
205 blink::WebDragOperationNone, 0); | 205 blink::WebDragOperationNone, 0); |
206 | 206 |
207 int id = process()->GetID(); | 207 int id = process()->GetID(); |
208 ChildProcessSecurityPolicyImpl* policy = | 208 ChildProcessSecurityPolicyImpl* policy = |
209 ChildProcessSecurityPolicyImpl::GetInstance(); | 209 ChildProcessSecurityPolicyImpl::GetInstance(); |
210 | 210 |
211 EXPECT_FALSE(policy->CanRequestURL(id, highlighted_file_url)); | 211 EXPECT_FALSE(policy->CanRequestURL(id, highlighted_file_url)); |
212 EXPECT_FALSE(policy->CanReadFile(id, highlighted_file_path)); | 212 EXPECT_FALSE(policy->CanReadFile(id, highlighted_file_path)); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 } | 288 } |
289 | 289 |
290 TEST_F(RenderViewHostTest, RoutingIdSane) { | 290 TEST_F(RenderViewHostTest, RoutingIdSane) { |
291 EXPECT_EQ(test_rvh()->GetProcess(), | 291 EXPECT_EQ(test_rvh()->GetProcess(), |
292 test_rvh()->main_render_frame_host()->GetProcess()); | 292 test_rvh()->main_render_frame_host()->GetProcess()); |
293 EXPECT_NE(test_rvh()->GetRoutingID(), | 293 EXPECT_NE(test_rvh()->GetRoutingID(), |
294 test_rvh()->main_render_frame_host()->routing_id()); | 294 test_rvh()->main_render_frame_host()->routing_id()); |
295 } | 295 } |
296 | 296 |
297 } // namespace content | 297 } // namespace content |
OLD | NEW |