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 d619fd5239dd9885cfa172987272bdb5893686e3..c06a22e0d575268c736b81562287630d7aebd9a7 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/volume_control_delegate_stub.h" |
#include "ui/aura/test/event_generator.h" |
#include "ui/events/event_handler.h" |
#include "ui/gfx/vector3d_f.h" |
@@ -148,7 +150,7 @@ TEST_F(MaximizeModeControllerTest, EnterExitThresholds) { |
// Tests that when the hinge is nearly vertically aligned, the current state |
// persists as the computed angle is highly inaccurate in this orientation. |
TEST_F(MaximizeModeControllerTest, HingeAligned) { |
- // Laptop in normal orientation lid open 90 degrees. |
+ // Laptop in normal orientation lid open 90 degrees. |
TriggerAccelerometerUpdate(gfx::Vector3dF(0.0f, 0.0f, 1.0f), |
gfx::Vector3dF(-1.0f, 0.0f, 0.0f)); |
EXPECT_FALSE(IsMaximizeModeStarted()); |
@@ -309,7 +311,7 @@ TEST_F(MaximizeModeControllerTest, BlocksKeyboard) { |
EXPECT_EQ(0u, counter.event_count()); |
counter.reset(); |
- // Touch should not be blocked. |
+ // Touch should not be blocked. |
event_generator.PressTouch(); |
event_generator.ReleaseTouch(); |
EXPECT_GT(counter.event_count(), 0u); |
@@ -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); |
+ |
+ VolumeControlDelegateStub* volume_delegate = |
+ new VolumeControlDelegateStub(false); |
+ 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 |