Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(434)

Side by Side Diff: content/browser/renderer_host/render_view_host_unittest.cc

Issue 2485693003: Drag-and-drop: DragEnter, DragOver, DragLeave, DragDrop (Closed)
Patch Set: Rebased. More fixes. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <stdint.h> 5 #include <stdint.h>
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "content/browser/child_process_security_policy_impl.h" 10 #include "content/browser/child_process_security_policy_impl.h"
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 base::FilePath highlighted_file_path(FILE_PATH_LITERAL("//tmp/foo.html")); 166 base::FilePath highlighted_file_path(FILE_PATH_LITERAL("//tmp/foo.html"));
167 base::FilePath dragged_file_path(FILE_PATH_LITERAL("//tmp/image.jpg")); 167 base::FilePath dragged_file_path(FILE_PATH_LITERAL("//tmp/image.jpg"));
168 base::FilePath sensitive_file_path(FILE_PATH_LITERAL("//etc/passwd")); 168 base::FilePath sensitive_file_path(FILE_PATH_LITERAL("//etc/passwd"));
169 GURL highlighted_file_url = net::FilePathToFileURL(highlighted_file_path); 169 GURL highlighted_file_url = net::FilePathToFileURL(highlighted_file_path);
170 GURL dragged_file_url = net::FilePathToFileURL(dragged_file_path); 170 GURL dragged_file_url = net::FilePathToFileURL(dragged_file_path);
171 GURL sensitive_file_url = net::FilePathToFileURL(sensitive_file_path); 171 GURL sensitive_file_url = net::FilePathToFileURL(sensitive_file_path);
172 dropped_data.url = highlighted_file_url; 172 dropped_data.url = highlighted_file_url;
173 dropped_data.filenames.push_back( 173 dropped_data.filenames.push_back(
174 ui::FileInfo(dragged_file_path, base::FilePath())); 174 ui::FileInfo(dragged_file_path, base::FilePath()));
175 175
176 rvh()->FilterDropData(&dropped_data); 176 // TODO(paulmeyer): These will need to target the correct specific
177 rvh()->DragTargetDragEnter(dropped_data, client_point, screen_point, 177 // RenderWidgetHost to work with OOPIFs. See crbug.com/647249.
178 blink::WebDragOperationNone, 0); 178 rvh()->GetWidget()->FilterDropData(&dropped_data);
179 rvh()->GetWidget()->DragTargetDragEnter(
180 dropped_data, client_point, screen_point, blink::WebDragOperationNone, 0);
179 181
180 int id = process()->GetID(); 182 int id = process()->GetID();
181 ChildProcessSecurityPolicyImpl* policy = 183 ChildProcessSecurityPolicyImpl* policy =
182 ChildProcessSecurityPolicyImpl::GetInstance(); 184 ChildProcessSecurityPolicyImpl::GetInstance();
183 185
184 // Permissions are not granted at DragEnter. 186 // Permissions are not granted at DragEnter.
185 EXPECT_FALSE(policy->CanRequestURL(id, highlighted_file_url)); 187 EXPECT_FALSE(policy->CanRequestURL(id, highlighted_file_url));
186 EXPECT_FALSE(policy->CanReadFile(id, highlighted_file_path)); 188 EXPECT_FALSE(policy->CanReadFile(id, highlighted_file_path));
187 EXPECT_FALSE(policy->CanRequestURL(id, dragged_file_url)); 189 EXPECT_FALSE(policy->CanRequestURL(id, dragged_file_url));
188 EXPECT_FALSE(policy->CanReadFile(id, dragged_file_path)); 190 EXPECT_FALSE(policy->CanReadFile(id, dragged_file_path));
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 const std::string data_url = "data:image/gif;base64," 305 const std::string data_url = "data:image/gif;base64,"
304 "R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs="; 306 "R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs=";
305 307
306 tester->Reset(); 308 tester->Reset();
307 tester->Test(data_url); 309 tester->Test(data_url);
308 EXPECT_EQ(tester->UrlString(), data_url); 310 EXPECT_EQ(tester->UrlString(), data_url);
309 EXPECT_TRUE(tester->IsDownloaded()); 311 EXPECT_TRUE(tester->IsDownloaded());
310 } 312 }
311 313
312 } // namespace content 314 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_view_host_impl.cc ('k') | content/browser/renderer_host/render_widget_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698