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

Unified Diff: ash/wm/maximize_mode/maximize_mode_controller_unittest.cc

Issue 251193005: Enabled volume buttons when TouchView is active (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merged changes with trunk Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/test/test_volume_control_delegate.cc ('k') | ash/wm/maximize_mode/maximize_mode_event_blocker.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/maximize_mode/maximize_mode_controller_unittest.cc
diff --git a/ash/wm/maximize_mode/maximize_mode_controller_unittest.cc b/ash/wm/maximize_mode/maximize_mode_controller_unittest.cc
index ed9e80053455cfc2f457300475c85989b770a7eb..f304f01f886f741ccb87ee2f7efadf3daa290d8b 100644
--- a/ash/wm/maximize_mode/maximize_mode_controller_unittest.cc
+++ b/ash/wm/maximize_mode/maximize_mode_controller_unittest.cc
@@ -7,8 +7,10 @@
#include "ash/accelerometer/accelerometer_controller.h"
#include "ash/display/display_manager.h"
#include "ash/shell.h"
+#include "ash/system/tray/system_tray_delegate.h"
#include "ash/test/ash_test_base.h"
#include "ash/test/display_manager_test_api.h"
+#include "ash/test/test_volume_control_delegate.h"
#include "ui/aura/test/event_generator.h"
#include "ui/events/event_handler.h"
#include "ui/gfx/vector3d_f.h"
@@ -327,6 +329,34 @@ TEST_F(MaximizeModeControllerTest, BlocksKeyboard) {
counter.reset();
}
+// Tests that maximize mode does not block Volume Up & Down events.
+TEST_F(MaximizeModeControllerTest, AllowsVolumeControl) {
+ aura::Window* root = Shell::GetPrimaryRootWindow();
+ aura::test::EventGenerator event_generator(root, root);
+
+ TestVolumeControlDelegate* volume_delegate =
+ new TestVolumeControlDelegate(true);
+ ash::Shell::GetInstance()->system_tray_delegate()->SetVolumeControlDelegate(
+ scoped_ptr<VolumeControlDelegate>(volume_delegate).Pass());
+
+ // Trigger maximize mode by opening to 270 to begin the test in maximize mode.
+ TriggerAccelerometerUpdate(gfx::Vector3dF(0.0f, 0.0f, -1.0f),
+ gfx::Vector3dF(-1.0f, 0.0f, 0.0f));
+ ASSERT_TRUE(IsMaximizeModeStarted());
+
+ // Verify volume down button event is not blocked
+ ASSERT_EQ(0, volume_delegate->handle_volume_down_count());
+ event_generator.PressKey(ui::VKEY_VOLUME_DOWN, 0);
+ event_generator.ReleaseKey(ui::VKEY_VOLUME_DOWN, 0);
+ EXPECT_EQ(1, volume_delegate->handle_volume_down_count());
+
+ // Verify volume up event is not blocked
+ ASSERT_EQ(0, volume_delegate->handle_volume_up_count());
+ event_generator.PressKey(ui::VKEY_VOLUME_UP, 0);
+ event_generator.ReleaseKey(ui::VKEY_VOLUME_UP, 0);
+ EXPECT_EQ(1, volume_delegate->handle_volume_up_count());
+}
+
TEST_F(MaximizeModeControllerTest, LaptopTest) {
// Feeds in sample accelerometer data and verifies that there are no
// transitions into touchview / maximize mode while shaking the device around
« no previous file with comments | « ash/test/test_volume_control_delegate.cc ('k') | ash/wm/maximize_mode/maximize_mode_event_blocker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698