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

Side by Side Diff: ash/accelerators/accelerator_controller_unittest.cc

Issue 10825050: Introduce RootWindowHostDelegate. The RootWindowHost performs most of its communication with RootWi… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | ash/drag_drop/drag_drop_controller_unittest.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 "ash/accelerators/accelerator_controller.h" 5 #include "ash/accelerators/accelerator_controller.h"
6 #include "ash/accelerators/accelerator_table.h" 6 #include "ash/accelerators/accelerator_table.h"
7 #include "ash/caps_lock_delegate.h" 7 #include "ash/caps_lock_delegate.h"
8 #include "ash/ime_control_delegate.h" 8 #include "ash/ime_control_delegate.h"
9 #include "ash/screenshot_delegate.h" 9 #include "ash/screenshot_delegate.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 #if defined(OS_WIN) || defined(USE_X11) 491 #if defined(OS_WIN) || defined(USE_X11)
492 TEST_F(AcceleratorControllerTest, ProcessOnce) { 492 TEST_F(AcceleratorControllerTest, ProcessOnce) {
493 ui::Accelerator accelerator_a(ui::VKEY_A, ui::EF_NONE); 493 ui::Accelerator accelerator_a(ui::VKEY_A, ui::EF_NONE);
494 TestTarget target; 494 TestTarget target;
495 GetController()->Register(accelerator_a, &target); 495 GetController()->Register(accelerator_a, &target);
496 496
497 // The accelerator is processed only once. 497 // The accelerator is processed only once.
498 #if defined(OS_WIN) 498 #if defined(OS_WIN)
499 MSG msg1 = { NULL, WM_KEYDOWN, ui::VKEY_A, 0 }; 499 MSG msg1 = { NULL, WM_KEYDOWN, ui::VKEY_A, 0 };
500 aura::TranslatedKeyEvent key_event1(msg1, false); 500 aura::TranslatedKeyEvent key_event1(msg1, false);
501 EXPECT_TRUE(Shell::GetPrimaryRootWindow()->DispatchKeyEvent(&key_event1)); 501 EXPECT_TRUE(Shell::GetPrimaryRootWindow()->AsRootWindowHostDelegate()->
502 OnHostKeyEvent(&key_event1));
502 503
503 MSG msg2 = { NULL, WM_CHAR, L'A', 0 }; 504 MSG msg2 = { NULL, WM_CHAR, L'A', 0 };
504 aura::TranslatedKeyEvent key_event2(msg2, true); 505 aura::TranslatedKeyEvent key_event2(msg2, true);
505 EXPECT_FALSE(Shell::GetPrimaryRootWindow()->DispatchKeyEvent(&key_event2)); 506 EXPECT_FALSE(Shell::GetPrimaryRootWindow()->AsRootWindowHostDelegate()->
507 OnHostKeyEvent(&key_event2));
506 508
507 MSG msg3 = { NULL, WM_KEYUP, ui::VKEY_A, 0 }; 509 MSG msg3 = { NULL, WM_KEYUP, ui::VKEY_A, 0 };
508 aura::TranslatedKeyEvent key_event3(msg3, false); 510 aura::TranslatedKeyEvent key_event3(msg3, false);
509 EXPECT_FALSE(Shell::GetPrimaryRootWindow()->DispatchKeyEvent(&key_event3)); 511 EXPECT_FALSE(Shell::GetPrimaryRootWindow()->AsRootWindowHostDelegate()->
512 OnHostKeyEvent(&key_event3));
510 #elif defined(USE_X11) 513 #elif defined(USE_X11)
511 XEvent key_event; 514 XEvent key_event;
512 ui::InitXKeyEventForTesting(ui::ET_KEY_PRESSED, 515 ui::InitXKeyEventForTesting(ui::ET_KEY_PRESSED,
513 ui::VKEY_A, 516 ui::VKEY_A,
514 0, 517 0,
515 &key_event); 518 &key_event);
516 aura::TranslatedKeyEvent key_event1(&key_event, false); 519 aura::TranslatedKeyEvent key_event1(&key_event, false);
517 EXPECT_TRUE(Shell::GetPrimaryRootWindow()->DispatchKeyEvent(&key_event1)); 520 EXPECT_TRUE(Shell::GetPrimaryRootWindow()->AsRootWindowHostDelegate()->
521 OnHostKeyEvent(&key_event1));
518 522
519 aura::TranslatedKeyEvent key_event2(&key_event, true); 523 aura::TranslatedKeyEvent key_event2(&key_event, true);
520 EXPECT_FALSE(Shell::GetPrimaryRootWindow()->DispatchKeyEvent(&key_event2)); 524 EXPECT_FALSE(Shell::GetPrimaryRootWindow()->AsRootWindowHostDelegate()->
525 OnHostKeyEvent(&key_event2));
521 526
522 ui::InitXKeyEventForTesting(ui::ET_KEY_RELEASED, 527 ui::InitXKeyEventForTesting(ui::ET_KEY_RELEASED,
523 ui::VKEY_A, 528 ui::VKEY_A,
524 0, 529 0,
525 &key_event); 530 &key_event);
526 aura::TranslatedKeyEvent key_event3(&key_event, false); 531 aura::TranslatedKeyEvent key_event3(&key_event, false);
527 EXPECT_FALSE(Shell::GetPrimaryRootWindow()->DispatchKeyEvent(&key_event3)); 532 EXPECT_FALSE(Shell::GetPrimaryRootWindow()->AsRootWindowHostDelegate()->
533 OnHostKeyEvent(&key_event3));
528 #endif 534 #endif
529 EXPECT_EQ(1, target.accelerator_pressed_count()); 535 EXPECT_EQ(1, target.accelerator_pressed_count());
530 } 536 }
531 #endif 537 #endif
532 538
533 TEST_F(AcceleratorControllerTest, GlobalAccelerators) { 539 TEST_F(AcceleratorControllerTest, GlobalAccelerators) {
534 // CycleBackward 540 // CycleBackward
535 EXPECT_TRUE(GetController()->Process( 541 EXPECT_TRUE(GetController()->Process(
536 ui::Accelerator(ui::VKEY_F5, ui::EF_SHIFT_DOWN))); 542 ui::Accelerator(ui::VKEY_F5, ui::EF_SHIFT_DOWN)));
537 EXPECT_TRUE(GetController()->Process( 543 EXPECT_TRUE(GetController()->Process(
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
973 EXPECT_FALSE(GetController()->IsReservedAccelerator( 979 EXPECT_FALSE(GetController()->IsReservedAccelerator(
974 ui::Accelerator(ui::VKEY_PRINT, ui::EF_NONE))); 980 ui::Accelerator(ui::VKEY_PRINT, ui::EF_NONE)));
975 EXPECT_FALSE(GetController()->IsReservedAccelerator( 981 EXPECT_FALSE(GetController()->IsReservedAccelerator(
976 ui::Accelerator(ui::VKEY_TAB, ui::EF_NONE))); 982 ui::Accelerator(ui::VKEY_TAB, ui::EF_NONE)));
977 EXPECT_FALSE(GetController()->IsReservedAccelerator( 983 EXPECT_FALSE(GetController()->IsReservedAccelerator(
978 ui::Accelerator(ui::VKEY_A, ui::EF_NONE))); 984 ui::Accelerator(ui::VKEY_A, ui::EF_NONE)));
979 } 985 }
980 986
981 } // namespace test 987 } // namespace test
982 } // namespace ash 988 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/drag_drop/drag_drop_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698