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

Side by Side Diff: ui/android/view_android_unittests.cc

Issue 2770613002: Forward GenericMotionEvent to EventForwarder (Closed)
Patch Set: comments Created 3 years, 8 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
« no previous file with comments | « ui/android/view_android.cc ('k') | ui/android/view_client.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 "testing/gtest/include/gtest/gtest.h" 5 #include "testing/gtest/include/gtest/gtest.h"
6 #include "ui/android/event_forwarder.h" 6 #include "ui/android/event_forwarder.h"
7 #include "ui/android/view_android.h" 7 #include "ui/android/view_android.h"
8 #include "ui/android/view_client.h" 8 #include "ui/android/view_client.h"
9 #include "ui/events/android/motion_event_android.h" 9 #include "ui/events/android/motion_event_android.h"
10 10
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 45
46 void Reset() { 46 void Reset() {
47 client1_.Reset(); 47 client1_.Reset();
48 client2_.Reset(); 48 client2_.Reset();
49 client3_.Reset(); 49 client3_.Reset();
50 } 50 }
51 51
52 void GenerateTouchEventAt(float x, float y) { 52 void GenerateTouchEventAt(float x, float y) {
53 ui::MotionEventAndroid::Pointer pointer0(0, x, y, 0, 0, 0, 0, 0); 53 ui::MotionEventAndroid::Pointer pointer0(0, x, y, 0, 0, 0, 0, 0);
54 ui::MotionEventAndroid::Pointer pointer1(0, 0, 0, 0, 0, 0, 0, 0); 54 ui::MotionEventAndroid::Pointer pointer1(0, 0, 0, 0, 0, 0, 0, 0);
55 ui::MotionEventAndroid event(1.f, nullptr, JavaParamRef<jobject>(nullptr), 55 ui::MotionEventAndroid event(nullptr, JavaParamRef<jobject>(nullptr), 1.f,
56 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, &pointer0, 56 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
57 &pointer1); 57 &pointer0, &pointer1);
58 root_.OnTouchEvent(event, false); 58 root_.OnTouchEvent(event, false);
59 } 59 }
60 60
61 void ExpectHit(const TestViewClient& hitClient) { 61 void ExpectHit(const TestViewClient& hitClient) {
62 TestViewClient* clients[3] = {&client1_, &client2_, &client3_}; 62 TestViewClient* clients[3] = {&client1_, &client2_, &client3_};
63 for (auto* client : clients) { 63 for (auto* client : clients) {
64 if (&hitClient == client) 64 if (&hitClient == client)
65 EXPECT_TRUE(client->EventHandled()); 65 EXPECT_TRUE(client->EventHandled());
66 else 66 else
67 EXPECT_FALSE(client->EventHandled()); 67 EXPECT_FALSE(client->EventHandled());
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 GenerateTouchEventAt(40, 60); 160 GenerateTouchEventAt(40, 60);
161 EXPECT_TRUE(client1_.EventCalled()); 161 EXPECT_TRUE(client1_.EventCalled());
162 ExpectHit(client2_); 162 ExpectHit(client2_);
163 163
164 GenerateTouchEventAt(100, 70); 164 GenerateTouchEventAt(100, 70);
165 EXPECT_TRUE(client1_.EventCalled()); 165 EXPECT_TRUE(client1_.EventCalled());
166 ExpectHit(client3_); 166 ExpectHit(client3_);
167 } 167 }
168 168
169 } // namespace ui 169 } // namespace ui
OLDNEW
« no previous file with comments | « ui/android/view_android.cc ('k') | ui/android/view_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698