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

Unified Diff: ash/accelerators/accelerator_controller_unittest.cc

Issue 2427913003: Use mojo volume interfaces for mash and classic ash. (Closed)
Patch Set: Split volume and system events observers; only hook up volume. Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/BUILD.gn ('k') | ash/accelerators/accelerator_interactive_uitest_chromeos.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/accelerators/accelerator_controller_unittest.cc
diff --git a/ash/accelerators/accelerator_controller_unittest.cc b/ash/accelerators/accelerator_controller_unittest.cc
index c7af74d34a9cf349daf2751d8cbf443084b50f2e..f837b01d149092263e199131879cb6c3b21563f1 100644
--- a/ash/accelerators/accelerator_controller_unittest.cc
+++ b/ash/accelerators/accelerator_controller_unittest.cc
@@ -13,8 +13,6 @@
#include "ash/common/system/brightness_control_delegate.h"
#include "ash/common/system/keyboard_brightness_control_delegate.h"
#include "ash/common/system/tray/system_tray_delegate.h"
-#include "ash/common/system/volume_control_delegate.h"
-#include "ash/common/test/test_volume_control_delegate.h"
#include "ash/common/wm/panels/panel_layout_manager.h"
#include "ash/common/wm/window_positioning_utils.h"
#include "ash/common/wm/window_state.h"
@@ -31,6 +29,7 @@
#include "ash/wm/lock_state_controller.h"
#include "ash/wm/window_state_aura.h"
#include "ash/wm/window_util.h"
+#include "base/test/user_action_tester.cc"
#include "ui/aura/client/aura_constants.h"
#include "ui/aura/test/test_window_delegate.h"
#include "ui/aura/test/test_windows.h"
@@ -839,21 +838,23 @@ TEST_F(AcceleratorControllerTest, GlobalAccelerators) {
const ui::Accelerator volume_down(ui::VKEY_VOLUME_DOWN, ui::EF_NONE);
const ui::Accelerator volume_up(ui::VKEY_VOLUME_UP, ui::EF_NONE);
{
- TestVolumeControlDelegate* delegate = new TestVolumeControlDelegate;
- WmShell::Get()->system_tray_delegate()->SetVolumeControlDelegate(
- std::unique_ptr<VolumeControlDelegate>(delegate));
- EXPECT_EQ(0, delegate->handle_volume_mute_count());
+ base::UserActionTester user_action_tester;
+ ui::AcceleratorHistory* history = GetController()->accelerator_history();
+
+ EXPECT_EQ(0, user_action_tester.GetActionCount("Accel_VolumeMute_F8"));
EXPECT_TRUE(ProcessInController(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_EQ(1, user_action_tester.GetActionCount("Accel_VolumeMute_F8"));
+ EXPECT_EQ(volume_mute, history->current_accelerator());
+
+ EXPECT_EQ(0, user_action_tester.GetActionCount("Accel_VolumeDown_F9"));
EXPECT_TRUE(ProcessInController(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_EQ(1, user_action_tester.GetActionCount("Accel_VolumeDown_F9"));
+ EXPECT_EQ(volume_down, history->current_accelerator());
+
+ EXPECT_EQ(0, user_action_tester.GetActionCount("Accel_VolumeUp_F10"));
EXPECT_TRUE(ProcessInController(volume_up));
- EXPECT_EQ(1, delegate->handle_volume_up_count());
- EXPECT_EQ(volume_up, delegate->last_accelerator());
+ EXPECT_EQ(volume_up, history->current_accelerator());
+ EXPECT_EQ(1, user_action_tester.GetActionCount("Accel_VolumeUp_F10"));
}
// Brightness
// ui::VKEY_BRIGHTNESS_DOWN/UP are not defined on Windows.
@@ -1263,24 +1264,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);
{
+ base::UserActionTester user_action_tester;
+ ui::AcceleratorHistory* history = GetController()->accelerator_history();
+
+ EXPECT_EQ(0, user_action_tester.GetActionCount("Accel_VolumeMute_F8"));
EXPECT_TRUE(ProcessInController(volume_mute));
+ EXPECT_EQ(1, user_action_tester.GetActionCount("Accel_VolumeMute_F8"));
+ EXPECT_EQ(volume_mute, history->current_accelerator());
+
+ EXPECT_EQ(0, user_action_tester.GetActionCount("Accel_VolumeDown_F9"));
EXPECT_TRUE(ProcessInController(volume_down));
+ EXPECT_EQ(1, user_action_tester.GetActionCount("Accel_VolumeDown_F9"));
+ EXPECT_EQ(volume_down, history->current_accelerator());
+
+ EXPECT_EQ(0, user_action_tester.GetActionCount("Accel_VolumeUp_F10"));
EXPECT_TRUE(ProcessInController(volume_up));
- TestVolumeControlDelegate* delegate = new TestVolumeControlDelegate;
- WmShell::Get()->system_tray_delegate()->SetVolumeControlDelegate(
- std::unique_ptr<VolumeControlDelegate>(delegate));
- EXPECT_EQ(0, delegate->handle_volume_mute_count());
- EXPECT_TRUE(ProcessInController(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(ProcessInController(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(ProcessInController(volume_up));
- EXPECT_EQ(1, delegate->handle_volume_up_count());
- EXPECT_EQ(volume_up, delegate->last_accelerator());
+ EXPECT_EQ(volume_up, history->current_accelerator());
+ EXPECT_EQ(1, user_action_tester.GetActionCount("Accel_VolumeUp_F10"));
}
}
#endif
« no previous file with comments | « ash/BUILD.gn ('k') | ash/accelerators/accelerator_interactive_uitest_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698