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

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: Style fixes as per Jons comments from Patch Set 1 Created 6 years, 8 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
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..11bf6453251b7ac3c4305db9a34ef4bedb7636fd 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/dummy_volume_control_delegate.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);
+
+ DummyVolumeControlDelegate* volume_delegate =
+ new DummyVolumeControlDelegate(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

Powered by Google App Engine
This is Rietveld 408576698