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 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 EXPECT_FALSE(window_state->IsMaximized()); | 298 EXPECT_FALSE(window_state->IsMaximized()); |
299 EXPECT_EQ("1,2 30x40", window->bounds().ToString()); | 299 EXPECT_EQ("1,2 30x40", window->bounds().ToString()); |
300 | 300 |
301 // Double-clicking the middle button shouldn't toggle the maximized state. | 301 // Double-clicking the middle button shouldn't toggle the maximized state. |
302 WindowPropertyObserver observer(window.get()); | 302 WindowPropertyObserver observer(window.get()); |
303 ui::MouseEvent press(ui::ET_MOUSE_PRESSED, generator.current_location(), | 303 ui::MouseEvent press(ui::ET_MOUSE_PRESSED, generator.current_location(), |
304 generator.current_location(), | 304 generator.current_location(), |
305 ui::EF_MIDDLE_MOUSE_BUTTON | ui::EF_IS_DOUBLE_CLICK, | 305 ui::EF_MIDDLE_MOUSE_BUTTON | ui::EF_IS_DOUBLE_CLICK, |
306 ui::EF_MIDDLE_MOUSE_BUTTON); | 306 ui::EF_MIDDLE_MOUSE_BUTTON); |
307 aura::WindowEventDispatcher* dispatcher = root->GetDispatcher(); | 307 aura::WindowEventDispatcher* dispatcher = root->GetDispatcher(); |
308 dispatcher->AsWindowTreeHostDelegate()->OnHostMouseEvent(&press); | 308 ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&press); |
| 309 ASSERT_FALSE(details.dispatcher_destroyed); |
309 ui::MouseEvent release(ui::ET_MOUSE_RELEASED, generator.current_location(), | 310 ui::MouseEvent release(ui::ET_MOUSE_RELEASED, generator.current_location(), |
310 generator.current_location(), | 311 generator.current_location(), |
311 ui::EF_IS_DOUBLE_CLICK, | 312 ui::EF_IS_DOUBLE_CLICK, |
312 ui::EF_MIDDLE_MOUSE_BUTTON); | 313 ui::EF_MIDDLE_MOUSE_BUTTON); |
313 dispatcher->AsWindowTreeHostDelegate()->OnHostMouseEvent(&release); | 314 details = dispatcher->OnEventFromSource(&release); |
| 315 ASSERT_FALSE(details.dispatcher_destroyed); |
314 | 316 |
315 EXPECT_FALSE(window_state->IsMaximized()); | 317 EXPECT_FALSE(window_state->IsMaximized()); |
316 EXPECT_EQ("1,2 30x40", window->bounds().ToString()); | 318 EXPECT_EQ("1,2 30x40", window->bounds().ToString()); |
317 EXPECT_FALSE(observer.DidPropertyChange(aura::client::kShowStateKey)); | 319 EXPECT_FALSE(observer.DidPropertyChange(aura::client::kShowStateKey)); |
318 } | 320 } |
319 | 321 |
320 TEST_F(WorkspaceEventHandlerTest, DoubleTapCaptionTogglesMaximize) { | 322 TEST_F(WorkspaceEventHandlerTest, DoubleTapCaptionTogglesMaximize) { |
321 aura::test::TestWindowDelegate wd; | 323 aura::test::TestWindowDelegate wd; |
322 gfx::Rect bounds(10, 20, 30, 40); | 324 gfx::Rect bounds(10, 20, 30, 40); |
323 scoped_ptr<aura::Window> window(CreateTestWindow(&wd, bounds)); | 325 scoped_ptr<aura::Window> window(CreateTestWindow(&wd, bounds)); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
372 ASSERT_TRUE(aura::client::GetWindowMoveClient(window->GetRootWindow())); | 374 ASSERT_TRUE(aura::client::GetWindowMoveClient(window->GetRootWindow())); |
373 base::MessageLoop::current()->DeleteSoon(FROM_HERE, window.get()); | 375 base::MessageLoop::current()->DeleteSoon(FROM_HERE, window.get()); |
374 aura::client::GetWindowMoveClient(window->GetRootWindow()) | 376 aura::client::GetWindowMoveClient(window->GetRootWindow()) |
375 ->RunMoveLoop(window.release(), | 377 ->RunMoveLoop(window.release(), |
376 gfx::Vector2d(), | 378 gfx::Vector2d(), |
377 aura::client::WINDOW_MOVE_SOURCE_MOUSE); | 379 aura::client::WINDOW_MOVE_SOURCE_MOUSE); |
378 } | 380 } |
379 | 381 |
380 } // namespace internal | 382 } // namespace internal |
381 } // namespace ash | 383 } // namespace ash |
OLD | NEW |