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 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 gfx::Point screen_point; | 183 gfx::Point screen_point; |
184 // We use "//foo/bar" path (rather than "/foo/bar") since dragged paths are | 184 // We use "//foo/bar" path (rather than "/foo/bar") since dragged paths are |
185 // expected to be absolute on any platforms. | 185 // expected to be absolute on any platforms. |
186 base::FilePath highlighted_file_path(FILE_PATH_LITERAL("//tmp/foo.html")); | 186 base::FilePath highlighted_file_path(FILE_PATH_LITERAL("//tmp/foo.html")); |
187 base::FilePath dragged_file_path(FILE_PATH_LITERAL("//tmp/image.jpg")); | 187 base::FilePath dragged_file_path(FILE_PATH_LITERAL("//tmp/image.jpg")); |
188 base::FilePath sensitive_file_path(FILE_PATH_LITERAL("//etc/passwd")); | 188 base::FilePath sensitive_file_path(FILE_PATH_LITERAL("//etc/passwd")); |
189 GURL highlighted_file_url = net::FilePathToFileURL(highlighted_file_path); | 189 GURL highlighted_file_url = net::FilePathToFileURL(highlighted_file_path); |
190 GURL dragged_file_url = net::FilePathToFileURL(dragged_file_path); | 190 GURL dragged_file_url = net::FilePathToFileURL(dragged_file_path); |
191 GURL sensitive_file_url = net::FilePathToFileURL(sensitive_file_path); | 191 GURL sensitive_file_url = net::FilePathToFileURL(sensitive_file_path); |
192 dropped_data.url = highlighted_file_url; | 192 dropped_data.url = highlighted_file_url; |
193 dropped_data.filenames.push_back(DropData::FileInfo( | 193 dropped_data.filenames.push_back( |
194 base::UTF8ToUTF16(dragged_file_path.AsUTF8Unsafe()), base::string16())); | 194 ui::FileInfo(dragged_file_path, base::FilePath())); |
195 | 195 |
196 rvh()->DragTargetDragEnter(dropped_data, client_point, screen_point, | 196 rvh()->DragTargetDragEnter(dropped_data, client_point, screen_point, |
197 blink::WebDragOperationNone, 0); | 197 blink::WebDragOperationNone, 0); |
198 | 198 |
199 int id = process()->GetID(); | 199 int id = process()->GetID(); |
200 ChildProcessSecurityPolicyImpl* policy = | 200 ChildProcessSecurityPolicyImpl* policy = |
201 ChildProcessSecurityPolicyImpl::GetInstance(); | 201 ChildProcessSecurityPolicyImpl::GetInstance(); |
202 | 202 |
203 EXPECT_FALSE(policy->CanRequestURL(id, highlighted_file_url)); | 203 EXPECT_FALSE(policy->CanRequestURL(id, highlighted_file_url)); |
204 EXPECT_FALSE(policy->CanReadFile(id, highlighted_file_path)); | 204 EXPECT_FALSE(policy->CanReadFile(id, highlighted_file_path)); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 } | 280 } |
281 | 281 |
282 TEST_F(RenderViewHostTest, RoutingIdSane) { | 282 TEST_F(RenderViewHostTest, RoutingIdSane) { |
283 RenderFrameHostImpl* root_rfh = | 283 RenderFrameHostImpl* root_rfh = |
284 contents()->GetFrameTree()->root()->current_frame_host(); | 284 contents()->GetFrameTree()->root()->current_frame_host(); |
285 EXPECT_EQ(test_rvh()->GetProcess(), root_rfh->GetProcess()); | 285 EXPECT_EQ(test_rvh()->GetProcess(), root_rfh->GetProcess()); |
286 EXPECT_NE(test_rvh()->GetRoutingID(), root_rfh->routing_id()); | 286 EXPECT_NE(test_rvh()->GetRoutingID(), root_rfh->routing_id()); |
287 } | 287 } |
288 | 288 |
289 } // namespace content | 289 } // namespace content |
OLD | NEW |