Index: ash/accelerators/accelerator_controller_unittest.cc |
diff --git a/ash/accelerators/accelerator_controller_unittest.cc b/ash/accelerators/accelerator_controller_unittest.cc |
index 738c9d35620f9524c411e3e4319484506534bb04..3ab5a7c82d8f92704e286710aad0bc0fea154848 100644 |
--- a/ash/accelerators/accelerator_controller_unittest.cc |
+++ b/ash/accelerators/accelerator_controller_unittest.cc |
@@ -24,12 +24,15 @@ |
#include "ash/wm/window_state.h" |
#include "ash/wm/window_util.h" |
#include "base/command_line.h" |
+#include "ui/aura/client/aura_constants.h" |
+#include "ui/aura/test/event_generator.h" |
#include "ui/aura/test/test_window_delegate.h" |
#include "ui/aura/test/test_windows.h" |
#include "ui/aura/window.h" |
#include "ui/events/event.h" |
#include "ui/events/event_processor.h" |
#include "ui/gfx/screen.h" |
+#include "ui/views/widget/widget.h" |
#if defined(USE_X11) |
#include <X11/Xlib.h> |
@@ -42,15 +45,18 @@ namespace { |
class TestTarget : public ui::AcceleratorTarget { |
public: |
- TestTarget() : accelerator_pressed_count_(0) {} |
+ TestTarget() : accelerator_pressed_count_(0), accelerator_repeat_count_(0) {} |
virtual ~TestTarget() {} |
int accelerator_pressed_count() const { |
return accelerator_pressed_count_; |
} |
- void set_accelerator_pressed_count(int accelerator_pressed_count) { |
- accelerator_pressed_count_ = accelerator_pressed_count; |
+ int accelerator_repeat_count() const { return accelerator_repeat_count_; } |
+ |
+ void reset() { |
+ accelerator_pressed_count_ = 0; |
+ accelerator_repeat_count_ = 0; |
} |
// Overridden from ui::AcceleratorTarget: |
@@ -59,6 +65,7 @@ class TestTarget : public ui::AcceleratorTarget { |
private: |
int accelerator_pressed_count_; |
+ int accelerator_repeat_count_; |
DISALLOW_COPY_AND_ASSIGN(TestTarget); |
}; |
@@ -214,7 +221,10 @@ class DummyKeyboardBrightnessControlDelegate |
}; |
bool TestTarget::AcceleratorPressed(const ui::Accelerator& accelerator) { |
- ++accelerator_pressed_count_; |
+ if (accelerator.IsRepeat()) |
+ ++accelerator_repeat_count_; |
+ else |
+ ++accelerator_pressed_count_; |
return true; |
} |
@@ -236,7 +246,6 @@ class AcceleratorControllerTest : public test::AshTestBase { |
} |
static AcceleratorController* GetController(); |
- static bool ProcessWithContext(const ui::Accelerator& accelerator); |
// Several functions to access ExitWarningHandler (as friend). |
static void StubForTest(ExitWarningHandler* ewh) { |
@@ -266,13 +275,6 @@ AcceleratorController* AcceleratorControllerTest::GetController() { |
return Shell::GetInstance()->accelerator_controller(); |
} |
-bool AcceleratorControllerTest::ProcessWithContext( |
- const ui::Accelerator& accelerator) { |
- AcceleratorController* controller = GetController(); |
- controller->context()->UpdateContext(accelerator); |
- return controller->Process(accelerator); |
-} |
- |
#if !defined(OS_WIN) |
// Double press of exit shortcut => exiting |
TEST_F(AcceleratorControllerTest, ExitWarningHandlerTestDoublePress) { |
@@ -284,12 +286,12 @@ TEST_F(AcceleratorControllerTest, ExitWarningHandlerTestDoublePress) { |
StubForTest(ewh); |
EXPECT_TRUE(is_idle(ewh)); |
EXPECT_FALSE(is_ui_shown(ewh)); |
- EXPECT_TRUE(ProcessWithContext(press)); |
- EXPECT_FALSE(ProcessWithContext(release)); |
+ EXPECT_TRUE(GetController()->Process(press)); |
+ EXPECT_FALSE(GetController()->Process(release)); |
EXPECT_FALSE(is_idle(ewh)); |
EXPECT_TRUE(is_ui_shown(ewh)); |
- EXPECT_TRUE(ProcessWithContext(press)); // second press before timer. |
- EXPECT_FALSE(ProcessWithContext(release)); |
+ EXPECT_TRUE(GetController()->Process(press)); // second press before timer. |
+ EXPECT_FALSE(GetController()->Process(release)); |
SimulateTimerExpired(ewh); |
EXPECT_TRUE(is_exiting(ewh)); |
EXPECT_FALSE(is_ui_shown(ewh)); |
@@ -306,8 +308,8 @@ TEST_F(AcceleratorControllerTest, ExitWarningHandlerTestSinglePress) { |
StubForTest(ewh); |
EXPECT_TRUE(is_idle(ewh)); |
EXPECT_FALSE(is_ui_shown(ewh)); |
- EXPECT_TRUE(ProcessWithContext(press)); |
- EXPECT_FALSE(ProcessWithContext(release)); |
+ EXPECT_TRUE(GetController()->Process(press)); |
+ EXPECT_FALSE(GetController()->Process(release)); |
EXPECT_FALSE(is_idle(ewh)); |
EXPECT_TRUE(is_ui_shown(ewh)); |
SimulateTimerExpired(ewh); |
@@ -337,7 +339,7 @@ TEST_F(AcceleratorControllerTest, Register) { |
GetController()->Register(accelerator_a, &target); |
// The registered accelerator is processed. |
- EXPECT_TRUE(ProcessWithContext(accelerator_a)); |
+ EXPECT_TRUE(GetController()->Process(accelerator_a)); |
EXPECT_EQ(1, target.accelerator_pressed_count()); |
} |
@@ -350,7 +352,7 @@ TEST_F(AcceleratorControllerTest, RegisterMultipleTarget) { |
// If multiple targets are registered with the same accelerator, the target |
// registered later processes the accelerator. |
- EXPECT_TRUE(ProcessWithContext(accelerator_a)); |
+ EXPECT_TRUE(GetController()->Process(accelerator_a)); |
EXPECT_EQ(0, target1.accelerator_pressed_count()); |
EXPECT_EQ(1, target2.accelerator_pressed_count()); |
} |
@@ -365,13 +367,13 @@ TEST_F(AcceleratorControllerTest, Unregister) { |
// Unregistering a different accelerator does not affect the other |
// accelerator. |
GetController()->Unregister(accelerator_b, &target); |
- EXPECT_TRUE(ProcessWithContext(accelerator_a)); |
+ EXPECT_TRUE(GetController()->Process(accelerator_a)); |
EXPECT_EQ(1, target.accelerator_pressed_count()); |
// The unregistered accelerator is no longer processed. |
- target.set_accelerator_pressed_count(0); |
+ target.reset(); |
GetController()->Unregister(accelerator_a, &target); |
- EXPECT_FALSE(ProcessWithContext(accelerator_a)); |
+ EXPECT_FALSE(GetController()->Process(accelerator_a)); |
EXPECT_EQ(0, target.accelerator_pressed_count()); |
} |
@@ -387,12 +389,12 @@ TEST_F(AcceleratorControllerTest, UnregisterAll) { |
GetController()->UnregisterAll(&target1); |
// All the accelerators registered for |target1| are no longer processed. |
- EXPECT_FALSE(ProcessWithContext(accelerator_a)); |
- EXPECT_FALSE(ProcessWithContext(accelerator_b)); |
+ EXPECT_FALSE(GetController()->Process(accelerator_a)); |
+ EXPECT_FALSE(GetController()->Process(accelerator_b)); |
EXPECT_EQ(0, target1.accelerator_pressed_count()); |
// UnregisterAll with a different target does not affect the other target. |
- EXPECT_TRUE(ProcessWithContext(accelerator_c)); |
+ EXPECT_TRUE(GetController()->Process(accelerator_c)); |
EXPECT_EQ(1, target2.accelerator_pressed_count()); |
} |
@@ -402,12 +404,12 @@ TEST_F(AcceleratorControllerTest, Process) { |
GetController()->Register(accelerator_a, &target1); |
// The registered accelerator is processed. |
- EXPECT_TRUE(ProcessWithContext(accelerator_a)); |
+ EXPECT_TRUE(GetController()->Process(accelerator_a)); |
EXPECT_EQ(1, target1.accelerator_pressed_count()); |
// The non-registered accelerator is not processed. |
const ui::Accelerator accelerator_b(ui::VKEY_B, ui::EF_NONE); |
- EXPECT_FALSE(ProcessWithContext(accelerator_b)); |
+ EXPECT_FALSE(GetController()->Process(accelerator_b)); |
} |
TEST_F(AcceleratorControllerTest, IsRegistered) { |
@@ -508,72 +510,103 @@ TEST_F(AcceleratorControllerTest, CenterWindowAccelerator) { |
EXPECT_EQ(docked_bounds.ToString(), window->GetBoundsInScreen().ToString()); |
} |
-TEST_F(AcceleratorControllerTest, ControllerContext) { |
- ui::Accelerator accelerator_a(ui::VKEY_A, ui::EF_NONE); |
- ui::Accelerator accelerator_a2(ui::VKEY_A, ui::EF_NONE); |
- ui::Accelerator accelerator_b(ui::VKEY_B, ui::EF_NONE); |
- |
+TEST_F(AcceleratorControllerTest, AutoRepeat) { |
+ ui::Accelerator accelerator_a(ui::VKEY_A, ui::EF_CONTROL_DOWN); |
accelerator_a.set_type(ui::ET_KEY_PRESSED); |
- accelerator_a2.set_type(ui::ET_KEY_RELEASED); |
+ TestTarget target_a; |
+ GetController()->Register(accelerator_a, &target_a); |
+ ui::Accelerator accelerator_b(ui::VKEY_B, ui::EF_CONTROL_DOWN); |
accelerator_b.set_type(ui::ET_KEY_PRESSED); |
- |
- EXPECT_FALSE(GetController()->context()->repeated()); |
- EXPECT_EQ(ui::ET_UNKNOWN, |
- GetController()->context()->previous_accelerator().type()); |
- |
- GetController()->context()->UpdateContext(accelerator_a); |
- EXPECT_FALSE(GetController()->context()->repeated()); |
- EXPECT_EQ(ui::ET_UNKNOWN, |
- GetController()->context()->previous_accelerator().type()); |
- |
- GetController()->context()->UpdateContext(accelerator_a2); |
- EXPECT_FALSE(GetController()->context()->repeated()); |
- EXPECT_EQ(ui::ET_KEY_PRESSED, |
- GetController()->context()->previous_accelerator().type()); |
- |
- GetController()->context()->UpdateContext(accelerator_a2); |
- EXPECT_TRUE(GetController()->context()->repeated()); |
- EXPECT_EQ(ui::ET_KEY_RELEASED, |
- GetController()->context()->previous_accelerator().type()); |
- |
- GetController()->context()->UpdateContext(accelerator_b); |
- EXPECT_FALSE(GetController()->context()->repeated()); |
- EXPECT_EQ(ui::ET_KEY_RELEASED, |
- GetController()->context()->previous_accelerator().type()); |
+ TestTarget target_b; |
+ GetController()->Register(accelerator_b, &target_b); |
+ |
+ aura::test::EventGenerator& generator = GetEventGenerator(); |
+ generator.PressKey(ui::VKEY_A, ui::EF_CONTROL_DOWN); |
+ generator.ReleaseKey(ui::VKEY_A, ui::EF_CONTROL_DOWN); |
+ |
+ EXPECT_EQ(1, target_a.accelerator_pressed_count()); |
+ EXPECT_EQ(0, target_a.accelerator_repeat_count()); |
+ |
+ // Long press should generate one |
+ generator.PressKey(ui::VKEY_A, ui::EF_CONTROL_DOWN); |
+ generator.PressKey(ui::VKEY_A, ui::EF_CONTROL_DOWN | ui::EF_IS_REPEAT); |
+ EXPECT_EQ(2, target_a.accelerator_pressed_count()); |
+ EXPECT_EQ(1, target_a.accelerator_repeat_count()); |
+ generator.PressKey(ui::VKEY_A, ui::EF_CONTROL_DOWN | ui::EF_IS_REPEAT); |
+ EXPECT_EQ(2, target_a.accelerator_pressed_count()); |
+ EXPECT_EQ(2, target_a.accelerator_repeat_count()); |
+ generator.ReleaseKey(ui::VKEY_A, ui::EF_CONTROL_DOWN); |
+ EXPECT_EQ(2, target_a.accelerator_pressed_count()); |
+ EXPECT_EQ(2, target_a.accelerator_repeat_count()); |
+ |
+ // Long press was intercepted by another key press. |
+ generator.PressKey(ui::VKEY_A, ui::EF_CONTROL_DOWN); |
+ generator.PressKey(ui::VKEY_A, ui::EF_CONTROL_DOWN | ui::EF_IS_REPEAT); |
+ generator.PressKey(ui::VKEY_B, ui::EF_CONTROL_DOWN); |
+ generator.ReleaseKey(ui::VKEY_B, ui::EF_CONTROL_DOWN); |
+ generator.PressKey(ui::VKEY_A, ui::EF_CONTROL_DOWN); |
+ generator.PressKey(ui::VKEY_A, ui::EF_CONTROL_DOWN | ui::EF_IS_REPEAT); |
+ generator.ReleaseKey(ui::VKEY_A, ui::EF_CONTROL_DOWN); |
+ |
+ EXPECT_EQ(1, target_b.accelerator_pressed_count()); |
+ EXPECT_EQ(0, target_b.accelerator_repeat_count()); |
+ EXPECT_EQ(4, target_a.accelerator_pressed_count()); |
+ EXPECT_EQ(4, target_a.accelerator_repeat_count()); |
} |
-#if defined(OS_WIN) && defined(USE_AURA) |
-// crbug.com/314674 |
-#define MAYBE_SuppressToggleMaximized DISABLED_SuppressToggleMaximized |
-#else |
-#define MAYBE_SuppressToggleMaximized SuppressToggleMaximized |
-#endif |
+TEST_F(AcceleratorControllerTest, Previous) { |
+ aura::test::EventGenerator& generator = GetEventGenerator(); |
+ generator.PressKey(ui::VKEY_VOLUME_MUTE, ui::EF_NONE); |
+ generator.ReleaseKey(ui::VKEY_VOLUME_MUTE, ui::EF_NONE); |
-TEST_F(AcceleratorControllerTest, MAYBE_SuppressToggleMaximized) { |
- scoped_ptr<aura::Window> window( |
- CreateTestWindowInShellWithBounds(gfx::Rect(5, 5, 20, 20))); |
- wm::ActivateWindow(window.get()); |
- const ui::Accelerator accelerator(ui::VKEY_A, ui::EF_NONE); |
- const ui::Accelerator empty_accelerator; |
+ EXPECT_EQ(ui::VKEY_VOLUME_MUTE, |
+ GetController()->previous_accelerator_for_test().key_code()); |
+ EXPECT_EQ(ui::EF_NONE, |
+ GetController()->previous_accelerator_for_test().modifiers()); |
- wm::WindowState* window_state = wm::GetWindowState(window.get()); |
+ generator.PressKey(ui::VKEY_TAB, ui::EF_CONTROL_DOWN); |
+ generator.ReleaseKey(ui::VKEY_TAB, ui::EF_CONTROL_DOWN); |
+ |
+ EXPECT_EQ(ui::VKEY_TAB, |
+ GetController()->previous_accelerator_for_test().key_code()); |
+ EXPECT_EQ(ui::EF_CONTROL_DOWN, |
+ GetController()->previous_accelerator_for_test().modifiers()); |
+} |
+ |
+TEST_F(AcceleratorControllerTest, DontRepeatToggleFullscreen) { |
+ const AcceleratorData accelerators[] = { |
+ {true, ui::VKEY_J, ui::EF_ALT_DOWN, TOGGLE_FULLSCREEN}, |
+ {true, ui::VKEY_K, ui::EF_ALT_DOWN, TOGGLE_FULLSCREEN}, |
+ }; |
+ GetController()->RegisterAccelerators(accelerators, arraysize(accelerators)); |
+ |
+ views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW); |
+ params.context = CurrentContext(); |
+ params.bounds = gfx::Rect(5, 5, 20, 20); |
+ views::Widget* widget = new views::Widget; |
+ widget->Init(params); |
+ widget->Show(); |
+ widget->Activate(); |
+ widget->GetNativeView()->SetProperty(aura::client::kCanMaximizeKey, true); |
+ |
+ aura::test::EventGenerator& generator = GetEventGenerator(); |
+ wm::WindowState* window_state = wm::GetWindowState(widget->GetNativeView()); |
// Toggling not suppressed. |
- GetController()->context()->UpdateContext(accelerator); |
- GetController()->PerformAction(TOGGLE_MAXIMIZED, accelerator); |
- EXPECT_TRUE(window_state->IsMaximized()); |
+ generator.PressKey(ui::VKEY_J, ui::EF_ALT_DOWN); |
+ EXPECT_TRUE(window_state->IsFullscreen()); |
// The same accelerator - toggling suppressed. |
- GetController()->context()->UpdateContext(accelerator); |
- GetController()->PerformAction(TOGGLE_MAXIMIZED, accelerator); |
- EXPECT_TRUE(window_state->IsMaximized()); |
+ generator.PressKey(ui::VKEY_J, ui::EF_ALT_DOWN | ui::EF_IS_REPEAT); |
+ EXPECT_TRUE(window_state->IsFullscreen()); |
- // Suppressed but not for gesture events. |
- GetController()->PerformAction(TOGGLE_MAXIMIZED, empty_accelerator); |
- EXPECT_FALSE(window_state->IsMaximized()); |
+ // Different accelerator. |
+ generator.PressKey(ui::VKEY_K, ui::EF_ALT_DOWN); |
+ EXPECT_FALSE(window_state->IsFullscreen()); |
} |
-#if defined(OS_WIN) && defined(USE_AURA) |
+// TODO(oshima): Fix this test to use EventGenerator. |
+#if defined(OS_WIN) |
// crbug.com/317592 |
#define MAYBE_ProcessOnce DISABLED_ProcessOnce |
#else |
@@ -632,13 +665,13 @@ TEST_F(AcceleratorControllerTest, MAYBE_ProcessOnce) { |
TEST_F(AcceleratorControllerTest, GlobalAccelerators) { |
// CycleBackward |
- EXPECT_TRUE(ProcessWithContext( |
+ EXPECT_TRUE(GetController()->Process( |
ui::Accelerator(ui::VKEY_TAB, ui::EF_SHIFT_DOWN | ui::EF_ALT_DOWN))); |
// CycleForward |
- EXPECT_TRUE(ProcessWithContext( |
- ui::Accelerator(ui::VKEY_TAB, ui::EF_ALT_DOWN))); |
+ EXPECT_TRUE( |
+ GetController()->Process(ui::Accelerator(ui::VKEY_TAB, ui::EF_ALT_DOWN))); |
// CycleLinear |
- EXPECT_TRUE(ProcessWithContext( |
+ EXPECT_TRUE(GetController()->Process( |
ui::Accelerator(ui::VKEY_MEDIA_LAUNCH_APP1, ui::EF_NONE))); |
#if defined(OS_CHROMEOS) |
@@ -647,25 +680,23 @@ TEST_F(AcceleratorControllerTest, GlobalAccelerators) { |
{ |
test::TestScreenshotDelegate* delegate = GetScreenshotDelegate(); |
delegate->set_can_take_screenshot(false); |
- EXPECT_TRUE(ProcessWithContext( |
+ EXPECT_TRUE(GetController()->Process( |
ui::Accelerator(ui::VKEY_MEDIA_LAUNCH_APP1, ui::EF_CONTROL_DOWN))); |
- EXPECT_TRUE(ProcessWithContext( |
- ui::Accelerator(ui::VKEY_PRINT, ui::EF_NONE))); |
- EXPECT_TRUE(ProcessWithContext( |
- ui::Accelerator(ui::VKEY_MEDIA_LAUNCH_APP1, |
- ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN))); |
+ EXPECT_TRUE( |
+ GetController()->Process(ui::Accelerator(ui::VKEY_PRINT, ui::EF_NONE))); |
+ EXPECT_TRUE(GetController()->Process(ui::Accelerator( |
+ ui::VKEY_MEDIA_LAUNCH_APP1, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN))); |
delegate->set_can_take_screenshot(true); |
EXPECT_EQ(0, delegate->handle_take_screenshot_count()); |
- EXPECT_TRUE(ProcessWithContext( |
+ EXPECT_TRUE(GetController()->Process( |
ui::Accelerator(ui::VKEY_MEDIA_LAUNCH_APP1, ui::EF_CONTROL_DOWN))); |
EXPECT_EQ(1, delegate->handle_take_screenshot_count()); |
- EXPECT_TRUE(ProcessWithContext( |
- ui::Accelerator(ui::VKEY_PRINT, ui::EF_NONE))); |
+ EXPECT_TRUE( |
+ GetController()->Process(ui::Accelerator(ui::VKEY_PRINT, ui::EF_NONE))); |
EXPECT_EQ(2, delegate->handle_take_screenshot_count()); |
- EXPECT_TRUE(ProcessWithContext( |
- ui::Accelerator(ui::VKEY_MEDIA_LAUNCH_APP1, |
- ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN))); |
+ EXPECT_TRUE(GetController()->Process(ui::Accelerator( |
+ ui::VKEY_MEDIA_LAUNCH_APP1, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN))); |
EXPECT_EQ(2, delegate->handle_take_screenshot_count()); |
} |
#endif |
@@ -678,15 +709,15 @@ TEST_F(AcceleratorControllerTest, GlobalAccelerators) { |
ash::Shell::GetInstance()->system_tray_delegate()->SetVolumeControlDelegate( |
scoped_ptr<VolumeControlDelegate>(delegate).Pass()); |
EXPECT_EQ(0, delegate->handle_volume_mute_count()); |
- EXPECT_FALSE(ProcessWithContext(volume_mute)); |
+ EXPECT_FALSE(GetController()->Process(volume_mute)); |
EXPECT_EQ(1, delegate->handle_volume_mute_count()); |
EXPECT_EQ(volume_mute, delegate->last_accelerator()); |
EXPECT_EQ(0, delegate->handle_volume_down_count()); |
- EXPECT_FALSE(ProcessWithContext(volume_down)); |
+ EXPECT_FALSE(GetController()->Process(volume_down)); |
EXPECT_EQ(1, delegate->handle_volume_down_count()); |
EXPECT_EQ(volume_down, delegate->last_accelerator()); |
EXPECT_EQ(0, delegate->handle_volume_up_count()); |
- EXPECT_FALSE(ProcessWithContext(volume_up)); |
+ EXPECT_FALSE(GetController()->Process(volume_up)); |
EXPECT_EQ(1, delegate->handle_volume_up_count()); |
EXPECT_EQ(volume_up, delegate->last_accelerator()); |
} |
@@ -695,15 +726,15 @@ TEST_F(AcceleratorControllerTest, GlobalAccelerators) { |
ash::Shell::GetInstance()->system_tray_delegate()->SetVolumeControlDelegate( |
scoped_ptr<VolumeControlDelegate>(delegate).Pass()); |
EXPECT_EQ(0, delegate->handle_volume_mute_count()); |
- EXPECT_TRUE(ProcessWithContext(volume_mute)); |
+ EXPECT_TRUE(GetController()->Process(volume_mute)); |
EXPECT_EQ(1, delegate->handle_volume_mute_count()); |
EXPECT_EQ(volume_mute, delegate->last_accelerator()); |
EXPECT_EQ(0, delegate->handle_volume_down_count()); |
- EXPECT_TRUE(ProcessWithContext(volume_down)); |
+ EXPECT_TRUE(GetController()->Process(volume_down)); |
EXPECT_EQ(1, delegate->handle_volume_down_count()); |
EXPECT_EQ(volume_down, delegate->last_accelerator()); |
EXPECT_EQ(0, delegate->handle_volume_up_count()); |
- EXPECT_TRUE(ProcessWithContext(volume_up)); |
+ EXPECT_TRUE(GetController()->Process(volume_up)); |
EXPECT_EQ(1, delegate->handle_volume_up_count()); |
EXPECT_EQ(volume_up, delegate->last_accelerator()); |
} |
@@ -718,11 +749,11 @@ TEST_F(AcceleratorControllerTest, GlobalAccelerators) { |
GetController()->SetBrightnessControlDelegate( |
scoped_ptr<BrightnessControlDelegate>(delegate).Pass()); |
EXPECT_EQ(0, delegate->handle_brightness_down_count()); |
- EXPECT_FALSE(ProcessWithContext(brightness_down)); |
+ EXPECT_FALSE(GetController()->Process(brightness_down)); |
EXPECT_EQ(1, delegate->handle_brightness_down_count()); |
EXPECT_EQ(brightness_down, delegate->last_accelerator()); |
EXPECT_EQ(0, delegate->handle_brightness_up_count()); |
- EXPECT_FALSE(ProcessWithContext(brightness_up)); |
+ EXPECT_FALSE(GetController()->Process(brightness_up)); |
EXPECT_EQ(1, delegate->handle_brightness_up_count()); |
EXPECT_EQ(brightness_up, delegate->last_accelerator()); |
} |
@@ -732,11 +763,11 @@ TEST_F(AcceleratorControllerTest, GlobalAccelerators) { |
GetController()->SetBrightnessControlDelegate( |
scoped_ptr<BrightnessControlDelegate>(delegate).Pass()); |
EXPECT_EQ(0, delegate->handle_brightness_down_count()); |
- EXPECT_TRUE(ProcessWithContext(brightness_down)); |
+ EXPECT_TRUE(GetController()->Process(brightness_down)); |
EXPECT_EQ(1, delegate->handle_brightness_down_count()); |
EXPECT_EQ(brightness_down, delegate->last_accelerator()); |
EXPECT_EQ(0, delegate->handle_brightness_up_count()); |
- EXPECT_TRUE(ProcessWithContext(brightness_up)); |
+ EXPECT_TRUE(GetController()->Process(brightness_up)); |
EXPECT_EQ(1, delegate->handle_brightness_up_count()); |
EXPECT_EQ(brightness_up, delegate->last_accelerator()); |
} |
@@ -747,18 +778,18 @@ TEST_F(AcceleratorControllerTest, GlobalAccelerators) { |
const ui::Accelerator alt_brightness_up(ui::VKEY_BRIGHTNESS_UP, |
ui::EF_ALT_DOWN); |
{ |
- EXPECT_TRUE(ProcessWithContext(alt_brightness_down)); |
- EXPECT_TRUE(ProcessWithContext(alt_brightness_up)); |
+ EXPECT_TRUE(GetController()->Process(alt_brightness_down)); |
+ EXPECT_TRUE(GetController()->Process(alt_brightness_up)); |
DummyKeyboardBrightnessControlDelegate* delegate = |
new DummyKeyboardBrightnessControlDelegate(false); |
GetController()->SetKeyboardBrightnessControlDelegate( |
scoped_ptr<KeyboardBrightnessControlDelegate>(delegate).Pass()); |
EXPECT_EQ(0, delegate->handle_keyboard_brightness_down_count()); |
- EXPECT_FALSE(ProcessWithContext(alt_brightness_down)); |
+ EXPECT_FALSE(GetController()->Process(alt_brightness_down)); |
EXPECT_EQ(1, delegate->handle_keyboard_brightness_down_count()); |
EXPECT_EQ(alt_brightness_down, delegate->last_accelerator()); |
EXPECT_EQ(0, delegate->handle_keyboard_brightness_up_count()); |
- EXPECT_FALSE(ProcessWithContext(alt_brightness_up)); |
+ EXPECT_FALSE(GetController()->Process(alt_brightness_up)); |
EXPECT_EQ(1, delegate->handle_keyboard_brightness_up_count()); |
EXPECT_EQ(alt_brightness_up, delegate->last_accelerator()); |
} |
@@ -768,11 +799,11 @@ TEST_F(AcceleratorControllerTest, GlobalAccelerators) { |
GetController()->SetKeyboardBrightnessControlDelegate( |
scoped_ptr<KeyboardBrightnessControlDelegate>(delegate).Pass()); |
EXPECT_EQ(0, delegate->handle_keyboard_brightness_down_count()); |
- EXPECT_TRUE(ProcessWithContext(alt_brightness_down)); |
+ EXPECT_TRUE(GetController()->Process(alt_brightness_down)); |
EXPECT_EQ(1, delegate->handle_keyboard_brightness_down_count()); |
EXPECT_EQ(alt_brightness_down, delegate->last_accelerator()); |
EXPECT_EQ(0, delegate->handle_keyboard_brightness_up_count()); |
- EXPECT_TRUE(ProcessWithContext(alt_brightness_up)); |
+ EXPECT_TRUE(GetController()->Process(alt_brightness_up)); |
EXPECT_EQ(1, delegate->handle_keyboard_brightness_up_count()); |
EXPECT_EQ(alt_brightness_up, delegate->last_accelerator()); |
} |
@@ -780,11 +811,11 @@ TEST_F(AcceleratorControllerTest, GlobalAccelerators) { |
#if !defined(NDEBUG) |
// ToggleDesktopBackgroundMode |
- EXPECT_TRUE(ProcessWithContext( |
+ EXPECT_TRUE(GetController()->Process( |
ui::Accelerator(ui::VKEY_B, ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN))); |
#if !defined(OS_LINUX) |
// ToggleDesktopFullScreen (not implemented yet on Linux) |
- EXPECT_TRUE(ProcessWithContext( |
+ EXPECT_TRUE(GetController()->Process( |
ui::Accelerator(ui::VKEY_F11, ui::EF_CONTROL_DOWN))); |
#endif // OS_LINUX |
#endif // !NDEBUG |
@@ -796,7 +827,7 @@ TEST_F(AcceleratorControllerTest, GlobalAccelerators) { |
StubForTest(ewh); |
EXPECT_TRUE(is_idle(ewh)); |
EXPECT_FALSE(is_ui_shown(ewh)); |
- EXPECT_TRUE(ProcessWithContext( |
+ EXPECT_TRUE(GetController()->Process( |
ui::Accelerator(ui::VKEY_Q, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN))); |
EXPECT_FALSE(is_idle(ewh)); |
EXPECT_TRUE(is_ui_shown(ewh)); |
@@ -807,35 +838,35 @@ TEST_F(AcceleratorControllerTest, GlobalAccelerators) { |
#endif |
// New tab |
- EXPECT_TRUE(ProcessWithContext( |
+ EXPECT_TRUE(GetController()->Process( |
ui::Accelerator(ui::VKEY_T, ui::EF_CONTROL_DOWN))); |
// New incognito window |
- EXPECT_TRUE(ProcessWithContext( |
+ EXPECT_TRUE(GetController()->Process( |
ui::Accelerator(ui::VKEY_N, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN))); |
// New window |
- EXPECT_TRUE(ProcessWithContext( |
+ EXPECT_TRUE(GetController()->Process( |
ui::Accelerator(ui::VKEY_N, ui::EF_CONTROL_DOWN))); |
// Restore tab |
- EXPECT_TRUE(ProcessWithContext( |
+ EXPECT_TRUE(GetController()->Process( |
ui::Accelerator(ui::VKEY_T, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN))); |
// Show task manager |
- EXPECT_TRUE(ProcessWithContext( |
+ EXPECT_TRUE(GetController()->Process( |
ui::Accelerator(ui::VKEY_ESCAPE, ui::EF_SHIFT_DOWN))); |
#if defined(OS_CHROMEOS) |
// Open file manager |
- EXPECT_TRUE(ProcessWithContext( |
- ui::Accelerator(ui::VKEY_M, ui::EF_SHIFT_DOWN | ui::EF_ALT_DOWN))); |
+ EXPECT_TRUE(GetController()->Process( |
+ ui::Accelerator(ui::VKEY_M, ui::EF_SHIFT_DOWN | ui::EF_ALT_DOWN))); |
// Lock screen |
// NOTE: Accelerators that do not work on the lock screen need to be |
// tested before the sequence below is invoked because it causes a side |
// effect of locking the screen. |
- EXPECT_TRUE(ProcessWithContext( |
+ EXPECT_TRUE(GetController()->Process( |
ui::Accelerator(ui::VKEY_L, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN))); |
#endif |
} |
@@ -846,33 +877,36 @@ TEST_F(AcceleratorControllerTest, GlobalAcceleratorsToggleAppList) { |
EXPECT_FALSE(ash::Shell::GetInstance()->GetAppListTargetVisibility()); |
// The press event should not open the AppList, the release should instead. |
- EXPECT_FALSE(ProcessWithContext( |
- ui::Accelerator(ui::VKEY_LWIN, ui::EF_NONE))); |
- EXPECT_TRUE(ProcessWithContext( |
- ReleaseAccelerator(ui::VKEY_LWIN, ui::EF_NONE))); |
+ EXPECT_FALSE( |
+ GetController()->Process(ui::Accelerator(ui::VKEY_LWIN, ui::EF_NONE))); |
+ EXPECT_EQ(ui::VKEY_LWIN, |
+ GetController()->previous_accelerator_for_test().key_code()); |
+ |
+ EXPECT_TRUE( |
+ GetController()->Process(ReleaseAccelerator(ui::VKEY_LWIN, ui::EF_NONE))); |
EXPECT_TRUE(ash::Shell::GetInstance()->GetAppListTargetVisibility()); |
// When spoken feedback is on, the AppList should not toggle. |
delegate->ToggleSpokenFeedback(A11Y_NOTIFICATION_NONE); |
- EXPECT_FALSE(ProcessWithContext( |
- ui::Accelerator(ui::VKEY_LWIN, ui::EF_NONE))); |
- EXPECT_FALSE(ProcessWithContext( |
- ReleaseAccelerator(ui::VKEY_LWIN, ui::EF_NONE))); |
+ EXPECT_FALSE( |
+ GetController()->Process(ui::Accelerator(ui::VKEY_LWIN, ui::EF_NONE))); |
+ EXPECT_FALSE( |
+ GetController()->Process(ReleaseAccelerator(ui::VKEY_LWIN, ui::EF_NONE))); |
delegate->ToggleSpokenFeedback(A11Y_NOTIFICATION_NONE); |
EXPECT_TRUE(ash::Shell::GetInstance()->GetAppListTargetVisibility()); |
- EXPECT_FALSE(ProcessWithContext( |
- ui::Accelerator(ui::VKEY_LWIN, ui::EF_NONE))); |
- EXPECT_TRUE(ProcessWithContext( |
- ReleaseAccelerator(ui::VKEY_LWIN, ui::EF_NONE))); |
+ EXPECT_FALSE( |
+ GetController()->Process(ui::Accelerator(ui::VKEY_LWIN, ui::EF_NONE))); |
+ EXPECT_TRUE( |
+ GetController()->Process(ReleaseAccelerator(ui::VKEY_LWIN, ui::EF_NONE))); |
EXPECT_FALSE(ash::Shell::GetInstance()->GetAppListTargetVisibility()); |
// When spoken feedback is on, the AppList should not toggle. |
delegate->ToggleSpokenFeedback(A11Y_NOTIFICATION_NONE); |
- EXPECT_FALSE(ProcessWithContext( |
- ui::Accelerator(ui::VKEY_LWIN, ui::EF_NONE))); |
- EXPECT_FALSE(ProcessWithContext( |
- ReleaseAccelerator(ui::VKEY_LWIN, ui::EF_NONE))); |
+ EXPECT_FALSE( |
+ GetController()->Process(ui::Accelerator(ui::VKEY_LWIN, ui::EF_NONE))); |
+ EXPECT_FALSE( |
+ GetController()->Process(ReleaseAccelerator(ui::VKEY_LWIN, ui::EF_NONE))); |
delegate->ToggleSpokenFeedback(A11Y_NOTIFICATION_NONE); |
EXPECT_FALSE(ash::Shell::GetInstance()->GetAppListTargetVisibility()); |
} |
@@ -886,28 +920,28 @@ TEST_F(AcceleratorControllerTest, ImeGlobalAccelerators) { |
const ui::Accelerator wide_half_1(ui::VKEY_DBE_SBCSCHAR, ui::EF_NONE); |
const ui::Accelerator wide_half_2(ui::VKEY_DBE_DBCSCHAR, ui::EF_NONE); |
const ui::Accelerator hangul(ui::VKEY_HANGUL, ui::EF_NONE); |
- EXPECT_FALSE(ProcessWithContext(control_space)); |
- EXPECT_FALSE(ProcessWithContext(convert)); |
- EXPECT_FALSE(ProcessWithContext(non_convert)); |
- EXPECT_FALSE(ProcessWithContext(wide_half_1)); |
- EXPECT_FALSE(ProcessWithContext(wide_half_2)); |
- EXPECT_FALSE(ProcessWithContext(hangul)); |
+ EXPECT_FALSE(GetController()->Process(control_space)); |
+ EXPECT_FALSE(GetController()->Process(convert)); |
+ EXPECT_FALSE(GetController()->Process(non_convert)); |
+ EXPECT_FALSE(GetController()->Process(wide_half_1)); |
+ EXPECT_FALSE(GetController()->Process(wide_half_2)); |
+ EXPECT_FALSE(GetController()->Process(hangul)); |
DummyImeControlDelegate* delegate = new DummyImeControlDelegate(true); |
GetController()->SetImeControlDelegate( |
scoped_ptr<ImeControlDelegate>(delegate).Pass()); |
EXPECT_EQ(0, delegate->handle_previous_ime_count()); |
- EXPECT_TRUE(ProcessWithContext(control_space)); |
+ EXPECT_TRUE(GetController()->Process(control_space)); |
EXPECT_EQ(1, delegate->handle_previous_ime_count()); |
EXPECT_EQ(0, delegate->handle_switch_ime_count()); |
- EXPECT_TRUE(ProcessWithContext(convert)); |
+ EXPECT_TRUE(GetController()->Process(convert)); |
EXPECT_EQ(1, delegate->handle_switch_ime_count()); |
- EXPECT_TRUE(ProcessWithContext(non_convert)); |
+ EXPECT_TRUE(GetController()->Process(non_convert)); |
EXPECT_EQ(2, delegate->handle_switch_ime_count()); |
- EXPECT_TRUE(ProcessWithContext(wide_half_1)); |
+ EXPECT_TRUE(GetController()->Process(wide_half_1)); |
EXPECT_EQ(3, delegate->handle_switch_ime_count()); |
- EXPECT_TRUE(ProcessWithContext(wide_half_2)); |
+ EXPECT_TRUE(GetController()->Process(wide_half_2)); |
EXPECT_EQ(4, delegate->handle_switch_ime_count()); |
- EXPECT_TRUE(ProcessWithContext(hangul)); |
+ EXPECT_TRUE(GetController()->Process(hangul)); |
EXPECT_EQ(5, delegate->handle_switch_ime_count()); |
} |
@@ -924,11 +958,11 @@ TEST_F(AcceleratorControllerTest, ImeGlobalAccelerators) { |
GetController()->SetImeControlDelegate( |
scoped_ptr<ImeControlDelegate>(delegate).Pass()); |
EXPECT_EQ(0, delegate->handle_next_ime_count()); |
- EXPECT_FALSE(ProcessWithContext(shift_alt_press)); |
- EXPECT_TRUE(ProcessWithContext(shift_alt)); |
+ EXPECT_FALSE(GetController()->Process(shift_alt_press)); |
+ EXPECT_TRUE(GetController()->Process(shift_alt)); |
EXPECT_EQ(1, delegate->handle_next_ime_count()); |
- EXPECT_FALSE(ProcessWithContext(alt_shift_press)); |
- EXPECT_TRUE(ProcessWithContext(alt_shift)); |
+ EXPECT_FALSE(GetController()->Process(alt_shift_press)); |
+ EXPECT_TRUE(GetController()->Process(alt_shift)); |
EXPECT_EQ(2, delegate->handle_next_ime_count()); |
// We should NOT switch IME when e.g. Shift+Alt+X is pressed and X is |
@@ -939,10 +973,10 @@ TEST_F(AcceleratorControllerTest, ImeGlobalAccelerators) { |
const ReleaseAccelerator shift_alt_x(ui::VKEY_X, |
ui::EF_SHIFT_DOWN | ui::EF_ALT_DOWN); |
- EXPECT_FALSE(ProcessWithContext(shift_alt_press)); |
- EXPECT_FALSE(ProcessWithContext(shift_alt_x_press)); |
- EXPECT_FALSE(ProcessWithContext(shift_alt_x)); |
- EXPECT_FALSE(ProcessWithContext(shift_alt)); |
+ EXPECT_FALSE(GetController()->Process(shift_alt_press)); |
+ EXPECT_FALSE(GetController()->Process(shift_alt_x_press)); |
+ EXPECT_FALSE(GetController()->Process(shift_alt_x)); |
+ EXPECT_FALSE(GetController()->Process(shift_alt)); |
EXPECT_EQ(2, delegate->handle_next_ime_count()); |
// But we _should_ if X is either VKEY_RETURN or VKEY_SPACE. |
@@ -954,10 +988,10 @@ TEST_F(AcceleratorControllerTest, ImeGlobalAccelerators) { |
ui::VKEY_RETURN, |
ui::EF_SHIFT_DOWN | ui::EF_ALT_DOWN); |
- EXPECT_FALSE(ProcessWithContext(shift_alt_press)); |
- EXPECT_FALSE(ProcessWithContext(shift_alt_return_press)); |
- EXPECT_FALSE(ProcessWithContext(shift_alt_return)); |
- EXPECT_TRUE(ProcessWithContext(shift_alt)); |
+ EXPECT_FALSE(GetController()->Process(shift_alt_press)); |
+ EXPECT_FALSE(GetController()->Process(shift_alt_return_press)); |
+ EXPECT_FALSE(GetController()->Process(shift_alt_return)); |
+ EXPECT_TRUE(GetController()->Process(shift_alt)); |
EXPECT_EQ(3, delegate->handle_next_ime_count()); |
const ui::Accelerator shift_alt_space_press( |
@@ -967,10 +1001,10 @@ TEST_F(AcceleratorControllerTest, ImeGlobalAccelerators) { |
ui::VKEY_SPACE, |
ui::EF_SHIFT_DOWN | ui::EF_ALT_DOWN); |
- EXPECT_FALSE(ProcessWithContext(shift_alt_press)); |
- EXPECT_FALSE(ProcessWithContext(shift_alt_space_press)); |
- EXPECT_FALSE(ProcessWithContext(shift_alt_space)); |
- EXPECT_TRUE(ProcessWithContext(shift_alt)); |
+ EXPECT_FALSE(GetController()->Process(shift_alt_press)); |
+ EXPECT_FALSE(GetController()->Process(shift_alt_space_press)); |
+ EXPECT_FALSE(GetController()->Process(shift_alt_space)); |
+ EXPECT_TRUE(GetController()->Process(shift_alt)); |
EXPECT_EQ(4, delegate->handle_next_ime_count()); |
} |
@@ -986,11 +1020,11 @@ TEST_F(AcceleratorControllerTest, ImeGlobalAccelerators) { |
GetController()->SetImeControlDelegate( |
scoped_ptr<ImeControlDelegate>(delegate).Pass()); |
EXPECT_EQ(0, delegate->handle_next_ime_count()); |
- EXPECT_FALSE(ProcessWithContext(shift_alt_press)); |
- EXPECT_TRUE(ProcessWithContext(shift_alt)); |
+ EXPECT_FALSE(GetController()->Process(shift_alt_press)); |
+ EXPECT_TRUE(GetController()->Process(shift_alt)); |
EXPECT_EQ(1, delegate->handle_next_ime_count()); |
- EXPECT_FALSE(ProcessWithContext(alt_shift_press)); |
- EXPECT_TRUE(ProcessWithContext(alt_shift)); |
+ EXPECT_FALSE(GetController()->Process(alt_shift_press)); |
+ EXPECT_TRUE(GetController()->Process(alt_shift)); |
EXPECT_EQ(2, delegate->handle_next_ime_count()); |
// We should NOT switch IME when e.g. Shift+Alt+X is pressed and X is |
@@ -1001,10 +1035,10 @@ TEST_F(AcceleratorControllerTest, ImeGlobalAccelerators) { |
const ReleaseAccelerator shift_alt_x(ui::VKEY_X, |
ui::EF_SHIFT_DOWN | ui::EF_ALT_DOWN); |
- EXPECT_FALSE(ProcessWithContext(shift_alt_press)); |
- EXPECT_FALSE(ProcessWithContext(shift_alt_x_press)); |
- EXPECT_FALSE(ProcessWithContext(shift_alt_x)); |
- EXPECT_FALSE(ProcessWithContext(shift_alt)); |
+ EXPECT_FALSE(GetController()->Process(shift_alt_press)); |
+ EXPECT_FALSE(GetController()->Process(shift_alt_x_press)); |
+ EXPECT_FALSE(GetController()->Process(shift_alt_x)); |
+ EXPECT_FALSE(GetController()->Process(shift_alt)); |
EXPECT_EQ(2, delegate->handle_next_ime_count()); |
} |
#endif |
@@ -1017,11 +1051,11 @@ TEST_F(AcceleratorControllerTest, ImeGlobalAcceleratorsWorkaround139556) { |
const ui::Accelerator shift_alt_return_press( |
ui::VKEY_RETURN, |
ui::EF_SHIFT_DOWN | ui::EF_ALT_DOWN); |
- EXPECT_FALSE(ProcessWithContext(shift_alt_return_press)); |
+ EXPECT_FALSE(GetController()->Process(shift_alt_return_press)); |
const ui::Accelerator shift_alt_space_press( |
ui::VKEY_SPACE, |
ui::EF_SHIFT_DOWN | ui::EF_ALT_DOWN); |
- EXPECT_FALSE(ProcessWithContext(shift_alt_space_press)); |
+ EXPECT_FALSE(GetController()->Process(shift_alt_space_press)); |
} |
TEST_F(AcceleratorControllerTest, ReservedAccelerators) { |
@@ -1090,24 +1124,22 @@ TEST_F(AcceleratorControllerTest, DisallowedAtModalWindow) { |
{ |
test::TestScreenshotDelegate* delegate = GetScreenshotDelegate(); |
delegate->set_can_take_screenshot(false); |
- EXPECT_TRUE(ProcessWithContext( |
+ EXPECT_TRUE(GetController()->Process( |
ui::Accelerator(ui::VKEY_MEDIA_LAUNCH_APP1, ui::EF_CONTROL_DOWN))); |
- EXPECT_TRUE(ProcessWithContext( |
- ui::Accelerator(ui::VKEY_PRINT, ui::EF_NONE))); |
- EXPECT_TRUE(ProcessWithContext( |
- ui::Accelerator(ui::VKEY_MEDIA_LAUNCH_APP1, |
- ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN))); |
+ EXPECT_TRUE( |
+ GetController()->Process(ui::Accelerator(ui::VKEY_PRINT, ui::EF_NONE))); |
+ EXPECT_TRUE(GetController()->Process(ui::Accelerator( |
+ ui::VKEY_MEDIA_LAUNCH_APP1, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN))); |
delegate->set_can_take_screenshot(true); |
EXPECT_EQ(0, delegate->handle_take_screenshot_count()); |
- EXPECT_TRUE(ProcessWithContext( |
+ EXPECT_TRUE(GetController()->Process( |
ui::Accelerator(ui::VKEY_MEDIA_LAUNCH_APP1, ui::EF_CONTROL_DOWN))); |
EXPECT_EQ(1, delegate->handle_take_screenshot_count()); |
- EXPECT_TRUE(ProcessWithContext( |
- ui::Accelerator(ui::VKEY_PRINT, ui::EF_NONE))); |
+ EXPECT_TRUE( |
+ GetController()->Process(ui::Accelerator(ui::VKEY_PRINT, ui::EF_NONE))); |
EXPECT_EQ(2, delegate->handle_take_screenshot_count()); |
- EXPECT_TRUE(ProcessWithContext( |
- ui::Accelerator(ui::VKEY_MEDIA_LAUNCH_APP1, |
- ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN))); |
+ EXPECT_TRUE(GetController()->Process(ui::Accelerator( |
+ ui::VKEY_MEDIA_LAUNCH_APP1, ui::EF_SHIFT_DOWN | ui::EF_CONTROL_DOWN))); |
EXPECT_EQ(2, delegate->handle_take_screenshot_count()); |
} |
// Brightness |
@@ -1119,11 +1151,11 @@ TEST_F(AcceleratorControllerTest, DisallowedAtModalWindow) { |
GetController()->SetBrightnessControlDelegate( |
scoped_ptr<BrightnessControlDelegate>(delegate).Pass()); |
EXPECT_EQ(0, delegate->handle_brightness_down_count()); |
- EXPECT_FALSE(ProcessWithContext(brightness_down)); |
+ EXPECT_FALSE(GetController()->Process(brightness_down)); |
EXPECT_EQ(1, delegate->handle_brightness_down_count()); |
EXPECT_EQ(brightness_down, delegate->last_accelerator()); |
EXPECT_EQ(0, delegate->handle_brightness_up_count()); |
- EXPECT_FALSE(ProcessWithContext(brightness_up)); |
+ EXPECT_FALSE(GetController()->Process(brightness_up)); |
EXPECT_EQ(1, delegate->handle_brightness_up_count()); |
EXPECT_EQ(brightness_up, delegate->last_accelerator()); |
} |
@@ -1133,11 +1165,11 @@ TEST_F(AcceleratorControllerTest, DisallowedAtModalWindow) { |
GetController()->SetBrightnessControlDelegate( |
scoped_ptr<BrightnessControlDelegate>(delegate).Pass()); |
EXPECT_EQ(0, delegate->handle_brightness_down_count()); |
- EXPECT_TRUE(ProcessWithContext(brightness_down)); |
+ EXPECT_TRUE(GetController()->Process(brightness_down)); |
EXPECT_EQ(1, delegate->handle_brightness_down_count()); |
EXPECT_EQ(brightness_down, delegate->last_accelerator()); |
EXPECT_EQ(0, delegate->handle_brightness_up_count()); |
- EXPECT_TRUE(ProcessWithContext(brightness_up)); |
+ EXPECT_TRUE(GetController()->Process(brightness_up)); |
EXPECT_EQ(1, delegate->handle_brightness_up_count()); |
EXPECT_EQ(brightness_up, delegate->last_accelerator()); |
} |
@@ -1146,23 +1178,23 @@ TEST_F(AcceleratorControllerTest, DisallowedAtModalWindow) { |
const ui::Accelerator volume_down(ui::VKEY_VOLUME_DOWN, ui::EF_NONE); |
const ui::Accelerator volume_up(ui::VKEY_VOLUME_UP, ui::EF_NONE); |
{ |
- EXPECT_TRUE(ProcessWithContext(volume_mute)); |
- EXPECT_TRUE(ProcessWithContext(volume_down)); |
- EXPECT_TRUE(ProcessWithContext(volume_up)); |
+ EXPECT_TRUE(GetController()->Process(volume_mute)); |
+ EXPECT_TRUE(GetController()->Process(volume_down)); |
+ EXPECT_TRUE(GetController()->Process(volume_up)); |
TestVolumeControlDelegate* delegate = |
new TestVolumeControlDelegate(false); |
ash::Shell::GetInstance()->system_tray_delegate()->SetVolumeControlDelegate( |
scoped_ptr<VolumeControlDelegate>(delegate).Pass()); |
EXPECT_EQ(0, delegate->handle_volume_mute_count()); |
- EXPECT_FALSE(ProcessWithContext(volume_mute)); |
+ EXPECT_FALSE(GetController()->Process(volume_mute)); |
EXPECT_EQ(1, delegate->handle_volume_mute_count()); |
EXPECT_EQ(volume_mute, delegate->last_accelerator()); |
EXPECT_EQ(0, delegate->handle_volume_down_count()); |
- EXPECT_FALSE(ProcessWithContext(volume_down)); |
+ EXPECT_FALSE(GetController()->Process(volume_down)); |
EXPECT_EQ(1, delegate->handle_volume_down_count()); |
EXPECT_EQ(volume_down, delegate->last_accelerator()); |
EXPECT_EQ(0, delegate->handle_volume_up_count()); |
- EXPECT_FALSE(ProcessWithContext(volume_up)); |
+ EXPECT_FALSE(GetController()->Process(volume_up)); |
EXPECT_EQ(1, delegate->handle_volume_up_count()); |
EXPECT_EQ(volume_up, delegate->last_accelerator()); |
} |
@@ -1171,15 +1203,15 @@ TEST_F(AcceleratorControllerTest, DisallowedAtModalWindow) { |
ash::Shell::GetInstance()->system_tray_delegate()->SetVolumeControlDelegate( |
scoped_ptr<VolumeControlDelegate>(delegate).Pass()); |
EXPECT_EQ(0, delegate->handle_volume_mute_count()); |
- EXPECT_TRUE(ProcessWithContext(volume_mute)); |
+ EXPECT_TRUE(GetController()->Process(volume_mute)); |
EXPECT_EQ(1, delegate->handle_volume_mute_count()); |
EXPECT_EQ(volume_mute, delegate->last_accelerator()); |
EXPECT_EQ(0, delegate->handle_volume_down_count()); |
- EXPECT_TRUE(ProcessWithContext(volume_down)); |
+ EXPECT_TRUE(GetController()->Process(volume_down)); |
EXPECT_EQ(1, delegate->handle_volume_down_count()); |
EXPECT_EQ(volume_down, delegate->last_accelerator()); |
EXPECT_EQ(0, delegate->handle_volume_up_count()); |
- EXPECT_TRUE(ProcessWithContext(volume_up)); |
+ EXPECT_TRUE(GetController()->Process(volume_up)); |
EXPECT_EQ(1, delegate->handle_volume_up_count()); |
EXPECT_EQ(volume_up, delegate->last_accelerator()); |
} |