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

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

Issue 263813002: Take a screenshot in maximize mode when volume down and power are pressed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge 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
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 33b898866a7cefbc730eb604fa35506b1cce4694..3dcd076fc8dfb3c23e3921196d896558f99c65b2 100644
--- a/ash/wm/maximize_mode/maximize_mode_controller_unittest.cc
+++ b/ash/wm/maximize_mode/maximize_mode_controller_unittest.cc
@@ -10,6 +10,8 @@
#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_lock_state_controller_delegate.h"
+#include "ash/test/test_screenshot_delegate.h"
#include "ash/test/test_volume_control_delegate.h"
#include "ui/aura/test/event_generator.h"
#include "ui/events/event_handler.h"
@@ -329,6 +331,36 @@ TEST_F(MaximizeModeControllerTest, BlocksKeyboard) {
counter.reset();
}
+#if defined(OS_CHROMEOS)
+// Tests that a screenshot can be taken in maximize mode by holding volume down
+// and pressing power.
+TEST_F(MaximizeModeControllerTest, Screenshot) {
+ Shell::GetInstance()->lock_state_controller()->SetDelegate(
+ new test::TestLockStateControllerDelegate);
+ aura::Window* root = Shell::GetPrimaryRootWindow();
+ aura::test::EventGenerator event_generator(root, root);
+ test::TestScreenshotDelegate* delegate = GetScreenshotDelegate();
+ delegate->set_can_take_screenshot(true);
+
+ // Open up 270 degrees.
+ TriggerAccelerometerUpdate(gfx::Vector3dF(0.0f, 0.0f, 1.0f),
+ gfx::Vector3dF(1.0f, 0.0f, 0.0f));
+ ASSERT_TRUE(IsMaximizeModeStarted());
+
+ // Pressing power alone does not take a screenshot.
+ event_generator.PressKey(ui::VKEY_POWER, 0);
+ event_generator.ReleaseKey(ui::VKEY_POWER, 0);
+ EXPECT_EQ(0, delegate->handle_take_screenshot_count());
+
+ // Holding volume down and pressing power takes a screenshot.
+ event_generator.PressKey(ui::VKEY_VOLUME_DOWN, 0);
+ event_generator.PressKey(ui::VKEY_POWER, 0);
+ event_generator.ReleaseKey(ui::VKEY_POWER, 0);
+ EXPECT_EQ(1, delegate->handle_take_screenshot_count());
+ event_generator.ReleaseKey(ui::VKEY_VOLUME_DOWN, 0);
+}
+#endif // OS_CHROMEOS
+
// Tests that maximize mode does not block Volume Up & Down events.
TEST_F(MaximizeModeControllerTest, AllowsVolumeControl) {
aura::Window* root = Shell::GetPrimaryRootWindow();
« no previous file with comments | « ash/wm/maximize_mode/maximize_mode_controller.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