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

Unified Diff: ash/display/display_configuration_controller_unittest.cc

Issue 2728803002: Handles users rotating screen too early (Closed)
Patch Set: Created 3 years, 10 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/display/display_configuration_controller_unittest.cc
diff --git a/ash/display/display_configuration_controller_unittest.cc b/ash/display/display_configuration_controller_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..aeef5a625ff03fb2826f0373ff57d1b4088896ad
--- /dev/null
+++ b/ash/display/display_configuration_controller_unittest.cc
@@ -0,0 +1,46 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ash/display/display_configuration_controller.h"
+
+#include "ash/common/wm_shell.h"
+#include "ash/shell.h"
+#include "ash/test/ash_test_base.h"
+#include "ash/test/shell_test_api.h"
+#include "base/memory/ptr_util.h"
+#include "ui/display/display.h"
+#include "ui/display/screen.h"
+
+namespace ash {
+namespace test {
+
+class DisplayConfigurationControllerTest : public AshTestBase {
+ public:
+ DisplayConfigurationControllerTest() {}
+ ~DisplayConfigurationControllerTest() override {}
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(DisplayConfigurationControllerTest);
+};
+
+TEST_F(DisplayConfigurationControllerTest, ErasesAnimatorOnAnimationEnded) {
+ // TODO(wutao): needs display_configuration_controller.
+ if (WmShell::Get()->IsRunningInMash())
+ return;
+
+ display::Display display = display::Screen::GetScreen()->GetPrimaryDisplay();
+ ShellTestApi testapi(Shell::GetInstance());
+ ScreenRotationAnimator* screen_rotation_animator =
+ testapi.GetOrMakeAnimatorByDisplayId(display.id());
+ EXPECT_EQ(1, testapi.DisplayIdAnimatorMapSize());
+
+ display.set_rotation(display::Display::ROTATE_0);
+ screen_rotation_animator->Rotate(
+ display::Display::ROTATE_90,
+ display::Display::RotationSource::ROTATION_SOURCE_USER);
+ EXPECT_EQ(0, testapi.DisplayIdAnimatorMapSize());
+}
+
+} // namespace test
+} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698