1a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch// Copyright 2014 The Chromium Authors. All rights reserved.
2a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch// Use of this source code is governed by a BSD-style license that can be
3a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch// found in the LICENSE file.
4a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
5a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch#include "ash/system/chromeos/rotation/tray_rotation_lock.h"
6a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
7a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch#include "ash/ash_switches.h"
8a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch#include "ash/display/display_manager.h"
9a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch#include "ash/root_window_controller.h"
10a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch#include "ash/shelf/shelf_widget.h"
11a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch#include "ash/shell.h"
12a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch#include "ash/system/status_area_widget.h"
13a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch#include "ash/system/tray/system_tray.h"
14a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch#include "ash/system/tray/system_tray_delegate.h"
15a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch#include "ash/test/ash_test_base.h"
16a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch#include "ash/test/status_area_widget_test_helper.h"
17a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch#include "ash/wm/maximize_mode/maximize_mode_controller.h"
18a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch#include "base/command_line.h"
19a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch#include "base/memory/scoped_ptr.h"
20a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch#include "base/time/time.h"
21a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch#include "ui/events/event.h"
22a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch#include "ui/events/event_constants.h"
23a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch#include "ui/views/view.h"
24a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
25a02191e04bc25c4935f804f2c080ae28663d096dBen Murdochnamespace ash {
26a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
27a02191e04bc25c4935f804f2c080ae28663d096dBen Murdochclass TrayRotationLockTest : public test::AshTestBase {
28a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch public:
29a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  TrayRotationLockTest() {}
30a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  virtual ~TrayRotationLockTest() {}
31a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
32a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  TrayRotationLock* tray() {
33a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch    return tray_.get();
34a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  }
35a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
36a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  views::View* tray_view() {
37a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch    return tray_view_.get();
38a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  }
39a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
40a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  views::View* default_view() {
41a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch    return default_view_.get();
42a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  }
43a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
44a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  // Sets up a TrayRotationLock, its tray view, and its default view, for the
45a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  // given SystemTray and its display. On a primary display all will be
46a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  // created. On a secondary display both the tray view and default view will
47a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  // be null.
48a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  void SetUpForStatusAreaWidget(StatusAreaWidget* status_area_widget);
49a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
50a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  // Resets |tray_| |tray_view_| and |default_view_| so that all components of
51a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  // TrayRotationLock have been cleared. Tests may then call
52a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  // SetUpForStatusAreaWidget in order to initial the components.
53a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  void TearDownViews();
54a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
55a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  // test::AshTestBase:
56a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  virtual void SetUp() OVERRIDE;
57a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  virtual void TearDown() OVERRIDE;
58a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
59a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch private:
60a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  scoped_ptr<TrayRotationLock> tray_;
61a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  scoped_ptr<views::View> tray_view_;
62a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  scoped_ptr<views::View> default_view_;
63a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
64a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  DISALLOW_COPY_AND_ASSIGN(TrayRotationLockTest);
65a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch};
66a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
67a02191e04bc25c4935f804f2c080ae28663d096dBen Murdochvoid TrayRotationLockTest::SetUpForStatusAreaWidget(
68a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch    StatusAreaWidget* status_area_widget) {
69a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  tray_.reset(new TrayRotationLock(status_area_widget->system_tray()));
70a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  tray_view_.reset(tray_->CreateTrayView(
71a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch      StatusAreaWidgetTestHelper::GetUserLoginStatus()));
72a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  default_view_.reset(tray_->CreateDefaultView(
73a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch      StatusAreaWidgetTestHelper::GetUserLoginStatus()));
74a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch}
75a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
76a02191e04bc25c4935f804f2c080ae28663d096dBen Murdochvoid TrayRotationLockTest::TearDownViews() {
77a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  tray_view_.reset();
78a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  default_view_.reset();
79a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  tray_.reset();
80a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch}
81a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
82a02191e04bc25c4935f804f2c080ae28663d096dBen Murdochvoid TrayRotationLockTest::SetUp() {
83a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  // The Display used for testing is not an internal display. This flag
84a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  // allows for DisplayManager to treat it as one. TrayRotationLock is only
85a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  // visible on internal primary displays.
86a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  CommandLine::ForCurrentProcess()->AppendSwitch(
87a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch        switches::kAshUseFirstDisplayAsInternal);
88a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  test::AshTestBase::SetUp();
89a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  SetUpForStatusAreaWidget(StatusAreaWidgetTestHelper::GetStatusAreaWidget());
90a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch}
91a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
92a02191e04bc25c4935f804f2c080ae28663d096dBen Murdochvoid TrayRotationLockTest::TearDown() {
93a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  TearDownViews();
94a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  test::AshTestBase::TearDown();
95a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch}
96a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
97a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch// Tests that when the tray view is initially created, that it is created
98a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch// not visible.
99a02191e04bc25c4935f804f2c080ae28663d096dBen MurdochTEST_F(TrayRotationLockTest, CreateTrayView) {
100a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  EXPECT_FALSE(tray_view()->visible());
101a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch}
102a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
103a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch// Tests that when the tray view is created, while MaximizeMode is active, that
1045c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu// it is not visible.
105a02191e04bc25c4935f804f2c080ae28663d096dBen MurdochTEST_F(TrayRotationLockTest, CreateTrayViewDuringMaximizeMode) {
106a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  TearDownViews();
107f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)  Shell::GetInstance()->maximize_mode_controller()->
108f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)      EnableMaximizeModeWindowManager(true);
109a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  SetUpForStatusAreaWidget(StatusAreaWidgetTestHelper::GetStatusAreaWidget());
1105c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu  EXPECT_FALSE(tray_view()->visible());
111f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)  Shell::GetInstance()->maximize_mode_controller()->
112f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)      EnableMaximizeModeWindowManager(false);
1135c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu}
1145c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu
1155c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu// Tests that when the tray view is created, while MaximizeMode is active, and
1165c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu// rotation is locked, that it is visible.
1175c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo LiuTEST_F(TrayRotationLockTest, CreateTrayViewDuringMaximizeModeAndRotationLock) {
1185c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu  TearDownViews();
119f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)  Shell::GetInstance()->maximize_mode_controller()->
120f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)      EnableMaximizeModeWindowManager(true);
121f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)  Shell::GetInstance()-> maximize_mode_controller()->SetRotationLocked(true);
1225c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu  SetUpForStatusAreaWidget(StatusAreaWidgetTestHelper::GetStatusAreaWidget());
123a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  EXPECT_TRUE(tray_view()->visible());
124f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)  Shell::GetInstance()->maximize_mode_controller()->
125f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)      EnableMaximizeModeWindowManager(false);
126f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)  EXPECT_FALSE(tray_view()->visible());
127a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch}
128a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
129a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch// Tests that the enabling of MaximizeMode affects a previously created tray
130a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch// view, changing the visibility.
131a02191e04bc25c4935f804f2c080ae28663d096dBen MurdochTEST_F(TrayRotationLockTest, TrayViewVisibilityChangesDuringMaximizeMode) {
132f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)  ASSERT_FALSE(tray_view()->visible());
133f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)  Shell::GetInstance()->maximize_mode_controller()->
134f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)      EnableMaximizeModeWindowManager(true);
135f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)  Shell::GetInstance()->maximize_mode_controller()->SetRotationLocked(true);
136a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  EXPECT_TRUE(tray_view()->visible());
137f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)  Shell::GetInstance()->maximize_mode_controller()->
138f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)      EnableMaximizeModeWindowManager(false);
139a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  EXPECT_FALSE(tray_view()->visible());
140a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch}
141a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
142a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch// Tests that the when the tray view is created for a secondary display, that
143a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch// it is not visible, and that MaximizeMode does not affect visibility.
144a02191e04bc25c4935f804f2c080ae28663d096dBen MurdochTEST_F(TrayRotationLockTest, CreateSecondaryTrayView) {
145a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  if (!SupportsMultipleDisplays())
146a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch    return;
147a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  UpdateDisplay("400x400,200x200");
148a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
149a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  SetUpForStatusAreaWidget(
150a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch      StatusAreaWidgetTestHelper::GetSecondaryStatusAreaWidget());
151a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  EXPECT_FALSE(tray_view()->visible());
152f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)  Shell::GetInstance()->maximize_mode_controller()->
153f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)      EnableMaximizeModeWindowManager(true);
154a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  EXPECT_FALSE(tray_view()->visible());
155f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)  Shell::GetInstance()->maximize_mode_controller()->
156f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)      EnableMaximizeModeWindowManager(false);
157a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  EXPECT_FALSE(tray_view()->visible());
158a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch}
159a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
160a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch// Tests that when the default view is initially created, that it is created
161a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch// not visible.
162a02191e04bc25c4935f804f2c080ae28663d096dBen MurdochTEST_F(TrayRotationLockTest, CreateDefaultView) {
163a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  EXPECT_FALSE(default_view()->visible());
164a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch}
165a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
166a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch// Tests that when the default view is created, while MaximizeMode is active,
167a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch// that it is visible.
168a02191e04bc25c4935f804f2c080ae28663d096dBen MurdochTEST_F(TrayRotationLockTest, CreateDefaultViewDuringMaximizeMode) {
169a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  TearDownViews();
170f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)  Shell::GetInstance()->maximize_mode_controller()->
171f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)      EnableMaximizeModeWindowManager(true);
172a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  SetUpForStatusAreaWidget(StatusAreaWidgetTestHelper::GetStatusAreaWidget());
173a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  EXPECT_TRUE(default_view()->visible());
174f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)  Shell::GetInstance()->maximize_mode_controller()->
175f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)      EnableMaximizeModeWindowManager(false);
176a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch}
177a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
178a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch// Tests that the enabling of MaximizeMode affects a previously created default
179a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch// view, changing the visibility.
180a02191e04bc25c4935f804f2c080ae28663d096dBen MurdochTEST_F(TrayRotationLockTest, DefaultViewVisibilityChangesDuringMaximizeMode) {
181f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)  Shell::GetInstance()->maximize_mode_controller()->
182f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)      EnableMaximizeModeWindowManager(true);
183a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  EXPECT_TRUE(default_view()->visible());
184f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)  Shell::GetInstance()->maximize_mode_controller()->
185f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)      EnableMaximizeModeWindowManager(false);
186a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  EXPECT_FALSE(default_view()->visible());
187a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch}
188a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
189a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch// Tests that no default view is created when the target is a secondary
190a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch// display.
191a02191e04bc25c4935f804f2c080ae28663d096dBen MurdochTEST_F(TrayRotationLockTest, CreateSecondaryDefaultView) {
192a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  if (!SupportsMultipleDisplays())
193a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch    return;
194a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  UpdateDisplay("400x400,200x200");
195a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
196a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  TearDownViews();
197a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  SetUpForStatusAreaWidget(
198a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch      StatusAreaWidgetTestHelper::GetSecondaryStatusAreaWidget());
199a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  EXPECT_EQ(NULL, default_view());
200a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch}
201a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
202a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch// Tests that activating the default view causes the display to have its
2035c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu// rotation locked, and that the tray view becomes visible.
204a02191e04bc25c4935f804f2c080ae28663d096dBen MurdochTEST_F(TrayRotationLockTest, PerformActionOnDefaultView) {
205a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  MaximizeModeController* maximize_mode_controller = Shell::GetInstance()->
206a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch      maximize_mode_controller();
207a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  ASSERT_FALSE(maximize_mode_controller->rotation_locked());
208f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)  Shell::GetInstance()->maximize_mode_controller()->
209f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)      EnableMaximizeModeWindowManager(true);
2105c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu  ASSERT_FALSE(tray_view()->visible());
211a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
2121320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  ui::GestureEvent tap(
2131320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci      0, 0, 0, base::TimeDelta(), ui::GestureEventDetails(ui::ET_GESTURE_TAP));
214a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  default_view()->OnGestureEvent(&tap);
215a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch  EXPECT_TRUE(maximize_mode_controller->rotation_locked());
2165c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu  EXPECT_TRUE(tray_view()->visible());
217a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
218f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)  Shell::GetInstance()->maximize_mode_controller()->
219f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)      EnableMaximizeModeWindowManager(false);
220a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch}
221a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch
222a02191e04bc25c4935f804f2c080ae28663d096dBen Murdoch}  // namespace ash
223