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

Unified Diff: athena/wm/split_view_controller_unittest.cc

Issue 535973002: Disable screen rotation when splitview is engaged and only allow splitview in landscape. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
« athena/wm/split_view_controller.cc ('K') | « athena/wm/split_view_controller.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: athena/wm/split_view_controller_unittest.cc
diff --git a/athena/wm/split_view_controller_unittest.cc b/athena/wm/split_view_controller_unittest.cc
index 04eddc5e10b00e5f192fb5b31084f357029f5b58..f234e6cbf9e67fd53567b2459948cf523b1aebf6 100644
--- a/athena/wm/split_view_controller_unittest.cc
+++ b/athena/wm/split_view_controller_unittest.cc
@@ -4,12 +4,15 @@
#include "athena/wm/split_view_controller.h"
+#include "athena/screen/public/screen_manager.h"
#include "athena/test/athena_test_base.h"
#include "athena/wm/public/window_list_provider.h"
#include "athena/wm/test/window_manager_impl_test_api.h"
#include "base/memory/scoped_vector.h"
#include "ui/aura/test/test_window_delegate.h"
#include "ui/aura/window.h"
+#include "ui/gfx/display.h"
+#include "ui/gfx/screen.h"
namespace athena {
@@ -66,4 +69,38 @@ TEST_F(SplitViewControllerTest, SplitModeActivation) {
EXPECT_EQ(windows[5], *(list_provider->GetWindowList().rbegin() + 1));
}
+TEST_F(SplitViewControllerTest, LandscapeOnly) {
+ aura::test::TestWindowDelegate delegate;
+ ScopedVector<aura::Window> windows;
+ const int kNumWindows = 2;
+ for (size_t i = 0; i < kNumWindows; ++i) {
+ scoped_ptr<aura::Window> window = CreateTestWindow(NULL, gfx::Rect());
+ windows.push_back(window.release());
+ }
+ ASSERT_EQ(gfx::Display::ROTATE_0,
+ gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().rotation());
+
+ test::WindowManagerImplTestApi api;
+ SplitViewController* controller = api.GetSplitViewController();
+ ASSERT_TRUE(controller->CanScroll());
+ ASSERT_FALSE(controller->IsSplitViewModeActive());
+
+ controller->ActivateSplitMode(NULL, NULL);
+ ASSERT_TRUE(controller->IsSplitViewModeActive());
+
+ // Screen rotation should be locked while in splitview.
+ ScreenManager::Get()->SetRotation(gfx::Display::ROTATE_90);
+ EXPECT_EQ(gfx::Display::ROTATE_0,
+ gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().rotation());
+
+ // Screen is rotated on exiting splitview.
+ controller->DeactivateSplitMode();
+ ASSERT_EQ(gfx::Display::ROTATE_90,
+ gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().rotation());
+
+ // Entering splitview should now be disabled now that the screen is in a
+ // portrait orientation.
+ ASSERT_TRUE(controller->CanScroll());
mfomitchev 2014/09/03 15:43:40 Perhaps finish the test by rotating it back and co
flackr 2014/09/03 16:42:13 Done.
+}
+
} // namespace athena
« athena/wm/split_view_controller.cc ('K') | « athena/wm/split_view_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698