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

Unified Diff: chrome/browser/ui/views/drag_and_drop_interactive_uitest.cc

Issue 2505183002: Have tests verify clientX/Y and pageX/Y properties in drag-and-drop DOM events. (Closed)
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/test/data/drag_and_drop/event_monitoring.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/drag_and_drop_interactive_uitest.cc
diff --git a/chrome/browser/ui/views/drag_and_drop_interactive_uitest.cc b/chrome/browser/ui/views/drag_and_drop_interactive_uitest.cc
index 05cc4a8418e18f016d09da7205b4d44d1a2dffc3..8982132aea736f5026d5a8728abafe5df2ab8a95 100644
--- a/chrome/browser/ui/views/drag_and_drop_interactive_uitest.cc
+++ b/chrome/browser/ui/views/drag_and_drop_interactive_uitest.cc
@@ -150,7 +150,7 @@ class DragAndDropSimulator {
gfx::Point root_location = web_contents_relative_location;
aura::Window::ConvertPointToTarget(view, view->GetRootWindow(),
&root_location);
- *out_event_location = root_location;
+ *out_event_root_location = root_location;
Łukasz Anforowicz 2016/11/16 23:02:38 Ooops... :->
}
// These are ui::DropTargetEvent::source_operations_ being sent when manually
@@ -335,6 +335,10 @@ class DOMDragEventVerifier {
public:
DOMDragEventVerifier() {}
+ void set_expected_client_position(const std::string& value) {
+ expected_client_position_ = value;
+ }
+
void set_expected_drop_effect(const std::string& value) {
expected_drop_effect_ = value;
}
@@ -347,14 +351,20 @@ class DOMDragEventVerifier {
expected_mime_types_ = value;
}
+ void set_expected_page_position(const std::string& value) {
+ expected_page_position_ = value;
+ }
+
// Returns a matcher that will match a std::string (drag event data - e.g.
// one returned by DOMDragEventWaiter::WaitForNextMatchingEvent) if it matches
// the expectations of this DOMDragEventVerifier.
testing::Matcher<std::string> Matches() const {
return testing::AllOf(
+ FieldMatches("client_position", expected_client_position_),
FieldMatches("drop_effect", expected_drop_effect_),
FieldMatches("effect_allowed", expected_effect_allowed_),
- FieldMatches("mime_types", expected_mime_types_));
+ FieldMatches("mime_types", expected_mime_types_),
+ FieldMatches("page_position", expected_page_position_));
}
private:
@@ -371,6 +381,8 @@ class DOMDragEventVerifier {
std::string expected_drop_effect_ = "<no expectation>";
std::string expected_effect_allowed_ = "<no expectation>";
std::string expected_mime_types_ = "<no expectation>";
+ std::string expected_client_position_ = "<no expectation>";
+ std::string expected_page_position_ = "<no expectation>";
DISALLOW_COPY_AND_ASSIGN(DOMDragEventVerifier);
};
@@ -571,9 +583,11 @@ IN_PROC_BROWSER_TEST_P(DragAndDropBrowserTest, DropTextFromOutside) {
// Setup test expectations.
DOMDragEventVerifier expected_dom_event_data;
+ expected_dom_event_data.set_expected_client_position("(100, 100)");
expected_dom_event_data.set_expected_drop_effect("none");
expected_dom_event_data.set_expected_effect_allowed("all");
expected_dom_event_data.set_expected_mime_types("text/plain");
+ expected_dom_event_data.set_expected_page_position("(100, 100)");
// Drag text from outside the browser into/over the right frame.
{
@@ -604,10 +618,12 @@ IN_PROC_BROWSER_TEST_P(DragAndDropBrowserTest, DragStartInFrame) {
// Setup test expectations.
// (dragstart event handler in image_source.html is asking for "copy" only).
DOMDragEventVerifier expected_dom_event_data;
+ expected_dom_event_data.set_expected_client_position("(100, 100)");
expected_dom_event_data.set_expected_drop_effect("none");
expected_dom_event_data.set_expected_effect_allowed("copy");
expected_dom_event_data.set_expected_mime_types(
"Files,text/html,text/uri-list");
+ expected_dom_event_data.set_expected_page_position("(100, 100)");
// Start the drag in the left frame.
DragStartWaiter drag_start_waiter(web_contents());
« no previous file with comments | « no previous file | chrome/test/data/drag_and_drop/event_monitoring.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698