| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ash/wm/workspace/workspace_event_handler.h" | 5 #include "ash/wm/workspace/workspace_event_handler.h" |
| 6 | 6 |
| 7 #include "ash/screen_util.h" | 7 #include "ash/screen_util.h" |
| 8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 9 #include "ash/test/ash_test_base.h" | 9 #include "ash/test/ash_test_base.h" |
| 10 #include "ash/wm/window_state.h" | 10 #include "ash/wm/window_state.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 aura::Window* window_; | 79 aura::Window* window_; |
| 80 std::vector<const void*> properties_changed_; | 80 std::vector<const void*> properties_changed_; |
| 81 | 81 |
| 82 DISALLOW_COPY_AND_ASSIGN(WindowPropertyObserver); | 82 DISALLOW_COPY_AND_ASSIGN(WindowPropertyObserver); |
| 83 }; | 83 }; |
| 84 | 84 |
| 85 TEST_F(WorkspaceEventHandlerTest, DoubleClickSingleAxisResizeEdge) { | 85 TEST_F(WorkspaceEventHandlerTest, DoubleClickSingleAxisResizeEdge) { |
| 86 // Double clicking the vertical resize edge of a window should maximize it | 86 // Double clicking the vertical resize edge of a window should maximize it |
| 87 // vertically. | 87 // vertically. |
| 88 gfx::Rect restored_bounds(10, 10, 50, 50); | 88 gfx::Rect restored_bounds(10, 10, 50, 50); |
| 89 aura::test::TestWindowDelegate wd; | 89 aura::test::TestWindowDelegate delegate; |
| 90 scoped_ptr<aura::Window> window(CreateTestWindow(&wd, restored_bounds)); | 90 scoped_ptr<aura::Window> window(CreateTestWindow(&delegate, restored_bounds)); |
| 91 | 91 |
| 92 wm::ActivateWindow(window.get()); | 92 wm::ActivateWindow(window.get()); |
| 93 | 93 |
| 94 gfx::Rect work_area = Shell::GetScreen()->GetDisplayNearestWindow( | 94 gfx::Rect work_area = Shell::GetScreen()->GetDisplayNearestWindow( |
| 95 window.get()).work_area(); | 95 window.get()).work_area(); |
| 96 | 96 |
| 97 aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), | 97 aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), |
| 98 window.get()); | 98 window.get()); |
| 99 | 99 |
| 100 // Double-click the top resize edge. | 100 // Double-click the top resize edge. |
| 101 wd.set_window_component(HTTOP); | 101 delegate.set_window_component(HTTOP); |
| 102 // On X a double click actually generates a drag between each press/release. | 102 // On X a double click actually generates a drag between each press/release. |
| 103 // Explicitly trigger this path since we had bugs in dealing with it | 103 // Explicitly trigger this path since we had bugs in dealing with it |
| 104 // correctly. | 104 // correctly. |
| 105 generator.PressLeftButton(); | 105 generator.PressLeftButton(); |
| 106 generator.ReleaseLeftButton(); | 106 generator.ReleaseLeftButton(); |
| 107 generator.set_flags(ui::EF_IS_DOUBLE_CLICK); | 107 generator.set_flags(ui::EF_IS_DOUBLE_CLICK); |
| 108 generator.PressLeftButton(); | 108 generator.PressLeftButton(); |
| 109 generator.MoveMouseTo(generator.current_location(), 1); | 109 generator.MoveMouseTo(generator.current_location(), 1); |
| 110 generator.ReleaseLeftButton(); | 110 generator.ReleaseLeftButton(); |
| 111 gfx::Rect bounds_in_screen = window->GetBoundsInScreen(); | 111 gfx::Rect bounds_in_screen = window->GetBoundsInScreen(); |
| 112 EXPECT_EQ(restored_bounds.x(), bounds_in_screen.x()); | 112 EXPECT_EQ(restored_bounds.x(), bounds_in_screen.x()); |
| 113 EXPECT_EQ(restored_bounds.width(), bounds_in_screen.width()); | 113 EXPECT_EQ(restored_bounds.width(), bounds_in_screen.width()); |
| 114 EXPECT_EQ(work_area.y(), bounds_in_screen.y()); | 114 EXPECT_EQ(work_area.y(), bounds_in_screen.y()); |
| 115 EXPECT_EQ(work_area.height(), bounds_in_screen.height()); | 115 EXPECT_EQ(work_area.height(), bounds_in_screen.height()); |
| 116 | 116 |
| 117 wm::WindowState* window_state = wm::GetWindowState(window.get()); | 117 wm::WindowState* window_state = wm::GetWindowState(window.get()); |
| 118 // Single-axis maximization is not considered real maximization. | 118 // Single-axis maximization is not considered real maximization. |
| 119 EXPECT_FALSE(window_state->IsMaximized()); | 119 EXPECT_FALSE(window_state->IsMaximized()); |
| 120 | 120 |
| 121 // Restore. | 121 // Restore. |
| 122 generator.DoubleClickLeftButton(); | 122 generator.DoubleClickLeftButton(); |
| 123 bounds_in_screen = window->GetBoundsInScreen(); | 123 bounds_in_screen = window->GetBoundsInScreen(); |
| 124 EXPECT_EQ(restored_bounds.ToString(), bounds_in_screen.ToString()); | 124 EXPECT_EQ(restored_bounds.ToString(), bounds_in_screen.ToString()); |
| 125 // Note that it should not even be restored at this point, it should have | 125 // Note that it should not even be restored at this point, it should have |
| 126 // also cleared the restore rectangle. | 126 // also cleared the restore rectangle. |
| 127 EXPECT_FALSE(window_state->HasRestoreBounds()); | 127 EXPECT_FALSE(window_state->HasRestoreBounds()); |
| 128 | 128 |
| 129 // Double clicking the left resize edge should maximize horizontally. | 129 // Double clicking the left resize edge should maximize horizontally. |
| 130 wd.set_window_component(HTLEFT); | 130 delegate.set_window_component(HTLEFT); |
| 131 generator.DoubleClickLeftButton(); | 131 generator.DoubleClickLeftButton(); |
| 132 bounds_in_screen = window->GetBoundsInScreen(); | 132 bounds_in_screen = window->GetBoundsInScreen(); |
| 133 EXPECT_EQ(restored_bounds.y(), bounds_in_screen.y()); | 133 EXPECT_EQ(restored_bounds.y(), bounds_in_screen.y()); |
| 134 EXPECT_EQ(restored_bounds.height(), bounds_in_screen.height()); | 134 EXPECT_EQ(restored_bounds.height(), bounds_in_screen.height()); |
| 135 EXPECT_EQ(work_area.x(), bounds_in_screen.x()); | 135 EXPECT_EQ(work_area.x(), bounds_in_screen.x()); |
| 136 EXPECT_EQ(work_area.width(), bounds_in_screen.width()); | 136 EXPECT_EQ(work_area.width(), bounds_in_screen.width()); |
| 137 // Single-axis maximization is not considered real maximization. | 137 // Single-axis maximization is not considered real maximization. |
| 138 EXPECT_FALSE(window_state->IsMaximized()); | 138 EXPECT_FALSE(window_state->IsMaximized()); |
| 139 | 139 |
| 140 // Restore. | 140 // Restore. |
| 141 generator.DoubleClickLeftButton(); | 141 generator.DoubleClickLeftButton(); |
| 142 EXPECT_EQ(restored_bounds.ToString(), window->GetBoundsInScreen().ToString()); | 142 EXPECT_EQ(restored_bounds.ToString(), window->GetBoundsInScreen().ToString()); |
| 143 | 143 |
| 144 #if defined(OS_WIN) | 144 #if defined(OS_WIN) |
| 145 // Multi display test does not run on Win8 bot. crbug.com/247427. | 145 // Multi display test does not run on Win8 bot. crbug.com/247427. |
| 146 if (base::win::GetVersion() >= base::win::VERSION_WIN8) | 146 if (base::win::GetVersion() >= base::win::VERSION_WIN8) |
| 147 return; | 147 return; |
| 148 #endif | 148 #endif |
| 149 | 149 |
| 150 // Verify the double clicking the resize edge works on 2nd display too. | 150 // Verify the double clicking the resize edge works on 2nd display too. |
| 151 UpdateDisplay("200x200,400x300"); | 151 UpdateDisplay("200x200,400x300"); |
| 152 gfx::Rect work_area2 = ScreenUtil::GetSecondaryDisplay().work_area(); | 152 gfx::Rect work_area2 = ScreenUtil::GetSecondaryDisplay().work_area(); |
| 153 restored_bounds.SetRect(220,20, 50, 50); | 153 restored_bounds.SetRect(220, 20, 50, 50); |
| 154 window->SetBoundsInScreen(restored_bounds, ScreenUtil::GetSecondaryDisplay()); | 154 window->SetBoundsInScreen(restored_bounds, ScreenUtil::GetSecondaryDisplay()); |
| 155 aura::Window* second_root = Shell::GetAllRootWindows()[1]; | 155 aura::Window* second_root = Shell::GetAllRootWindows()[1]; |
| 156 EXPECT_EQ(second_root, window->GetRootWindow()); | 156 EXPECT_EQ(second_root, window->GetRootWindow()); |
| 157 aura::test::EventGenerator generator2(second_root, window.get()); | 157 aura::test::EventGenerator generator2(second_root, window.get()); |
| 158 | 158 |
| 159 // Y-axis maximization. | 159 // Y-axis maximization. |
| 160 wd.set_window_component(HTTOP); | 160 delegate.set_window_component(HTTOP); |
| 161 generator2.PressLeftButton(); | 161 generator2.PressLeftButton(); |
| 162 generator2.ReleaseLeftButton(); | 162 generator2.ReleaseLeftButton(); |
| 163 generator2.set_flags(ui::EF_IS_DOUBLE_CLICK); | 163 generator2.set_flags(ui::EF_IS_DOUBLE_CLICK); |
| 164 generator2.PressLeftButton(); | 164 generator2.PressLeftButton(); |
| 165 generator2.MoveMouseTo(generator.current_location(), 1); | 165 generator2.MoveMouseTo(generator.current_location(), 1); |
| 166 generator2.ReleaseLeftButton(); | 166 generator2.ReleaseLeftButton(); |
| 167 generator.DoubleClickLeftButton(); | 167 generator.DoubleClickLeftButton(); |
| 168 bounds_in_screen = window->GetBoundsInScreen(); | 168 bounds_in_screen = window->GetBoundsInScreen(); |
| 169 EXPECT_EQ(restored_bounds.x(), bounds_in_screen.x()); | 169 EXPECT_EQ(restored_bounds.x(), bounds_in_screen.x()); |
| 170 EXPECT_EQ(restored_bounds.width(), bounds_in_screen.width()); | 170 EXPECT_EQ(restored_bounds.width(), bounds_in_screen.width()); |
| 171 EXPECT_EQ(work_area2.y(), bounds_in_screen.y()); | 171 EXPECT_EQ(work_area2.y(), bounds_in_screen.y()); |
| 172 EXPECT_EQ(work_area2.height(), bounds_in_screen.height()); | 172 EXPECT_EQ(work_area2.height(), bounds_in_screen.height()); |
| 173 EXPECT_FALSE(window_state->IsMaximized()); | 173 EXPECT_FALSE(window_state->IsMaximized()); |
| 174 | 174 |
| 175 // Restore. | 175 // Restore. |
| 176 generator2.DoubleClickLeftButton(); | 176 generator2.DoubleClickLeftButton(); |
| 177 EXPECT_EQ(restored_bounds.ToString(), window->GetBoundsInScreen().ToString()); | 177 EXPECT_EQ(restored_bounds.ToString(), window->GetBoundsInScreen().ToString()); |
| 178 | 178 |
| 179 // X-axis maximization. | 179 // X-axis maximization. |
| 180 wd.set_window_component(HTLEFT); | 180 delegate.set_window_component(HTLEFT); |
| 181 generator2.DoubleClickLeftButton(); | 181 generator2.DoubleClickLeftButton(); |
| 182 bounds_in_screen = window->GetBoundsInScreen(); | 182 bounds_in_screen = window->GetBoundsInScreen(); |
| 183 EXPECT_EQ(restored_bounds.y(), bounds_in_screen.y()); | 183 EXPECT_EQ(restored_bounds.y(), bounds_in_screen.y()); |
| 184 EXPECT_EQ(restored_bounds.height(), bounds_in_screen.height()); | 184 EXPECT_EQ(restored_bounds.height(), bounds_in_screen.height()); |
| 185 EXPECT_EQ(work_area2.x(), bounds_in_screen.x()); | 185 EXPECT_EQ(work_area2.x(), bounds_in_screen.x()); |
| 186 EXPECT_EQ(work_area2.width(), bounds_in_screen.width()); | 186 EXPECT_EQ(work_area2.width(), bounds_in_screen.width()); |
| 187 EXPECT_FALSE(window_state->IsMaximized()); | 187 EXPECT_FALSE(window_state->IsMaximized()); |
| 188 | 188 |
| 189 // Restore. | 189 // Restore. |
| 190 generator2.DoubleClickLeftButton(); | 190 generator2.DoubleClickLeftButton(); |
| 191 EXPECT_EQ(restored_bounds.ToString(), window->GetBoundsInScreen().ToString()); | 191 EXPECT_EQ(restored_bounds.ToString(), window->GetBoundsInScreen().ToString()); |
| 192 } | 192 } |
| 193 | 193 |
| 194 // Tests the behavior when double clicking the border of a side snapped window. | 194 // Tests the behavior when double clicking the border of a side snapped window. |
| 195 TEST_F(WorkspaceEventHandlerTest, DoubleClickSingleAxisWhenSideSnapped) { | 195 TEST_F(WorkspaceEventHandlerTest, DoubleClickSingleAxisWhenSideSnapped) { |
| 196 gfx::Rect restored_bounds(10, 10, 50, 50); | 196 gfx::Rect restored_bounds(10, 10, 50, 50); |
| 197 aura::test::TestWindowDelegate wd; | 197 aura::test::TestWindowDelegate delegate; |
| 198 scoped_ptr<aura::Window> window(CreateTestWindow(&wd, restored_bounds)); | 198 scoped_ptr<aura::Window> window(CreateTestWindow(&delegate, restored_bounds)); |
| 199 | 199 |
| 200 gfx::Rect work_area_in_screen = Shell::GetScreen()->GetDisplayNearestWindow( | 200 gfx::Rect work_area_in_screen = Shell::GetScreen()->GetDisplayNearestWindow( |
| 201 window.get()).work_area(); | 201 window.get()).work_area(); |
| 202 | 202 |
| 203 wm::WindowState* window_state = wm::GetWindowState(window.get()); | 203 wm::WindowState* window_state = wm::GetWindowState(window.get()); |
| 204 const wm::WMEvent snap_event(wm::WM_EVENT_SNAP_LEFT); | 204 const wm::WMEvent snap_event(wm::WM_EVENT_SNAP_LEFT); |
| 205 window_state->OnWMEvent(&snap_event); | 205 window_state->OnWMEvent(&snap_event); |
| 206 | 206 |
| 207 gfx::Rect snapped_bounds_in_screen = window->GetBoundsInScreen(); | 207 gfx::Rect snapped_bounds_in_screen = window->GetBoundsInScreen(); |
| 208 EXPECT_EQ(work_area_in_screen.x(), snapped_bounds_in_screen.x()); | 208 EXPECT_EQ(work_area_in_screen.x(), snapped_bounds_in_screen.x()); |
| 209 EXPECT_EQ(work_area_in_screen.y(), snapped_bounds_in_screen.y()); | 209 EXPECT_EQ(work_area_in_screen.y(), snapped_bounds_in_screen.y()); |
| 210 EXPECT_GT(work_area_in_screen.width(), snapped_bounds_in_screen.width()); | 210 EXPECT_GT(work_area_in_screen.width(), snapped_bounds_in_screen.width()); |
| 211 EXPECT_EQ(work_area_in_screen.height(), snapped_bounds_in_screen.height()); | 211 EXPECT_EQ(work_area_in_screen.height(), snapped_bounds_in_screen.height()); |
| 212 | 212 |
| 213 // Double clicking the top border should not do anything for side snapped | 213 // Double clicking the top border should not do anything for side snapped |
| 214 // windows. (They already take up the entire workspace height and reverting | 214 // windows. (They already take up the entire workspace height and reverting |
| 215 // to the restored bounds would be weird). | 215 // to the restored bounds would be weird). |
| 216 aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), | 216 aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), |
| 217 window.get()); | 217 window.get()); |
| 218 wd.set_window_component(HTTOP); | 218 delegate.set_window_component(HTTOP); |
| 219 generator.DoubleClickLeftButton(); | 219 generator.DoubleClickLeftButton(); |
| 220 EXPECT_EQ(wm::WINDOW_STATE_TYPE_LEFT_SNAPPED, window_state->GetStateType()); | 220 EXPECT_EQ(wm::WINDOW_STATE_TYPE_LEFT_SNAPPED, window_state->GetStateType()); |
| 221 EXPECT_EQ(snapped_bounds_in_screen.ToString(), | 221 EXPECT_EQ(snapped_bounds_in_screen.ToString(), |
| 222 window->GetBoundsInScreen().ToString()); | 222 window->GetBoundsInScreen().ToString()); |
| 223 | 223 |
| 224 // Double clicking the right border should exit the side snapped state and | 224 // Double clicking the right border should exit the side snapped state and |
| 225 // make the window take up the entire work area. | 225 // make the window take up the entire work area. |
| 226 wd.set_window_component(HTRIGHT); | 226 delegate.set_window_component(HTRIGHT); |
| 227 generator.DoubleClickLeftButton(); | 227 generator.DoubleClickLeftButton(); |
| 228 EXPECT_TRUE(window_state->IsNormalStateType()); | 228 EXPECT_TRUE(window_state->IsNormalStateType()); |
| 229 EXPECT_EQ(work_area_in_screen.ToString(), | 229 EXPECT_EQ(work_area_in_screen.ToString(), |
| 230 window->GetBoundsInScreen().ToString()); | 230 window->GetBoundsInScreen().ToString()); |
| 231 } | 231 } |
| 232 | 232 |
| 233 TEST_F(WorkspaceEventHandlerTest, | 233 TEST_F(WorkspaceEventHandlerTest, |
| 234 DoubleClickSingleAxisDoesntResizeVerticalEdgeIfConstrained) { | 234 DoubleClickSingleAxisDoesntResizeVerticalEdgeIfConstrained) { |
| 235 gfx::Rect restored_bounds(10, 10, 50, 50); | 235 gfx::Rect restored_bounds(10, 10, 50, 50); |
| 236 aura::test::TestWindowDelegate wd; | 236 aura::test::TestWindowDelegate delegate; |
| 237 scoped_ptr<aura::Window> window(CreateTestWindow(&wd, restored_bounds)); | 237 scoped_ptr<aura::Window> window(CreateTestWindow(&delegate, restored_bounds)); |
| 238 | 238 |
| 239 wm::ActivateWindow(window.get()); | 239 wm::ActivateWindow(window.get()); |
| 240 | 240 |
| 241 gfx::Rect work_area = Shell::GetScreen()->GetDisplayNearestWindow( | 241 gfx::Rect work_area = Shell::GetScreen()->GetDisplayNearestWindow( |
| 242 window.get()).work_area(); | 242 window.get()).work_area(); |
| 243 | 243 |
| 244 wd.set_maximum_size(gfx::Size(0, 100)); | 244 delegate.set_maximum_size(gfx::Size(0, 100)); |
| 245 | 245 |
| 246 aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), | 246 aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), |
| 247 window.get()); | 247 window.get()); |
| 248 // Double-click the top resize edge. | 248 // Double-click the top resize edge. |
| 249 wd.set_window_component(HTTOP); | 249 delegate.set_window_component(HTTOP); |
| 250 generator.DoubleClickLeftButton(); | 250 generator.DoubleClickLeftButton(); |
| 251 | 251 |
| 252 // The size of the window should be unchanged. | 252 // The size of the window should be unchanged. |
| 253 EXPECT_EQ(restored_bounds.y(), window->bounds().y()); | 253 EXPECT_EQ(restored_bounds.y(), window->bounds().y()); |
| 254 EXPECT_EQ(restored_bounds.height(), window->bounds().height()); | 254 EXPECT_EQ(restored_bounds.height(), window->bounds().height()); |
| 255 } | 255 } |
| 256 | 256 |
| 257 TEST_F(WorkspaceEventHandlerTest, | 257 TEST_F(WorkspaceEventHandlerTest, |
| 258 DoubleClickSingleAxisDoesntResizeHorizontalEdgeIfConstrained) { | 258 DoubleClickSingleAxisDoesntResizeHorizontalEdgeIfConstrained) { |
| 259 gfx::Rect restored_bounds(10, 10, 50, 50); | 259 gfx::Rect restored_bounds(10, 10, 50, 50); |
| 260 aura::test::TestWindowDelegate wd; | 260 aura::test::TestWindowDelegate delegate; |
| 261 scoped_ptr<aura::Window> window(CreateTestWindow(&wd, restored_bounds)); | 261 scoped_ptr<aura::Window> window(CreateTestWindow(&delegate, restored_bounds)); |
| 262 | 262 |
| 263 wm::ActivateWindow(window.get()); | 263 wm::ActivateWindow(window.get()); |
| 264 | 264 |
| 265 gfx::Rect work_area = Shell::GetScreen()->GetDisplayNearestWindow( | 265 gfx::Rect work_area = Shell::GetScreen()->GetDisplayNearestWindow( |
| 266 window.get()).work_area(); | 266 window.get()).work_area(); |
| 267 | 267 |
| 268 wd.set_maximum_size(gfx::Size(100, 0)); | 268 delegate.set_maximum_size(gfx::Size(100, 0)); |
| 269 | 269 |
| 270 aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), | 270 aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), |
| 271 window.get()); | 271 window.get()); |
| 272 // Double-click the top resize edge. | 272 // Double-click the top resize edge. |
| 273 wd.set_window_component(HTRIGHT); | 273 delegate.set_window_component(HTRIGHT); |
| 274 generator.DoubleClickLeftButton(); | 274 generator.DoubleClickLeftButton(); |
| 275 | 275 |
| 276 // The size of the window should be unchanged. | 276 // The size of the window should be unchanged. |
| 277 EXPECT_EQ(restored_bounds.x(), window->bounds().x()); | 277 EXPECT_EQ(restored_bounds.x(), window->bounds().x()); |
| 278 EXPECT_EQ(restored_bounds.width(), window->bounds().width()); | 278 EXPECT_EQ(restored_bounds.width(), window->bounds().width()); |
| 279 } | 279 } |
| 280 | 280 |
| 281 TEST_F(WorkspaceEventHandlerTest, | 281 TEST_F(WorkspaceEventHandlerTest, |
| 282 DoubleClickOrTapWithModalChildDoesntMaximize) { | 282 DoubleClickOrTapWithModalChildDoesntMaximize) { |
| 283 aura::test::TestWindowDelegate wd1; | 283 aura::test::TestWindowDelegate delegate1; |
| 284 aura::test::TestWindowDelegate wd2; | 284 aura::test::TestWindowDelegate delegate2; |
| 285 scoped_ptr<aura::Window> window( | 285 scoped_ptr<aura::Window> window( |
| 286 CreateTestWindow(&wd1, gfx::Rect(10, 20, 30, 40))); | 286 CreateTestWindow(&delegate1, gfx::Rect(10, 20, 30, 40))); |
| 287 scoped_ptr<aura::Window> child( | 287 scoped_ptr<aura::Window> child( |
| 288 CreateTestWindow(&wd2, gfx::Rect(0, 0, 1, 1))); | 288 CreateTestWindow(&delegate2, gfx::Rect(0, 0, 1, 1))); |
| 289 window->SetProperty(aura::client::kCanMaximizeKey, true); | 289 window->SetProperty(aura::client::kCanMaximizeKey, true); |
| 290 wd1.set_window_component(HTCAPTION); | 290 delegate1.set_window_component(HTCAPTION); |
| 291 | 291 |
| 292 child->SetProperty(aura::client::kModalKey, ui::MODAL_TYPE_WINDOW); | 292 child->SetProperty(aura::client::kModalKey, ui::MODAL_TYPE_WINDOW); |
| 293 ::wm::AddTransientChild(window.get(), child.get()); | 293 ::wm::AddTransientChild(window.get(), child.get()); |
| 294 | 294 |
| 295 wm::WindowState* window_state = wm::GetWindowState(window.get()); | 295 wm::WindowState* window_state = wm::GetWindowState(window.get()); |
| 296 EXPECT_FALSE(window_state->IsMaximized()); | 296 EXPECT_FALSE(window_state->IsMaximized()); |
| 297 aura::Window* root = Shell::GetPrimaryRootWindow(); | 297 aura::Window* root = Shell::GetPrimaryRootWindow(); |
| 298 aura::test::EventGenerator generator(root, window.get()); | 298 aura::test::EventGenerator generator(root, window.get()); |
| 299 generator.DoubleClickLeftButton(); | 299 generator.DoubleClickLeftButton(); |
| 300 EXPECT_EQ("10,20 30x40", window->bounds().ToString()); | 300 EXPECT_EQ("10,20 30x40", window->bounds().ToString()); |
| 301 EXPECT_FALSE(window_state->IsMaximized()); | 301 EXPECT_FALSE(window_state->IsMaximized()); |
| 302 | 302 |
| 303 generator.GestureTapAt(gfx::Point(25, 25)); | 303 generator.GestureTapAt(gfx::Point(25, 25)); |
| 304 generator.GestureTapAt(gfx::Point(25, 25)); | 304 generator.GestureTapAt(gfx::Point(25, 25)); |
| 305 RunAllPendingInMessageLoop(); | 305 RunAllPendingInMessageLoop(); |
| 306 EXPECT_EQ("10,20 30x40", window->bounds().ToString()); | 306 EXPECT_EQ("10,20 30x40", window->bounds().ToString()); |
| 307 EXPECT_FALSE(window_state->IsMaximized()); | 307 EXPECT_FALSE(window_state->IsMaximized()); |
| 308 } | 308 } |
| 309 | 309 |
| 310 // Test the behavior as a result of double clicking the window header. | 310 // Test the behavior as a result of double clicking the window header. |
| 311 TEST_F(WorkspaceEventHandlerTest, DoubleClickCaptionTogglesMaximize) { | 311 TEST_F(WorkspaceEventHandlerTest, DoubleClickCaptionTogglesMaximize) { |
| 312 aura::test::TestWindowDelegate wd; | 312 aura::test::TestWindowDelegate delegate; |
| 313 scoped_ptr<aura::Window> window( | 313 scoped_ptr<aura::Window> window( |
| 314 CreateTestWindow(&wd, gfx::Rect(1, 2, 30, 40))); | 314 CreateTestWindow(&delegate, gfx::Rect(1, 2, 30, 40))); |
| 315 window->SetProperty(aura::client::kCanMaximizeKey, true); | 315 window->SetProperty(aura::client::kCanMaximizeKey, true); |
| 316 | 316 |
| 317 wm::WindowState* window_state = wm::GetWindowState(window.get()); | 317 wm::WindowState* window_state = wm::GetWindowState(window.get()); |
| 318 gfx::Rect restore_bounds = window->bounds(); | 318 gfx::Rect restore_bounds = window->bounds(); |
| 319 gfx::Rect work_area_in_parent = ScreenUtil::GetDisplayWorkAreaBoundsInParent( | 319 gfx::Rect work_area_in_parent = ScreenUtil::GetDisplayWorkAreaBoundsInParent( |
| 320 window.get()); | 320 window.get()); |
| 321 | 321 |
| 322 EXPECT_FALSE(window_state->IsMaximized()); | 322 EXPECT_FALSE(window_state->IsMaximized()); |
| 323 | 323 |
| 324 // 1) Double clicking a normal window should maximize. | 324 // 1) Double clicking a normal window should maximize. |
| 325 wd.set_window_component(HTCAPTION); | 325 delegate.set_window_component(HTCAPTION); |
| 326 aura::Window* root = Shell::GetPrimaryRootWindow(); | 326 aura::Window* root = Shell::GetPrimaryRootWindow(); |
| 327 aura::test::EventGenerator generator(root, window.get()); | 327 aura::test::EventGenerator generator(root, window.get()); |
| 328 generator.ClickLeftButton(); |
| 328 generator.DoubleClickLeftButton(); | 329 generator.DoubleClickLeftButton(); |
| 329 EXPECT_NE(restore_bounds.ToString(), window->bounds().ToString()); | 330 EXPECT_NE(restore_bounds.ToString(), window->bounds().ToString()); |
| 330 EXPECT_TRUE(window_state->IsMaximized()); | 331 EXPECT_TRUE(window_state->IsMaximized()); |
| 331 | 332 |
| 333 generator.ClickLeftButton(); |
| 332 generator.DoubleClickLeftButton(); | 334 generator.DoubleClickLeftButton(); |
| 333 EXPECT_TRUE(window_state->IsNormalStateType()); | 335 EXPECT_TRUE(window_state->IsNormalStateType()); |
| 334 EXPECT_EQ(restore_bounds.ToString(), window->bounds().ToString()); | 336 EXPECT_EQ(restore_bounds.ToString(), window->bounds().ToString()); |
| 335 | 337 |
| 336 // 2) Double clicking a horizontally maximized window should maximize. | 338 // 2) Double clicking a horizontally maximized window should maximize. |
| 337 wd.set_window_component(HTLEFT); | 339 delegate.set_window_component(HTLEFT); |
| 340 generator.ClickLeftButton(); |
| 338 generator.DoubleClickLeftButton(); | 341 generator.DoubleClickLeftButton(); |
| 339 EXPECT_TRUE(window_state->IsNormalStateType()); | 342 EXPECT_TRUE(window_state->IsNormalStateType()); |
| 340 EXPECT_EQ(work_area_in_parent.x(), window->bounds().x()); | 343 EXPECT_EQ(work_area_in_parent.x(), window->bounds().x()); |
| 341 EXPECT_EQ(restore_bounds.y(), window->bounds().y()); | 344 EXPECT_EQ(restore_bounds.y(), window->bounds().y()); |
| 342 EXPECT_EQ(work_area_in_parent.width(), window->bounds().width()); | 345 EXPECT_EQ(work_area_in_parent.width(), window->bounds().width()); |
| 343 EXPECT_EQ(restore_bounds.height(), window->bounds().height()); | 346 EXPECT_EQ(restore_bounds.height(), window->bounds().height()); |
| 344 | 347 |
| 345 wd.set_window_component(HTCAPTION); | 348 delegate.set_window_component(HTCAPTION); |
| 349 generator.ClickLeftButton(); |
| 346 generator.DoubleClickLeftButton(); | 350 generator.DoubleClickLeftButton(); |
| 347 EXPECT_TRUE(window_state->IsMaximized()); | 351 EXPECT_TRUE(window_state->IsMaximized()); |
| 348 | 352 |
| 353 generator.ClickLeftButton(); |
| 349 generator.DoubleClickLeftButton(); | 354 generator.DoubleClickLeftButton(); |
| 350 EXPECT_TRUE(window_state->IsNormalStateType()); | 355 EXPECT_TRUE(window_state->IsNormalStateType()); |
| 351 EXPECT_EQ(restore_bounds.ToString(), window->bounds().ToString()); | 356 EXPECT_EQ(restore_bounds.ToString(), window->bounds().ToString()); |
| 352 | 357 |
| 353 // 3) Double clicking a snapped window should maximize. | 358 // 3) Double clicking a snapped window should maximize. |
| 354 const wm::WMEvent snap_event(wm::WM_EVENT_SNAP_LEFT); | 359 const wm::WMEvent snap_event(wm::WM_EVENT_SNAP_LEFT); |
| 355 window_state->OnWMEvent(&snap_event); | 360 window_state->OnWMEvent(&snap_event); |
| 356 EXPECT_TRUE(window_state->IsSnapped()); | 361 EXPECT_TRUE(window_state->IsSnapped()); |
| 357 generator.MoveMouseTo(window->GetBoundsInRootWindow().CenterPoint()); | 362 generator.MoveMouseTo(window->GetBoundsInRootWindow().CenterPoint()); |
| 363 generator.ClickLeftButton(); |
| 358 generator.DoubleClickLeftButton(); | 364 generator.DoubleClickLeftButton(); |
| 359 EXPECT_TRUE(window_state->IsMaximized()); | 365 EXPECT_TRUE(window_state->IsMaximized()); |
| 360 | 366 |
| 367 generator.ClickLeftButton(); |
| 361 generator.DoubleClickLeftButton(); | 368 generator.DoubleClickLeftButton(); |
| 362 EXPECT_TRUE(window_state->IsNormalStateType()); | 369 EXPECT_TRUE(window_state->IsNormalStateType()); |
| 363 EXPECT_EQ(restore_bounds.ToString(), window->bounds().ToString()); | 370 EXPECT_EQ(restore_bounds.ToString(), window->bounds().ToString()); |
| 364 } | 371 } |
| 365 | 372 |
| 366 // Test that double clicking the middle button on the window header does not | 373 // Test that double clicking the middle button on the window header does not |
| 367 // toggle the maximized state. | 374 // toggle the maximized state. |
| 368 TEST_F(WorkspaceEventHandlerTest, | 375 TEST_F(WorkspaceEventHandlerTest, |
| 369 DoubleClickMiddleButtonDoesNotToggleMaximize) { | 376 DoubleClickMiddleButtonDoesNotToggleMaximize) { |
| 370 aura::test::TestWindowDelegate wd; | 377 aura::test::TestWindowDelegate delegate; |
| 371 scoped_ptr<aura::Window> window( | 378 scoped_ptr<aura::Window> window( |
| 372 CreateTestWindow(&wd, gfx::Rect(1, 2, 30, 40))); | 379 CreateTestWindow(&delegate, gfx::Rect(1, 2, 30, 40))); |
| 373 window->SetProperty(aura::client::kCanMaximizeKey, true); | 380 window->SetProperty(aura::client::kCanMaximizeKey, true); |
| 374 wd.set_window_component(HTCAPTION); | 381 delegate.set_window_component(HTCAPTION); |
| 375 aura::Window* root = Shell::GetPrimaryRootWindow(); | 382 aura::Window* root = Shell::GetPrimaryRootWindow(); |
| 376 aura::test::EventGenerator generator(root, window.get()); | 383 aura::test::EventGenerator generator(root, window.get()); |
| 377 | 384 |
| 378 WindowPropertyObserver observer(window.get()); | 385 WindowPropertyObserver observer(window.get()); |
| 379 ui::MouseEvent press(ui::ET_MOUSE_PRESSED, generator.current_location(), | 386 ui::MouseEvent press(ui::ET_MOUSE_PRESSED, generator.current_location(), |
| 380 generator.current_location(), | 387 generator.current_location(), |
| 381 ui::EF_MIDDLE_MOUSE_BUTTON | ui::EF_IS_DOUBLE_CLICK, | 388 ui::EF_MIDDLE_MOUSE_BUTTON | ui::EF_IS_DOUBLE_CLICK, |
| 382 ui::EF_MIDDLE_MOUSE_BUTTON); | 389 ui::EF_MIDDLE_MOUSE_BUTTON); |
| 383 ui::EventProcessor* dispatcher = root->GetHost()->event_processor(); | 390 ui::EventProcessor* dispatcher = root->GetHost()->event_processor(); |
| 384 ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&press); | 391 ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&press); |
| 385 ASSERT_FALSE(details.dispatcher_destroyed); | 392 ASSERT_FALSE(details.dispatcher_destroyed); |
| 386 ui::MouseEvent release(ui::ET_MOUSE_RELEASED, generator.current_location(), | 393 ui::MouseEvent release(ui::ET_MOUSE_RELEASED, generator.current_location(), |
| 387 generator.current_location(), | 394 generator.current_location(), |
| 388 ui::EF_IS_DOUBLE_CLICK, | 395 ui::EF_IS_DOUBLE_CLICK, |
| 389 ui::EF_MIDDLE_MOUSE_BUTTON); | 396 ui::EF_MIDDLE_MOUSE_BUTTON); |
| 390 details = dispatcher->OnEventFromSource(&release); | 397 details = dispatcher->OnEventFromSource(&release); |
| 391 ASSERT_FALSE(details.dispatcher_destroyed); | 398 ASSERT_FALSE(details.dispatcher_destroyed); |
| 392 | 399 |
| 393 EXPECT_FALSE(wm::GetWindowState(window.get())->IsMaximized()); | 400 EXPECT_FALSE(wm::GetWindowState(window.get())->IsMaximized()); |
| 394 EXPECT_EQ("1,2 30x40", window->bounds().ToString()); | 401 EXPECT_EQ("1,2 30x40", window->bounds().ToString()); |
| 395 EXPECT_FALSE(observer.DidPropertyChange(aura::client::kShowStateKey)); | 402 EXPECT_FALSE(observer.DidPropertyChange(aura::client::kShowStateKey)); |
| 396 } | 403 } |
| 397 | 404 |
| 398 TEST_F(WorkspaceEventHandlerTest, DoubleTapCaptionTogglesMaximize) { | 405 TEST_F(WorkspaceEventHandlerTest, DoubleTapCaptionTogglesMaximize) { |
| 399 aura::test::TestWindowDelegate wd; | 406 aura::test::TestWindowDelegate delegate; |
| 400 gfx::Rect bounds(10, 20, 30, 40); | 407 gfx::Rect bounds(10, 20, 30, 40); |
| 401 scoped_ptr<aura::Window> window(CreateTestWindow(&wd, bounds)); | 408 scoped_ptr<aura::Window> window(CreateTestWindow(&delegate, bounds)); |
| 402 window->SetProperty(aura::client::kCanMaximizeKey, true); | 409 window->SetProperty(aura::client::kCanMaximizeKey, true); |
| 403 wd.set_window_component(HTCAPTION); | 410 delegate.set_window_component(HTCAPTION); |
| 404 | 411 |
| 405 wm::WindowState* window_state = wm::GetWindowState(window.get()); | 412 wm::WindowState* window_state = wm::GetWindowState(window.get()); |
| 406 EXPECT_FALSE(window_state->IsMaximized()); | 413 EXPECT_FALSE(window_state->IsMaximized()); |
| 407 aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), | 414 aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), |
| 408 window.get()); | 415 window.get()); |
| 409 generator.GestureTapAt(gfx::Point(25, 25)); | 416 generator.GestureTapAt(gfx::Point(25, 25)); |
| 410 generator.GestureTapAt(gfx::Point(25, 25)); | 417 generator.GestureTapAt(gfx::Point(25, 25)); |
| 411 RunAllPendingInMessageLoop(); | 418 RunAllPendingInMessageLoop(); |
| 412 EXPECT_NE(bounds.ToString(), window->bounds().ToString()); | 419 EXPECT_NE(bounds.ToString(), window->bounds().ToString()); |
| 413 EXPECT_TRUE(window_state->IsMaximized()); | 420 EXPECT_TRUE(window_state->IsMaximized()); |
| 414 | 421 |
| 415 generator.GestureTapAt(gfx::Point(5, 5)); | 422 generator.GestureTapAt(gfx::Point(5, 5)); |
| 416 generator.GestureTapAt(gfx::Point(10, 10)); | 423 generator.GestureTapAt(gfx::Point(10, 10)); |
| 417 | 424 |
| 418 EXPECT_FALSE(window_state->IsMaximized()); | 425 EXPECT_FALSE(window_state->IsMaximized()); |
| 419 EXPECT_EQ(bounds.ToString(), window->bounds().ToString()); | 426 EXPECT_EQ(bounds.ToString(), window->bounds().ToString()); |
| 420 } | 427 } |
| 421 | 428 |
| 422 // Verifies deleting the window while dragging doesn't crash. | 429 // Verifies deleting the window while dragging doesn't crash. |
| 423 TEST_F(WorkspaceEventHandlerTest, DeleteWhenDragging) { | 430 TEST_F(WorkspaceEventHandlerTest, DeleteWhenDragging) { |
| 424 // Create a large window in the background. This is necessary so that when we | 431 // Create a large window in the background. This is necessary so that when we |
| 425 // delete |window| WorkspaceEventHandler is still the active event handler. | 432 // delete |window| WorkspaceEventHandler is still the active event handler. |
| 426 aura::test::TestWindowDelegate wd2; | 433 aura::test::TestWindowDelegate delegate2; |
| 427 scoped_ptr<aura::Window> window2( | 434 scoped_ptr<aura::Window> window2( |
| 428 CreateTestWindow(&wd2, gfx::Rect(0, 0, 500, 500))); | 435 CreateTestWindow(&delegate2, gfx::Rect(0, 0, 500, 500))); |
| 429 | 436 |
| 430 aura::test::TestWindowDelegate wd; | 437 aura::test::TestWindowDelegate delegate; |
| 431 const gfx::Rect bounds(10, 20, 30, 40); | 438 const gfx::Rect bounds(10, 20, 30, 40); |
| 432 scoped_ptr<aura::Window> window(CreateTestWindow(&wd, bounds)); | 439 scoped_ptr<aura::Window> window(CreateTestWindow(&delegate, bounds)); |
| 433 wd.set_window_component(HTCAPTION); | 440 delegate.set_window_component(HTCAPTION); |
| 434 aura::test::EventGenerator generator(window->GetRootWindow()); | 441 aura::test::EventGenerator generator(window->GetRootWindow()); |
| 435 generator.MoveMouseToCenterOf(window.get()); | 442 generator.MoveMouseToCenterOf(window.get()); |
| 436 generator.PressLeftButton(); | 443 generator.PressLeftButton(); |
| 437 generator.MoveMouseTo(generator.current_location() + gfx::Vector2d(50, 50)); | 444 generator.MoveMouseTo(generator.current_location() + gfx::Vector2d(50, 50)); |
| 438 DCHECK_NE(bounds.origin().ToString(), window->bounds().origin().ToString()); | 445 DCHECK_NE(bounds.origin().ToString(), window->bounds().origin().ToString()); |
| 439 window.reset(); | 446 window.reset(); |
| 440 generator.MoveMouseTo(generator.current_location() + gfx::Vector2d(50, 50)); | 447 generator.MoveMouseTo(generator.current_location() + gfx::Vector2d(50, 50)); |
| 441 } | 448 } |
| 442 | 449 |
| 443 // Verifies deleting the window while in a run loop doesn't crash. | 450 // Verifies deleting the window while in a run loop doesn't crash. |
| 444 TEST_F(WorkspaceEventHandlerTest, DeleteWhileInRunLoop) { | 451 TEST_F(WorkspaceEventHandlerTest, DeleteWhileInRunLoop) { |
| 445 aura::test::TestWindowDelegate wd; | 452 aura::test::TestWindowDelegate delegate; |
| 446 const gfx::Rect bounds(10, 20, 30, 40); | 453 const gfx::Rect bounds(10, 20, 30, 40); |
| 447 scoped_ptr<aura::Window> window(CreateTestWindow(&wd, bounds)); | 454 scoped_ptr<aura::Window> window(CreateTestWindow(&delegate, bounds)); |
| 448 wd.set_window_component(HTCAPTION); | 455 delegate.set_window_component(HTCAPTION); |
| 449 | 456 |
| 450 ASSERT_TRUE(aura::client::GetWindowMoveClient(window->GetRootWindow())); | 457 ASSERT_TRUE(aura::client::GetWindowMoveClient(window->GetRootWindow())); |
| 451 base::MessageLoop::current()->DeleteSoon(FROM_HERE, window.get()); | 458 base::MessageLoop::current()->DeleteSoon(FROM_HERE, window.get()); |
| 452 aura::client::GetWindowMoveClient(window->GetRootWindow()) | 459 aura::client::GetWindowMoveClient(window->GetRootWindow()) |
| 453 ->RunMoveLoop(window.release(), | 460 ->RunMoveLoop(window.release(), |
| 454 gfx::Vector2d(), | 461 gfx::Vector2d(), |
| 455 aura::client::WINDOW_MOVE_SOURCE_MOUSE); | 462 aura::client::WINDOW_MOVE_SOURCE_MOUSE); |
| 456 } | 463 } |
| 457 | 464 |
| 465 // Verifies that double clicking in the header does not maximize if the target |
| 466 // component has changed. |
| 467 TEST_F(WorkspaceEventHandlerTest, |
| 468 DoubleClickTwoDifferentTargetsDoesntMaximize) { |
| 469 aura::test::TestWindowDelegate delegate; |
| 470 scoped_ptr<aura::Window> window( |
| 471 CreateTestWindow(&delegate, gfx::Rect(1, 2, 30, 40))); |
| 472 window->SetProperty(aura::client::kCanMaximizeKey, true); |
| 473 |
| 474 wm::WindowState* window_state = wm::GetWindowState(window.get()); |
| 475 gfx::Rect restore_bounds = window->bounds(); |
| 476 gfx::Rect work_area_in_parent = ScreenUtil::GetDisplayWorkAreaBoundsInParent( |
| 477 window.get()); |
| 478 |
| 479 EXPECT_FALSE(window_state->IsMaximized()); |
| 480 |
| 481 // First click will go to a client |
| 482 delegate.set_window_component(HTCLIENT); |
| 483 aura::Window* root = Shell::GetPrimaryRootWindow(); |
| 484 aura::test::EventGenerator generator(root, window.get()); |
| 485 generator.ClickLeftButton(); |
| 486 EXPECT_FALSE(window_state->IsMaximized()); |
| 487 |
| 488 // Second click will go to the header |
| 489 delegate.set_window_component(HTCAPTION); |
| 490 generator.DoubleClickLeftButton(); |
| 491 EXPECT_FALSE(window_state->IsMaximized()); |
| 492 } |
| 493 |
| 494 // Verifies that double tapping in the header does not maximize if the target |
| 495 // component has changed. |
| 496 TEST_F(WorkspaceEventHandlerTest, DoubleTapTwoDifferentTargetsDoesntMaximize) { |
| 497 aura::test::TestWindowDelegate delegate; |
| 498 scoped_ptr<aura::Window> window( |
| 499 CreateTestWindow(&delegate, gfx::Rect(1, 2, 30, 40))); |
| 500 window->SetProperty(aura::client::kCanMaximizeKey, true); |
| 501 |
| 502 wm::WindowState* window_state = wm::GetWindowState(window.get()); |
| 503 gfx::Rect restore_bounds = window->bounds(); |
| 504 gfx::Rect work_area_in_parent = ScreenUtil::GetDisplayWorkAreaBoundsInParent( |
| 505 window.get()); |
| 506 |
| 507 EXPECT_FALSE(window_state->IsMaximized()); |
| 508 |
| 509 // First tap will go to a client |
| 510 delegate.set_window_component(HTCLIENT); |
| 511 aura::Window* root = Shell::GetPrimaryRootWindow(); |
| 512 aura::test::EventGenerator generator(root, window.get()); |
| 513 generator.GestureTapAt(gfx::Point(25, 25)); |
| 514 EXPECT_FALSE(window_state->IsMaximized()); |
| 515 |
| 516 // Second tap will go to the header |
| 517 delegate.set_window_component(HTCAPTION); |
| 518 generator.GestureTapAt(gfx::Point(25, 25)); |
| 519 EXPECT_FALSE(window_state->IsMaximized()); |
| 520 } |
| 521 |
| 522 TEST_F(WorkspaceEventHandlerTest, |
| 523 RightClickDuringDoubleClickDoesntMaximize) { |
| 524 aura::test::TestWindowDelegate delegate; |
| 525 scoped_ptr<aura::Window> window( |
| 526 CreateTestWindow(&delegate, gfx::Rect(1, 2, 30, 40))); |
| 527 window->SetProperty(aura::client::kCanMaximizeKey, true); |
| 528 |
| 529 wm::WindowState* window_state = wm::GetWindowState(window.get()); |
| 530 gfx::Rect restore_bounds = window->bounds(); |
| 531 gfx::Rect work_area_in_parent = ScreenUtil::GetDisplayWorkAreaBoundsInParent( |
| 532 window.get()); |
| 533 |
| 534 EXPECT_FALSE(window_state->IsMaximized()); |
| 535 |
| 536 // First click will go to a client |
| 537 delegate.set_window_component(HTCLIENT); |
| 538 aura::Window* root = Shell::GetPrimaryRootWindow(); |
| 539 aura::test::EventGenerator generator(root, window.get()); |
| 540 generator.ClickLeftButton(); |
| 541 EXPECT_FALSE(window_state->IsMaximized()); |
| 542 |
| 543 // Second click will go to the header |
| 544 delegate.set_window_component(HTCAPTION); |
| 545 generator.PressRightButton(); |
| 546 generator.ReleaseRightButton(); |
| 547 EXPECT_FALSE(window_state->IsMaximized()); |
| 548 generator.DoubleClickLeftButton(); |
| 549 EXPECT_FALSE(window_state->IsMaximized()); |
| 550 } |
| 551 |
| 458 } // namespace internal | 552 } // namespace internal |
| 459 } // namespace ash | 553 } // namespace ash |
| OLD | NEW |