Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 #include "ui/chromeos/touch_exploration_controller.h" | 5 #include "ui/chromeos/touch_exploration_controller.h" |
| 6 | 6 |
| 7 #include "ash/accessibility_delegate.h" | 7 #include "ash/accessibility_delegate.h" |
| 8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 9 #include "ash/test/ash_test_base.h" | 9 #include "ash/test/ash_test_base.h" |
| 10 #include "chrome/test/base/in_process_browser_test.h" | 10 #include "chrome/test/base/in_process_browser_test.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 77 generator.set_current_location(gfx::Point(500, 600)); | 77 generator.set_current_location(gfx::Point(500, 600)); |
| 78 generator.PressTouchId(2); | 78 generator.PressTouchId(2); |
| 79 generator.MoveTouchId(gfx::Point(509, 609), 2); | 79 generator.MoveTouchId(gfx::Point(509, 609), 2); |
| 80 EXPECT_GT(event_handler->num_mouse_events(), 0); | 80 EXPECT_GT(event_handler->num_mouse_events(), 0); |
| 81 EXPECT_EQ(0, event_handler->num_touch_events()); | 81 EXPECT_EQ(0, event_handler->num_touch_events()); |
| 82 | 82 |
| 83 SwitchTouchExplorationMode(false); | 83 SwitchTouchExplorationMode(false); |
| 84 root_window->RemovePreTargetHandler(event_handler.get()); | 84 root_window->RemovePreTargetHandler(event_handler.get()); |
| 85 } | 85 } |
| 86 | 86 |
| 87 // This test makes sure that after the user clicks with split tap, | |
|
mfomitchev
2014/06/27 19:15:46
One more thing: I've just realized that a change I
evy
2014/06/30 23:28:46
Done.
| |
| 88 // they continue to touch exploration mode if the original touch exploration | |
| 89 // finger is still on the screen. | |
| 90 IN_PROC_BROWSER_TEST_F(TouchExplorationTest, SplitTapExplore) { | |
|
mfomitchev
2014/06/27 16:36:05
Can you please add validation for the cursor clien
evy
2014/06/27 18:03:00
Done. Though it turns out that mouse events aren't
mfomitchev
2014/06/27 19:15:46
Right, that actually makes sense because the contr
evy
2014/06/30 23:28:46
Working on it. Turns out this is more complicated
| |
| 91 aura::Window* root_window = ash::Shell::GetInstance()->GetPrimaryRootWindow(); | |
| 92 scoped_ptr<ui::test::TestEventHandler> | |
| 93 event_handler(new ui::test::TestEventHandler()); | |
| 94 root_window->AddPreTargetHandler(event_handler.get()); | |
| 95 SwitchTouchExplorationMode(true); | |
| 96 aura::test::EventGenerator generator(root_window); | |
| 97 | |
| 98 generator.set_current_location(gfx::Point(100, 200)); | |
| 99 generator.PressTouchId(1); | |
| 100 // Initiate touch explore by moving out of the slop. | |
| 101 generator.MoveTouchId(gfx::Point(109, 209), 1); | |
|
tdanderson
2014/06/27 17:01:07
Add EXPECT_EQ(1, event_handler->num_touch_events()
evy
2014/06/27 18:03:00
There actually aren't any touch events passed thro
| |
| 102 event_handler->Reset(); | |
| 103 | |
| 104 // Press and release with a second finger for split tap. This should send | |
| 105 // touch press and release events which should send a click press and release. | |
|
tdanderson
2014/06/27 17:01:07
For documentation's sake, it would be good to ment
evy
2014/06/27 18:03:00
Yup! This is tested in the SplitTap unit test. Sho
| |
| 106 generator.set_current_location(gfx::Point(102, 202)); | |
| 107 generator.PressTouchId(2); | |
| 108 generator.ReleaseTouchId(2); | |
| 109 EXPECT_EQ(2, event_handler->num_touch_events()); | |
| 110 event_handler->Reset(); | |
| 111 | |
| 112 // Continuing to move the touch exploration finger should send more mouse | |
| 113 // events. | |
| 114 generator.MoveTouchId(gfx::Point(509, 609), 1); | |
| 115 EXPECT_GT(event_handler->num_mouse_events(), 0); | |
|
tdanderson
2014/06/27 17:01:07
It's better to use EXPECT_EQ if you know how many
evy
2014/06/27 18:03:00
I noticed a comment above in another test:
// Numb
| |
| 116 EXPECT_EQ(0, event_handler->num_touch_events()); | |
| 117 | |
| 118 SwitchTouchExplorationMode(false); | |
| 119 root_window->RemovePreTargetHandler(event_handler.get()); | |
| 120 } | |
| 121 | |
| 87 } // namespace ui | 122 } // namespace ui |
| OLD | NEW |