OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/caption_buttons/frame_maximize_button.h" | 5 #include "ash/wm/caption_buttons/frame_maximize_button.h" |
6 | 6 |
7 #include "ash/ash_switches.h" | 7 #include "ash/ash_switches.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/caption_buttons/frame_caption_button_container_view.h" | 10 #include "ash/wm/caption_buttons/frame_caption_button_container_view.h" |
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 const int touch_default_radius = | 551 const int touch_default_radius = |
552 ui::GestureConfiguration::default_radius(); | 552 ui::GestureConfiguration::default_radius(); |
553 ui::GestureConfiguration::set_default_radius(0); | 553 ui::GestureConfiguration::set_default_radius(0); |
554 | 554 |
555 aura::WindowEventDispatcher* dispatcher = root_window->GetDispatcher(); | 555 aura::WindowEventDispatcher* dispatcher = root_window->GetDispatcher(); |
556 const int kTouchId = 2; | 556 const int kTouchId = 2; |
557 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, | 557 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, |
558 button_pos, | 558 button_pos, |
559 kTouchId, | 559 kTouchId, |
560 ui::EventTimeForNow()); | 560 ui::EventTimeForNow()); |
561 dispatcher->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press); | 561 ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&press); |
| 562 ASSERT_FALSE(details.dispatcher_destroyed); |
562 | 563 |
563 button_pos.Offset(9, 8); | 564 button_pos.Offset(9, 8); |
564 ui::TouchEvent release( | 565 ui::TouchEvent release( |
565 ui::ET_TOUCH_RELEASED, | 566 ui::ET_TOUCH_RELEASED, |
566 button_pos, | 567 button_pos, |
567 kTouchId, | 568 kTouchId, |
568 press.time_stamp() + base::TimeDelta::FromMilliseconds(50)); | 569 press.time_stamp() + base::TimeDelta::FromMilliseconds(50)); |
569 dispatcher->AsWindowTreeHostDelegate()->OnHostTouchEvent(&release); | 570 details = dispatcher->OnEventFromSource(&release); |
| 571 ASSERT_FALSE(details.dispatcher_destroyed); |
570 | 572 |
571 ui::GestureConfiguration::set_default_radius(touch_default_radius); | 573 ui::GestureConfiguration::set_default_radius(touch_default_radius); |
572 } | 574 } |
573 | 575 |
574 // Test that only the left button will activate the maximize button. | 576 // Test that only the left button will activate the maximize button. |
575 TEST_F(FrameMaximizeButtonTest, OnlyLeftButtonMaximizes) { | 577 TEST_F(FrameMaximizeButtonTest, OnlyLeftButtonMaximizes) { |
576 aura::Window* window = widget()->GetNativeWindow(); | 578 aura::Window* window = widget()->GetNativeWindow(); |
577 ash::FrameMaximizeButton* maximize_button = | 579 ash::FrameMaximizeButton* maximize_button = |
578 FrameMaximizeButtonTest::maximize_button(); | 580 FrameMaximizeButtonTest::maximize_button(); |
579 maximize_button->set_bubble_appearance_delay_ms(0); | 581 maximize_button->set_bubble_appearance_delay_ms(0); |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
869 | 871 |
870 // Test that we have properly reset the state of the now inactive window. | 872 // Test that we have properly reset the state of the now inactive window. |
871 EXPECT_FALSE(maximize_button->maximizer()); | 873 EXPECT_FALSE(maximize_button->maximizer()); |
872 EXPECT_FALSE(maximize_button->phantom_window_open()); | 874 EXPECT_FALSE(maximize_button->phantom_window_open()); |
873 EXPECT_TRUE(wm::GetWindowState(window)->IsNormalShowState()); | 875 EXPECT_TRUE(wm::GetWindowState(window)->IsNormalShowState()); |
874 EXPECT_EQ(initial_bounds.ToString(), window->GetBoundsInScreen().ToString()); | 876 EXPECT_EQ(initial_bounds.ToString(), window->GetBoundsInScreen().ToString()); |
875 } | 877 } |
876 | 878 |
877 } // namespace test | 879 } // namespace test |
878 } // namespace ash | 880 } // namespace ash |
OLD | NEW |