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_ash.h" | 7 #include "ash/screen_ash.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/property_util.h" | 10 #include "ash/wm/property_util.h" |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 wd.set_window_component(HTRIGHT); | 208 wd.set_window_component(HTRIGHT); |
209 generator.DoubleClickLeftButton(); | 209 generator.DoubleClickLeftButton(); |
210 | 210 |
211 // The size of the window should be unchanged. | 211 // The size of the window should be unchanged. |
212 EXPECT_EQ(restored_bounds.x(), window->bounds().x()); | 212 EXPECT_EQ(restored_bounds.x(), window->bounds().x()); |
213 EXPECT_EQ(restored_bounds.width(), window->bounds().width()); | 213 EXPECT_EQ(restored_bounds.width(), window->bounds().width()); |
214 } | 214 } |
215 | 215 |
216 TEST_F(WorkspaceEventHandlerTest, DoubleClickCaptionTogglesMaximize) { | 216 TEST_F(WorkspaceEventHandlerTest, DoubleClickCaptionTogglesMaximize) { |
217 aura::test::TestWindowDelegate wd; | 217 aura::test::TestWindowDelegate wd; |
218 scoped_ptr<aura::Window> window(CreateTestWindow(&wd, gfx::Rect(1, 2, 3, 4))); | 218 scoped_ptr<aura::Window> window( |
| 219 CreateTestWindow(&wd, gfx::Rect(1, 2, 30, 40))); |
219 window->SetProperty(aura::client::kCanMaximizeKey, true); | 220 window->SetProperty(aura::client::kCanMaximizeKey, true); |
220 wd.set_window_component(HTCAPTION); | 221 wd.set_window_component(HTCAPTION); |
221 EXPECT_FALSE(wm::IsWindowMaximized(window.get())); | 222 EXPECT_FALSE(wm::IsWindowMaximized(window.get())); |
222 aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), | 223 aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), |
223 window.get()); | 224 window.get()); |
224 generator.DoubleClickLeftButton(); | 225 generator.DoubleClickLeftButton(); |
225 EXPECT_NE("1,2 3x4", window->bounds().ToString()); | 226 EXPECT_NE("1,2 30x40", window->bounds().ToString()); |
226 | 227 |
227 EXPECT_TRUE(wm::IsWindowMaximized(window.get())); | 228 EXPECT_TRUE(wm::IsWindowMaximized(window.get())); |
228 generator.DoubleClickLeftButton(); | 229 generator.DoubleClickLeftButton(); |
229 | 230 |
230 EXPECT_FALSE(wm::IsWindowMaximized(window.get())); | 231 EXPECT_FALSE(wm::IsWindowMaximized(window.get())); |
231 EXPECT_EQ("1,2 3x4", window->bounds().ToString()); | 232 EXPECT_EQ("1,2 30x40", window->bounds().ToString()); |
232 } | 233 } |
233 | 234 |
234 TEST_F(WorkspaceEventHandlerTest, DoubleTapCaptionTogglesMaximize) { | 235 TEST_F(WorkspaceEventHandlerTest, DoubleTapCaptionTogglesMaximize) { |
235 aura::test::TestWindowDelegate wd; | 236 aura::test::TestWindowDelegate wd; |
236 gfx::Rect bounds(10, 20, 30, 40); | 237 gfx::Rect bounds(10, 20, 30, 40); |
237 scoped_ptr<aura::Window> window(CreateTestWindow(&wd, bounds)); | 238 scoped_ptr<aura::Window> window(CreateTestWindow(&wd, bounds)); |
238 window->SetProperty(aura::client::kCanMaximizeKey, true); | 239 window->SetProperty(aura::client::kCanMaximizeKey, true); |
239 wd.set_window_component(HTCAPTION); | 240 wd.set_window_component(HTCAPTION); |
240 EXPECT_FALSE(wm::IsWindowMaximized(window.get())); | 241 EXPECT_FALSE(wm::IsWindowMaximized(window.get())); |
241 aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), | 242 aura::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 ASSERT_TRUE(aura::client::GetWindowMoveClient(window->parent())); | 285 ASSERT_TRUE(aura::client::GetWindowMoveClient(window->parent())); |
285 base::MessageLoop::current()->DeleteSoon(FROM_HERE, window.get()); | 286 base::MessageLoop::current()->DeleteSoon(FROM_HERE, window.get()); |
286 aura::client::GetWindowMoveClient(window->parent()) | 287 aura::client::GetWindowMoveClient(window->parent()) |
287 ->RunMoveLoop(window.release(), | 288 ->RunMoveLoop(window.release(), |
288 gfx::Vector2d(), | 289 gfx::Vector2d(), |
289 aura::client::WINDOW_MOVE_SOURCE_MOUSE); | 290 aura::client::WINDOW_MOVE_SOURCE_MOUSE); |
290 } | 291 } |
291 | 292 |
292 } // namespace internal | 293 } // namespace internal |
293 } // namespace ash | 294 } // namespace ash |
OLD | NEW |