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->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); | 561 dispatcher->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press); |
562 | 562 |
563 button_pos.Offset(9, 8); | 563 button_pos.Offset(9, 8); |
564 ui::TouchEvent release( | 564 ui::TouchEvent release( |
565 ui::ET_TOUCH_RELEASED, | 565 ui::ET_TOUCH_RELEASED, |
566 button_pos, | 566 button_pos, |
567 kTouchId, | 567 kTouchId, |
568 press.time_stamp() + base::TimeDelta::FromMilliseconds(50)); | 568 press.time_stamp() + base::TimeDelta::FromMilliseconds(50)); |
569 dispatcher->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); | 569 dispatcher->AsWindowTreeHostDelegate()->OnHostTouchEvent(&release); |
570 | 570 |
571 ui::GestureConfiguration::set_default_radius(touch_default_radius); | 571 ui::GestureConfiguration::set_default_radius(touch_default_radius); |
572 } | 572 } |
573 | 573 |
574 // Test that only the left button will activate the maximize button. | 574 // Test that only the left button will activate the maximize button. |
575 TEST_F(FrameMaximizeButtonTest, OnlyLeftButtonMaximizes) { | 575 TEST_F(FrameMaximizeButtonTest, OnlyLeftButtonMaximizes) { |
576 aura::Window* window = widget()->GetNativeWindow(); | 576 aura::Window* window = widget()->GetNativeWindow(); |
577 ash::FrameMaximizeButton* maximize_button = | 577 ash::FrameMaximizeButton* maximize_button = |
578 FrameMaximizeButtonTest::maximize_button(); | 578 FrameMaximizeButtonTest::maximize_button(); |
579 maximize_button->set_bubble_appearance_delay_ms(0); | 579 maximize_button->set_bubble_appearance_delay_ms(0); |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
869 | 869 |
870 // Test that we have properly reset the state of the now inactive window. | 870 // Test that we have properly reset the state of the now inactive window. |
871 EXPECT_FALSE(maximize_button->maximizer()); | 871 EXPECT_FALSE(maximize_button->maximizer()); |
872 EXPECT_FALSE(maximize_button->phantom_window_open()); | 872 EXPECT_FALSE(maximize_button->phantom_window_open()); |
873 EXPECT_TRUE(wm::GetWindowState(window)->IsNormalShowState()); | 873 EXPECT_TRUE(wm::GetWindowState(window)->IsNormalShowState()); |
874 EXPECT_EQ(initial_bounds.ToString(), window->GetBoundsInScreen().ToString()); | 874 EXPECT_EQ(initial_bounds.ToString(), window->GetBoundsInScreen().ToString()); |
875 } | 875 } |
876 | 876 |
877 } // namespace test | 877 } // namespace test |
878 } // namespace ash | 878 } // namespace ash |
OLD | NEW |