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

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

Issue 10442017: Rename GetRootWindow() -> GetPrimaryRootWindow() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: git-try -b linux_chromeos,win_aura Created 8 years, 7 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 | « ash/accelerators/accelerator_controller.cc ('k') | ash/accelerators/accelerator_filter.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/caps_lock_delegate.h" 6 #include "ash/caps_lock_delegate.h"
7 #include "ash/ime_control_delegate.h" 7 #include "ash/ime_control_delegate.h"
8 #include "ash/screenshot_delegate.h" 8 #include "ash/screenshot_delegate.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/shell_window_ids.h" 10 #include "ash/shell_window_ids.h"
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 #if defined(OS_WIN) || defined(USE_X11) 376 #if defined(OS_WIN) || defined(USE_X11)
377 TEST_F(AcceleratorControllerTest, ProcessOnce) { 377 TEST_F(AcceleratorControllerTest, ProcessOnce) {
378 ui::Accelerator accelerator_a(ui::VKEY_A, ui::EF_NONE); 378 ui::Accelerator accelerator_a(ui::VKEY_A, ui::EF_NONE);
379 TestTarget target; 379 TestTarget target;
380 GetController()->Register(accelerator_a, &target); 380 GetController()->Register(accelerator_a, &target);
381 381
382 // The accelerator is processed only once. 382 // The accelerator is processed only once.
383 #if defined(OS_WIN) 383 #if defined(OS_WIN)
384 MSG msg1 = { NULL, WM_KEYDOWN, ui::VKEY_A, 0 }; 384 MSG msg1 = { NULL, WM_KEYDOWN, ui::VKEY_A, 0 };
385 aura::TranslatedKeyEvent key_event1(msg1, false); 385 aura::TranslatedKeyEvent key_event1(msg1, false);
386 EXPECT_TRUE(Shell::GetRootWindow()->DispatchKeyEvent(&key_event1)); 386 EXPECT_TRUE(Shell::GetPrimaryRootWindow()->DispatchKeyEvent(&key_event1));
387 387
388 MSG msg2 = { NULL, WM_CHAR, L'A', 0 }; 388 MSG msg2 = { NULL, WM_CHAR, L'A', 0 };
389 aura::TranslatedKeyEvent key_event2(msg2, true); 389 aura::TranslatedKeyEvent key_event2(msg2, true);
390 EXPECT_FALSE(Shell::GetRootWindow()->DispatchKeyEvent(&key_event2)); 390 EXPECT_FALSE(Shell::GetPrimaryRootWindow()->DispatchKeyEvent(&key_event2));
391 391
392 MSG msg3 = { NULL, WM_KEYUP, ui::VKEY_A, 0 }; 392 MSG msg3 = { NULL, WM_KEYUP, ui::VKEY_A, 0 };
393 aura::TranslatedKeyEvent key_event3(msg3, false); 393 aura::TranslatedKeyEvent key_event3(msg3, false);
394 EXPECT_FALSE(Shell::GetRootWindow()->DispatchKeyEvent(&key_event3)); 394 EXPECT_FALSE(Shell::GetPrimaryRootWindow()->DispatchKeyEvent(&key_event3));
395 #elif defined(USE_X11) 395 #elif defined(USE_X11)
396 XEvent key_event; 396 XEvent key_event;
397 ui::InitXKeyEventForTesting(ui::ET_KEY_PRESSED, 397 ui::InitXKeyEventForTesting(ui::ET_KEY_PRESSED,
398 ui::VKEY_A, 398 ui::VKEY_A,
399 0, 399 0,
400 &key_event); 400 &key_event);
401 aura::TranslatedKeyEvent key_event1(&key_event, false); 401 aura::TranslatedKeyEvent key_event1(&key_event, false);
402 EXPECT_TRUE(Shell::GetRootWindow()->DispatchKeyEvent(&key_event1)); 402 EXPECT_TRUE(Shell::GetPrimaryRootWindow()->DispatchKeyEvent(&key_event1));
403 403
404 aura::TranslatedKeyEvent key_event2(&key_event, true); 404 aura::TranslatedKeyEvent key_event2(&key_event, true);
405 EXPECT_FALSE(Shell::GetRootWindow()->DispatchKeyEvent(&key_event2)); 405 EXPECT_FALSE(Shell::GetPrimaryRootWindow()->DispatchKeyEvent(&key_event2));
406 406
407 ui::InitXKeyEventForTesting(ui::ET_KEY_RELEASED, 407 ui::InitXKeyEventForTesting(ui::ET_KEY_RELEASED,
408 ui::VKEY_A, 408 ui::VKEY_A,
409 0, 409 0,
410 &key_event); 410 &key_event);
411 aura::TranslatedKeyEvent key_event3(&key_event, false); 411 aura::TranslatedKeyEvent key_event3(&key_event, false);
412 EXPECT_FALSE(Shell::GetRootWindow()->DispatchKeyEvent(&key_event3)); 412 EXPECT_FALSE(Shell::GetPrimaryRootWindow()->DispatchKeyEvent(&key_event3));
413 #endif 413 #endif
414 EXPECT_EQ(1, target.accelerator_pressed_count()); 414 EXPECT_EQ(1, target.accelerator_pressed_count());
415 } 415 }
416 #endif 416 #endif
417 417
418 // Disabled due to a real bug, see http://crbug.com/127538. 418 // Disabled due to a real bug, see http://crbug.com/127538.
419 TEST_F(AcceleratorControllerTest, DISABLED_GlobalAccelerators) { 419 TEST_F(AcceleratorControllerTest, DISABLED_GlobalAccelerators) {
420 // CycleBackward 420 // CycleBackward
421 EXPECT_TRUE(GetController()->Process( 421 EXPECT_TRUE(GetController()->Process(
422 ui::Accelerator(ui::VKEY_F5, ui::EF_CONTROL_DOWN))); 422 ui::Accelerator(ui::VKEY_F5, ui::EF_CONTROL_DOWN)));
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 EXPECT_FALSE(GetController()->Process(shift_alt_press)); 733 EXPECT_FALSE(GetController()->Process(shift_alt_press));
734 EXPECT_FALSE(GetController()->Process(shift_alt_x_press)); 734 EXPECT_FALSE(GetController()->Process(shift_alt_x_press));
735 EXPECT_FALSE(GetController()->Process(shift_alt_x)); 735 EXPECT_FALSE(GetController()->Process(shift_alt_x));
736 EXPECT_FALSE(GetController()->Process(shift_alt)); 736 EXPECT_FALSE(GetController()->Process(shift_alt));
737 EXPECT_EQ(2, delegate->handle_next_ime_count()); 737 EXPECT_EQ(2, delegate->handle_next_ime_count());
738 } 738 }
739 } 739 }
740 740
741 } // namespace test 741 } // namespace test
742 } // namespace ash 742 } // namespace ash
OLDNEW
« no previous file with comments | « ash/accelerators/accelerator_controller.cc ('k') | ash/accelerators/accelerator_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698