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

Side by Side Diff: ash/wm/sticky_keys_unittest.cc

Issue 95403006: x11: Cleanup how valuators are set for X events in tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "ash/wm/sticky_keys.h" 5 #include "ash/wm/sticky_keys.h"
6 6
7 #include <X11/Xlib.h> 7 #include <X11/Xlib.h>
8 #undef None 8 #undef None
9 #undef Bool 9 #undef Bool
10 #undef RootWindow 10 #undef RootWindow
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 sticky_key.HandleKeyEvent(kev.get()); 495 sticky_key.HandleKeyEvent(kev.get());
496 EXPECT_TRUE(kev->flags() & ui::EF_CONTROL_DOWN); 496 EXPECT_TRUE(kev->flags() & ui::EF_CONTROL_DOWN);
497 kev.reset(GenerateKey(false, ui::VKEY_N)); 497 kev.reset(GenerateKey(false, ui::VKEY_N));
498 sticky_key.HandleKeyEvent(kev.get()); 498 sticky_key.HandleKeyEvent(kev.get());
499 EXPECT_TRUE(kev->flags() & ui::EF_CONTROL_DOWN); 499 EXPECT_TRUE(kev->flags() & ui::EF_CONTROL_DOWN);
500 500
501 EXPECT_EQ(StickyKeysHandler::LOCKED, sticky_key.current_state()); 501 EXPECT_EQ(StickyKeysHandler::LOCKED, sticky_key.current_state());
502 } 502 }
503 503
504 TEST_F(StickyKeysTest, ScrollEvents) { 504 TEST_F(StickyKeysTest, ScrollEvents) {
505 ui::SetUpScrollDeviceForTest(kScrollDeviceId); 505 ui::SetupScrollDeviceForTest(kScrollDeviceId);
Daniel Erat 2013/12/02 21:29:10 "SetUp" was correct. see e.g. http://notaverb.com/
sadrul 2013/12/02 21:49:50 Done.
506 // Australlian scrolling is enabled by default for some reason. 506 // Australlian scrolling is enabled by default for some reason.
507 ui::DeviceDataManager::GetInstance()->set_natural_scroll_enabled(true); 507 ui::DeviceDataManager::GetInstance()->set_natural_scroll_enabled(true);
508 508
509 scoped_ptr<ui::ScrollEvent> ev; 509 scoped_ptr<ui::ScrollEvent> ev;
510 scoped_ptr<ui::KeyEvent> kev; 510 scoped_ptr<ui::KeyEvent> kev;
511 MockStickyKeysHandlerDelegate* mock_delegate = 511 MockStickyKeysHandlerDelegate* mock_delegate =
512 new MockStickyKeysHandlerDelegate(this); 512 new MockStickyKeysHandlerDelegate(this);
513 StickyKeysHandler sticky_key(ui::EF_CONTROL_DOWN, mock_delegate); 513 StickyKeysHandler sticky_key(ui::EF_CONTROL_DOWN, mock_delegate);
514 514
515 int scroll_deltas[] = {-10, 10}; 515 int scroll_deltas[] = {-10, 10};
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 static_cast<ui::MouseWheelEvent*>(events[0])->y_offset()); 736 static_cast<ui::MouseWheelEvent*>(events[0])->y_offset());
737 EXPECT_TRUE(events[0]->flags() & ui::EF_CONTROL_DOWN); 737 EXPECT_TRUE(events[0]->flags() & ui::EF_CONTROL_DOWN);
738 EXPECT_EQ(ui::ET_KEY_RELEASED, events[1]->type()); 738 EXPECT_EQ(ui::ET_KEY_RELEASED, events[1]->type());
739 EXPECT_EQ(ui::VKEY_CONTROL, 739 EXPECT_EQ(ui::VKEY_CONTROL,
740 static_cast<ui::KeyEvent*>(events[1])->key_code()); 740 static_cast<ui::KeyEvent*>(events[1])->key_code());
741 741
742 Shell::GetInstance()->RemovePreTargetHandler(&buffer); 742 Shell::GetInstance()->RemovePreTargetHandler(&buffer);
743 } 743 }
744 744
745 } // namespace ash 745 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ui/events/test/events_test_utils_x11.h » ('j') | ui/events/test/events_test_utils_x11.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698