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

Side by Side Diff: components/mus/gesture_manager_unittest.cc

Issue 1362793002: Construct and check for mojo::Event's LocationData as needed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Also audit wheel_data and brush_data. Created 5 years, 2 months 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/mus/gesture_manager.h" 5 #include "components/mus/gesture_manager.h"
6 6
7 #include "base/strings/string_number_conversions.h" 7 #include "base/strings/string_number_conversions.h"
8 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
9 #include "components/mus/gesture_manager_delegate.h" 9 #include "components/mus/gesture_manager_delegate.h"
10 #include "components/mus/public/cpp/keys.h" 10 #include "components/mus/public/cpp/keys.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 } 61 }
62 62
63 mojo::EventPtr CreateEvent(mojo::EventType type, 63 mojo::EventPtr CreateEvent(mojo::EventType type,
64 int32_t pointer_id, 64 int32_t pointer_id,
65 int x, 65 int x,
66 int y) { 66 int y) {
67 mojo::EventPtr event(mojo::Event::New()); 67 mojo::EventPtr event(mojo::Event::New());
68 event->action = type; 68 event->action = type;
69 event->pointer_data = mojo::PointerData::New(); 69 event->pointer_data = mojo::PointerData::New();
70 event->pointer_data->pointer_id = pointer_id; 70 event->pointer_data->pointer_id = pointer_id;
71 event->pointer_data->location = mojo::LocationData::New();
71 event->pointer_data->location->x = x; 72 event->pointer_data->location->x = x;
72 event->pointer_data->location->y = y; 73 event->pointer_data->location->y = y;
73 return event.Pass(); 74 return event.Pass();
74 } 75 }
75 76
76 struct CompareViewByConnectionId { 77 struct CompareViewByConnectionId {
77 bool operator()(const ServerView* a, const ServerView* b) { 78 bool operator()(const ServerView* a, const ServerView* b) {
78 return a->id().connection_id < b->id().connection_id; 79 return a->id().connection_id < b->id().connection_id;
79 } 80 }
80 }; 81 };
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 EXPECT_EQ(std::string(), gesture_delegate_.GetAndClearDescriptions()); 460 EXPECT_EQ(std::string(), gesture_delegate_.GetAndClearDescriptions());
460 461
461 // Respond from the first view, with no gesture, should unblock cancel. 462 // Respond from the first view, with no gesture, should unblock cancel.
462 SetGestures(&root_, pointer_id, kInvalidGestureId, SetWith(5u, 10u), 463 SetGestures(&root_, pointer_id, kInvalidGestureId, SetWith(5u, 10u),
463 std::set<uint32_t>()); 464 std::set<uint32_t>());
464 EXPECT_EQ("cancel pointer=1 connection=1 chosen=false", 465 EXPECT_EQ("cancel pointer=1 connection=1 chosen=false",
465 gesture_delegate_.GetAndClearDescriptions()); 466 gesture_delegate_.GetAndClearDescriptions());
466 } 467 }
467 468
468 } // namespace mus 469 } // namespace mus
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698