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

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

Issue 267743010: Suppressed screen rotation notifications triggeres by the accelerometer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed Rob's comments from patch set 2 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 d619fd5239dd9885cfa172987272bdb5893686e3..a9ceadca67b5df42c20e096a9e7b9774ba151d86 100644
--- a/ash/wm/maximize_mode/maximize_mode_controller_unittest.cc
+++ b/ash/wm/maximize_mode/maximize_mode_controller_unittest.cc
@@ -9,9 +9,11 @@
#include "ash/shell.h"
#include "ash/test/ash_test_base.h"
#include "ash/test/display_manager_test_api.h"
+#include "ash/test/test_system_tray_delegate.h"
#include "ui/aura/test/event_generator.h"
#include "ui/events/event_handler.h"
#include "ui/gfx/vector3d_f.h"
+#include "ui/message_center/message_center.h"
namespace ash {
@@ -416,4 +418,40 @@ TEST_F(MaximizeModeControllerTest, ExitingMaximizeModeClearRotationLock) {
EXPECT_FALSE(maximize_mode_controller()->rotation_locked());
}
+// Tests that the screen rotation notifications are suppressed when
+// triggered by the accelerometer.
+TEST_F(MaximizeModeControllerTest, BlockRotationNotifications) {
+ test::TestSystemTrayDelegate* tray_delegate =
+ static_cast<test::TestSystemTrayDelegate*>(
+ Shell::GetInstance()->system_tray_delegate());
+ tray_delegate->set_should_show_display_notification(true);
+
+ aura::Window* root = Shell::GetPrimaryRootWindow();
+ aura::test::EventGenerator event_generator(root, root);
+ message_center::MessageCenter* message_center =
+ message_center::MessageCenter::Get();
+
+ DisplayManager* display_manager =
+ Shell::GetInstance()->display_manager();
+
+ // Make sure notifications are still displayed when
+ // adjusting the screen rotation directly.
+ ASSERT_EQ(0u, message_center->NotificationCount());
+ ASSERT_EQ(gfx::Display::ROTATE_0, display_manager->GetDisplayInfo(
+ gfx::Display::InternalDisplayId()).rotation());
+ display_manager->SetDisplayRotation(gfx::Display::InternalDisplayId(),
+ gfx::Display::ROTATE_90);
+ ASSERT_EQ(1u, message_center->NotificationCount());
+ message_center->RemoveAllNotifications(false);
+ ASSERT_EQ(0u, message_center->NotificationCount());
+
+ // Trigger maximize mode by opening to 270.
+ TriggerAccelerometerUpdate(gfx::Vector3dF(0.0f, 0.0f, -1.0f),
+ gfx::Vector3dF(-1.0f, 0.0f, 0.0f));
+ // Rotate to 90 degrees
+ TriggerAccelerometerUpdate(gfx::Vector3dF(0.0f, 1.0f, 0.0f),
+ gfx::Vector3dF(0.0f, 1.0f, 0.0f));
+ EXPECT_EQ(0u, message_center->NotificationCount());
+}
+
} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698