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 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
543 const int touch_default_radius = | 543 const int touch_default_radius = |
544 ui::GestureConfiguration::default_radius(); | 544 ui::GestureConfiguration::default_radius(); |
545 ui::GestureConfiguration::set_default_radius(0); | 545 ui::GestureConfiguration::set_default_radius(0); |
546 | 546 |
547 aura::WindowEventDispatcher* dispatcher = root_window->GetDispatcher(); | 547 aura::WindowEventDispatcher* dispatcher = root_window->GetDispatcher(); |
548 const int kTouchId = 2; | 548 const int kTouchId = 2; |
549 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, | 549 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, |
550 button_pos, | 550 button_pos, |
551 kTouchId, | 551 kTouchId, |
552 ui::EventTimeForNow()); | 552 ui::EventTimeForNow()); |
553 dispatcher->AsWindowTreeHostDelegate()->OnHostTouchEvent(&press); | 553 dispatcher->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); |
554 | 554 |
555 button_pos.Offset(9, 8); | 555 button_pos.Offset(9, 8); |
556 ui::TouchEvent release( | 556 ui::TouchEvent release( |
557 ui::ET_TOUCH_RELEASED, | 557 ui::ET_TOUCH_RELEASED, |
558 button_pos, | 558 button_pos, |
559 kTouchId, | 559 kTouchId, |
560 press.time_stamp() + base::TimeDelta::FromMilliseconds(50)); | 560 press.time_stamp() + base::TimeDelta::FromMilliseconds(50)); |
561 dispatcher->AsWindowTreeHostDelegate()->OnHostTouchEvent(&release); | 561 dispatcher->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); |
562 | 562 |
563 ui::GestureConfiguration::set_default_radius(touch_default_radius); | 563 ui::GestureConfiguration::set_default_radius(touch_default_radius); |
564 } | 564 } |
565 | 565 |
566 // Test that only the left button will activate the maximize button. | 566 // Test that only the left button will activate the maximize button. |
567 TEST_F(FrameMaximizeButtonTest, OnlyLeftButtonMaximizes) { | 567 TEST_F(FrameMaximizeButtonTest, OnlyLeftButtonMaximizes) { |
568 aura::Window* window = widget()->GetNativeWindow(); | 568 aura::Window* window = widget()->GetNativeWindow(); |
569 ash::FrameMaximizeButton* maximize_button = | 569 ash::FrameMaximizeButton* maximize_button = |
570 FrameMaximizeButtonTest::maximize_button(); | 570 FrameMaximizeButtonTest::maximize_button(); |
571 maximize_button->set_bubble_appearance_delay_ms(0); | 571 maximize_button->set_bubble_appearance_delay_ms(0); |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
861 | 861 |
862 // Test that we have properly reset the state of the now inactive window. | 862 // Test that we have properly reset the state of the now inactive window. |
863 EXPECT_FALSE(maximize_button->maximizer()); | 863 EXPECT_FALSE(maximize_button->maximizer()); |
864 EXPECT_FALSE(maximize_button->phantom_window_open()); | 864 EXPECT_FALSE(maximize_button->phantom_window_open()); |
865 EXPECT_TRUE(wm::GetWindowState(window)->IsNormalShowState()); | 865 EXPECT_TRUE(wm::GetWindowState(window)->IsNormalShowState()); |
866 EXPECT_EQ(initial_bounds.ToString(), window->GetBoundsInScreen().ToString()); | 866 EXPECT_EQ(initial_bounds.ToString(), window->GetBoundsInScreen().ToString()); |
867 } | 867 } |
868 | 868 |
869 } // namespace test | 869 } // namespace test |
870 } // namespace ash | 870 } // namespace ash |
OLD | NEW |