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

Side by Side Diff: ui/events/gestures/motion_event_aura_unittest.cc

Issue 1559163002: Clean up event flags a bit: (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review comment Created 4 years, 11 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 // MSVC++ requires this to be set before any other includes to get M_PI. 5 // MSVC++ requires this to be set before any other includes to get M_PI.
6 #define _USE_MATH_DEFINES 6 #define _USE_MATH_DEFINES
7 7
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 TEST(MotionEventAuraTest, Flags) { 432 TEST(MotionEventAuraTest, Flags) {
433 int ids[] = {7, 11}; 433 int ids[] = {7, 11};
434 MotionEventAura event; 434 MotionEventAura event;
435 435
436 TouchEvent press0 = TouchWithType(ET_TOUCH_PRESSED, ids[0]); 436 TouchEvent press0 = TouchWithType(ET_TOUCH_PRESSED, ids[0]);
437 press0.set_flags(EF_CONTROL_DOWN); 437 press0.set_flags(EF_CONTROL_DOWN);
438 EXPECT_TRUE(event.OnTouch(press0)); 438 EXPECT_TRUE(event.OnTouch(press0));
439 EXPECT_EQ(EF_CONTROL_DOWN, event.GetFlags()); 439 EXPECT_EQ(EF_CONTROL_DOWN, event.GetFlags());
440 440
441 TouchEvent press1 = TouchWithType(ET_TOUCH_PRESSED, ids[1]); 441 TouchEvent press1 = TouchWithType(ET_TOUCH_PRESSED, ids[1]);
442 press1.set_flags(EF_CONTROL_DOWN | EF_CAPS_LOCK_DOWN); 442 press1.set_flags(EF_CONTROL_DOWN | EF_CAPS_LOCK_ON);
443 EXPECT_TRUE(event.OnTouch(press1)); 443 EXPECT_TRUE(event.OnTouch(press1));
444 EXPECT_EQ(EF_CONTROL_DOWN | EF_CAPS_LOCK_DOWN, event.GetFlags()); 444 EXPECT_EQ(EF_CONTROL_DOWN | EF_CAPS_LOCK_ON, event.GetFlags());
445 } 445 }
446 446
447 // Once crbug.com/446852 is fixed, we should ignore redundant presses. 447 // Once crbug.com/446852 is fixed, we should ignore redundant presses.
448 TEST(MotionEventAuraTest, DoesntIgnoreRedundantPresses) { 448 TEST(MotionEventAuraTest, DoesntIgnoreRedundantPresses) {
449 const int id = 7; 449 const int id = 7;
450 const int position_1 = 10; 450 const int position_1 = 10;
451 const int position_2 = 23; 451 const int position_2 = 23;
452 452
453 MotionEventAura event; 453 MotionEventAura event;
454 TouchEvent press1 = TouchWithPosition(ET_TOUCH_PRESSED, id, position_1, 454 TouchEvent press1 = TouchWithPosition(ET_TOUCH_PRESSED, id, position_1,
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 int id = i + kIdOffset; 517 int id = i + kIdOffset;
518 TouchEvent release = TouchWithType(ET_TOUCH_RELEASED, id); 518 TouchEvent release = TouchWithType(ET_TOUCH_RELEASED, id);
519 if (i < MotionEvent::MAX_TOUCH_POINT_COUNT) 519 if (i < MotionEvent::MAX_TOUCH_POINT_COUNT)
520 EXPECT_TRUE(event.OnTouch(release)); 520 EXPECT_TRUE(event.OnTouch(release));
521 else 521 else
522 EXPECT_FALSE(event.OnTouch(release)); 522 EXPECT_FALSE(event.OnTouch(release));
523 } 523 }
524 } 524 }
525 525
526 } // namespace ui 526 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/gesture_detection/gesture_provider_unittest.cc ('k') | ui/events/keycodes/keyboard_code_conversion.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698