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

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

Issue 9309098: Handle F6 and F7 (brightness keys) in ash [part 3 of 3]. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 10 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
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/brightness_control_delegate.h" 6 #include "ash/brightness_control_delegate.h"
7 #include "ash/caps_lock_delegate.h" 7 #include "ash/caps_lock_delegate.h"
8 #include "ash/ime/event.h" 8 #include "ash/ime/event.h"
9 #include "ash/screenshot_delegate.h" 9 #include "ash/screenshot_delegate.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 scoped_ptr<BrightnessControlDelegate>(delegate).Pass()); 524 scoped_ptr<BrightnessControlDelegate>(delegate).Pass());
525 EXPECT_EQ(0, delegate->handle_brightness_down_count()); 525 EXPECT_EQ(0, delegate->handle_brightness_down_count());
526 EXPECT_TRUE(GetController()->Process(f6)); 526 EXPECT_TRUE(GetController()->Process(f6));
527 EXPECT_EQ(1, delegate->handle_brightness_down_count()); 527 EXPECT_EQ(1, delegate->handle_brightness_down_count());
528 EXPECT_EQ(f6, delegate->last_accelerator()); 528 EXPECT_EQ(f6, delegate->last_accelerator());
529 EXPECT_EQ(0, delegate->handle_brightness_up_count()); 529 EXPECT_EQ(0, delegate->handle_brightness_up_count());
530 EXPECT_TRUE(GetController()->Process(f7)); 530 EXPECT_TRUE(GetController()->Process(f7));
531 EXPECT_EQ(1, delegate->handle_brightness_up_count()); 531 EXPECT_EQ(1, delegate->handle_brightness_up_count());
532 EXPECT_EQ(f7, delegate->last_accelerator()); 532 EXPECT_EQ(f7, delegate->last_accelerator());
533 } 533 }
534 #if defined(OS_CHROMEOS)
535 // ui::VKEY_BRIGHTNESS_DOWN/UP are not defined on Windows.
536 const ui::Accelerator brightness_down(
537 ui::VKEY_BRIGHTNESS_DOWN, false, false, false);
538 const ui::Accelerator brightness_up(
539 ui::VKEY_BRIGHTNESS_UP, false, false, false);
540 {
541 DummyBrightnessControlDelegate* delegate =
542 new DummyBrightnessControlDelegate(false);
543 GetController()->SetBrightnessControlDelegate(
544 scoped_ptr<BrightnessControlDelegate>(delegate).Pass());
545 EXPECT_EQ(0, delegate->handle_brightness_down_count());
546 EXPECT_FALSE(GetController()->Process(brightness_down));
547 EXPECT_EQ(1, delegate->handle_brightness_down_count());
548 EXPECT_EQ(brightness_down, delegate->last_accelerator());
549 EXPECT_EQ(0, delegate->handle_brightness_up_count());
550 EXPECT_FALSE(GetController()->Process(brightness_up));
551 EXPECT_EQ(1, delegate->handle_brightness_up_count());
552 EXPECT_EQ(brightness_up, delegate->last_accelerator());
553 }
554 {
555 DummyBrightnessControlDelegate* delegate =
556 new DummyBrightnessControlDelegate(true);
557 GetController()->SetBrightnessControlDelegate(
558 scoped_ptr<BrightnessControlDelegate>(delegate).Pass());
559 EXPECT_EQ(0, delegate->handle_brightness_down_count());
560 EXPECT_TRUE(GetController()->Process(brightness_down));
561 EXPECT_EQ(1, delegate->handle_brightness_down_count());
562 EXPECT_EQ(brightness_down, delegate->last_accelerator());
563 EXPECT_EQ(0, delegate->handle_brightness_up_count());
564 EXPECT_TRUE(GetController()->Process(brightness_up));
565 EXPECT_EQ(1, delegate->handle_brightness_up_count());
566 EXPECT_EQ(brightness_up, delegate->last_accelerator());
567 }
568 #endif
534 #if !defined(NDEBUG) 569 #if !defined(NDEBUG)
535 // RotateScreen 570 // RotateScreen
536 EXPECT_TRUE(GetController()->Process( 571 EXPECT_TRUE(GetController()->Process(
537 ui::Accelerator(ui::VKEY_HOME, false, true, false))); 572 ui::Accelerator(ui::VKEY_HOME, false, true, false)));
538 // ToggleCompactWindowMode 573 // ToggleCompactWindowMode
539 EXPECT_TRUE(GetController()->Process( 574 EXPECT_TRUE(GetController()->Process(
540 ui::Accelerator(ui::VKEY_A, false, true, true))); 575 ui::Accelerator(ui::VKEY_A, false, true, true)));
541 #if !defined(OS_LINUX) 576 #if !defined(OS_LINUX)
542 // ToggleDesktopFullScreen (not implemented yet on Linux) 577 // ToggleDesktopFullScreen (not implemented yet on Linux)
543 EXPECT_TRUE(GetController()->Process( 578 EXPECT_TRUE(GetController()->Process(
544 ui::Accelerator(ui::VKEY_F11, false, true, false))); 579 ui::Accelerator(ui::VKEY_F11, false, true, false)));
545 #endif 580 #endif
546 581
547 // Exit 582 // Exit
548 EXPECT_TRUE(GetController()->Process( 583 EXPECT_TRUE(GetController()->Process(
549 ui::Accelerator(ui::VKEY_Q, true, true ,false))); 584 ui::Accelerator(ui::VKEY_Q, true, true ,false)));
550 #endif 585 #endif
551 586
552 #if defined(OS_CHROMEOS) 587 #if defined(OS_CHROMEOS)
553 EXPECT_TRUE(GetController()->Process( 588 EXPECT_TRUE(GetController()->Process(
554 ui::Accelerator(ui::VKEY_L, true, true, false))); 589 ui::Accelerator(ui::VKEY_L, true, true, false)));
555 #endif 590 #endif
556 591
557 // Reset window before |test_delegate| gets deleted. 592 // Reset window before |test_delegate| gets deleted.
558 window.reset(); 593 window.reset();
559 } 594 }
560 595
561 } // namespace test 596 } // namespace test
562 } // namespace ash 597 } // namespace ash
OLDNEW
« no previous file with comments | « ash/accelerators/accelerator_controller.cc ('k') | ui/base/keycodes/keyboard_code_conversion_x.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698