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

Side by Side Diff: ui/aura/window_event_dispatcher_unittest.cc

Issue 665863002: Allows to fire VKEY_UNKNOWN key events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated a unittest. Created 6 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
« no previous file with comments | « no previous file | ui/aura/window_targeter.cc » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/aura/window_event_dispatcher.h" 5 #include "ui/aura/window_event_dispatcher.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 ui::test::EventGenerator generator3(root_window(), w3.get()); 335 ui::test::EventGenerator generator3(root_window(), w3.get());
336 generator3.PressLeftButton(); 336 generator3.PressLeftButton();
337 EXPECT_EQ(1, lock_ef.num_mouse_events()); 337 EXPECT_EQ(1, lock_ef.num_mouse_events());
338 } 338 }
339 339
340 // Prevent w3 from being deleted by the hierarchy since its delegate is owned 340 // Prevent w3 from being deleted by the hierarchy since its delegate is owned
341 // by this scope. 341 // by this scope.
342 w3->parent()->RemoveChild(w3.get()); 342 w3->parent()->RemoveChild(w3.get());
343 } 343 }
344 344
345 TEST_F(WindowEventDispatcherTest, IgnoreUnknownKeys) { 345 TEST_F(WindowEventDispatcherTest, DontIgnoreUnknownKeys) {
346 ConsumeKeyHandler handler; 346 ConsumeKeyHandler handler;
347 root_window()->AddPreTargetHandler(&handler); 347 root_window()->AddPreTargetHandler(&handler);
348 348
349 ui::KeyEvent unknown_event(ui::ET_KEY_PRESSED, ui::VKEY_UNKNOWN, ui::EF_NONE); 349 ui::KeyEvent unknown_event(ui::ET_KEY_PRESSED, ui::VKEY_UNKNOWN, ui::EF_NONE);
350 DispatchEventUsingWindowDispatcher(&unknown_event); 350 DispatchEventUsingWindowDispatcher(&unknown_event);
351 EXPECT_FALSE(unknown_event.handled()); 351 EXPECT_TRUE(unknown_event.handled());
352 EXPECT_EQ(0, handler.num_key_events()); 352 EXPECT_EQ(1, handler.num_key_events());
353 353
354 handler.Reset(); 354 handler.Reset();
355 ui::KeyEvent known_event(ui::ET_KEY_PRESSED, ui::VKEY_A, ui::EF_NONE); 355 ui::KeyEvent known_event(ui::ET_KEY_PRESSED, ui::VKEY_A, ui::EF_NONE);
356 DispatchEventUsingWindowDispatcher(&known_event); 356 DispatchEventUsingWindowDispatcher(&known_event);
357 EXPECT_TRUE(known_event.handled()); 357 EXPECT_TRUE(known_event.handled());
358 EXPECT_EQ(1, handler.num_key_events()); 358 EXPECT_EQ(1, handler.num_key_events());
359 359
360 handler.Reset(); 360 handler.Reset();
361 ui::KeyEvent ime_event(ui::ET_KEY_PRESSED, ui::VKEY_UNKNOWN, 361 ui::KeyEvent ime_event(ui::ET_KEY_PRESSED, ui::VKEY_UNKNOWN,
362 ui::EF_IME_FABRICATED_KEY); 362 ui::EF_IME_FABRICATED_KEY);
(...skipping 1997 matching lines...) Expand 10 before | Expand all | Expand 10 after
2360 ASSERT_EQ(1u, recorder.touch_locations().size()); 2360 ASSERT_EQ(1u, recorder.touch_locations().size());
2361 EXPECT_EQ(gfx::Point(kX - kWindowOffset, kY - kWindowOffset).ToString(), 2361 EXPECT_EQ(gfx::Point(kX - kWindowOffset, kY - kWindowOffset).ToString(),
2362 recorder.touch_locations()[0].ToString()); 2362 recorder.touch_locations()[0].ToString());
2363 2363
2364 ASSERT_EQ(2u, recorder.gesture_locations().size()); 2364 ASSERT_EQ(2u, recorder.gesture_locations().size());
2365 EXPECT_EQ(gfx::Point(kX - kWindowOffset, kY - kWindowOffset).ToString(), 2365 EXPECT_EQ(gfx::Point(kX - kWindowOffset, kY - kWindowOffset).ToString(),
2366 recorder.gesture_locations()[0].ToString()); 2366 recorder.gesture_locations()[0].ToString());
2367 } 2367 }
2368 2368
2369 } // namespace aura 2369 } // namespace aura
OLDNEW
« no previous file with comments | « no previous file | ui/aura/window_targeter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698