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

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: POWER key not defined in windows. 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..9e84bda7449a3f8859d59ff824ad269d8ce2613a 100644
--- a/ash/wm/maximize_mode/maximize_mode_controller_unittest.cc
+++ b/ash/wm/maximize_mode/maximize_mode_controller_unittest.cc
@@ -9,6 +9,7 @@
#include "ash/shell.h"
#include "ash/test/ash_test_base.h"
#include "ash/test/display_manager_test_api.h"
+#include "ash/test/test_screenshot_delegate.h"
#include "ui/aura/test/event_generator.h"
#include "ui/events/event_handler.h"
#include "ui/gfx/vector3d_f.h"
@@ -327,6 +328,34 @@ 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) {
+ 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
+
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 | « no previous file | ash/wm/maximize_mode/maximize_mode_event_blocker.h » ('j') | ash/wm/maximize_mode/maximize_mode_event_blocker.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698