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

Unified Diff: ash/display/display_configuration_controller_unittest.cc

Issue 2728803002: Handles users rotating screen too early (Closed)
Patch Set: Make ScreenRotationAnimator handle its own internal states. Created 3 years, 9 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..fd54bd43df73c50ad2040992a63cbea365bacd33
--- /dev/null
+++ b/ash/display/display_configuration_controller_unittest.cc
@@ -0,0 +1,47 @@
+// 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/common/wm_shell.h"
+#include "ash/rotator/screen_rotation_animator.h"
+#include "ash/shell.h"
+#include "ash/test/ash_test_base.h"
+#include "ash/test/display_configuration_controller_test_api.h"
+#include "base/macros.h"
+#include "ui/display/manager/display_manager.h"
+
+namespace ash {
+namespace test {
+
+class DisplayConfigurationControllerTest : public AshTestBase {
bruthig 2017/03/10 22:34:07 Thanks for adding this missing test fixture!!
wutao 2017/03/14 16:46:37 Acknowledged.
+ public:
+ DisplayConfigurationControllerTest() {}
+ ~DisplayConfigurationControllerTest() override {}
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(DisplayConfigurationControllerTest);
+};
+
+TEST_F(DisplayConfigurationControllerTest, ErasesAnimatorOnAnimationEnded) {
+ // TODO(wutao): needs display_configuration_controller.
bruthig 2017/03/10 22:34:07 nit: Any chance you can include a bug number here?
kylechar 2017/03/13 14:17:22 You can include crbug.com/686839 here. We need dis
wutao 2017/03/14 16:46:37 Done.
+ if (WmShell::Get()->IsRunningInMash())
+ return;
bruthig 2017/03/10 22:34:07 FYI I've proposed a change to the mus+ash team abo
wutao 2017/03/14 16:46:37 As discussed offline and in the proposal thread, I
+
+ display::Display display = display::Screen::GetScreen()->GetPrimaryDisplay();
+ DisplayConfigurationControllerTestApi testapi(
+ Shell::GetInstance()->display_configuration_controller());
+ ScreenRotationAnimator* screen_rotation_animator =
+ testapi.GetScreenRotationAnimatorForDisplay(display.id());
+ EXPECT_EQ(1, testapi.DisplayScreenRotationAnimatorMapSize());
+
+ Shell::GetInstance()->display_manager()->SetDisplayRotation(
+ display.id(), display::Display::ROTATE_0,
+ display::Display::RotationSource::ROTATION_SOURCE_USER);
+ screen_rotation_animator->Rotate(
+ display::Display::ROTATE_90,
+ display::Display::RotationSource::ROTATION_SOURCE_USER);
+ EXPECT_EQ(0, testapi.DisplayScreenRotationAnimatorMapSize());
+}
+
+} // namespace test
+} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698