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