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/custom_frame_view_ash.h" | 5 #include "ash/wm/custom_frame_view_ash.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/test/ash_test_base.h" | 8 #include "ash/test/ash_test_base.h" |
9 #include "ash/wm/maximize_bubble_controller.h" | 9 #include "ash/wm/maximize_bubble_controller.h" |
10 #include "ash/wm/window_util.h" | 10 #include "ash/wm/window_util.h" |
11 #include "ash/wm/workspace/frame_maximize_button.h" | 11 #include "ash/wm/workspace/frame_maximize_button.h" |
12 #include "ash/wm/workspace/snap_sizer.h" | 12 #include "ash/wm/workspace/snap_sizer.h" |
13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
14 #include "ui/aura/aura_switches.h" | 14 #include "ui/aura/aura_switches.h" |
15 #include "ui/aura/client/aura_constants.h" | 15 #include "ui/aura/client/aura_constants.h" |
16 #include "ui/aura/focus_manager.h" | 16 #include "ui/aura/client/focus_client.h" |
17 #include "ui/aura/test/event_generator.h" | 17 #include "ui/aura/test/event_generator.h" |
18 #include "ui/aura/root_window.h" | 18 #include "ui/aura/root_window.h" |
19 #include "ui/aura/window.h" | 19 #include "ui/aura/window.h" |
20 #include "ui/base/gestures/gesture_configuration.h" | 20 #include "ui/base/gestures/gesture_configuration.h" |
21 #include "ui/views/controls/button/image_button.h" | 21 #include "ui/views/controls/button/image_button.h" |
22 #include "ui/views/test/test_views_delegate.h" | 22 #include "ui/views/test/test_views_delegate.h" |
23 #include "ui/views/widget/widget.h" | 23 #include "ui/views/widget/widget.h" |
24 #include "ui/views/widget/widget_delegate.h" | 24 #include "ui/views/widget/widget_delegate.h" |
25 | 25 |
26 namespace ash { | 26 namespace ash { |
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 CustomFrameViewAsh::TestApi test(frame); | 441 CustomFrameViewAsh::TestApi test(frame); |
442 ash::FrameMaximizeButton* maximize_button = test.maximize_button(); | 442 ash::FrameMaximizeButton* maximize_button = test.maximize_button(); |
443 maximize_button->set_bubble_appearance_delay_ms(0); | 443 maximize_button->set_bubble_appearance_delay_ms(0); |
444 gfx::Point button_pos = maximize_button->GetBoundsInScreen().CenterPoint(); | 444 gfx::Point button_pos = maximize_button->GetBoundsInScreen().CenterPoint(); |
445 gfx::Point off_pos(button_pos.x() + 100, button_pos.y() + 100); | 445 gfx::Point off_pos(button_pos.x() + 100, button_pos.y() + 100); |
446 | 446 |
447 aura::test::EventGenerator generator(window->GetRootWindow(), off_pos); | 447 aura::test::EventGenerator generator(window->GetRootWindow(), off_pos); |
448 EXPECT_FALSE(maximize_button->maximizer()); | 448 EXPECT_FALSE(maximize_button->maximizer()); |
449 EXPECT_TRUE(ash::wm::IsWindowNormal(window)); | 449 EXPECT_TRUE(ash::wm::IsWindowNormal(window)); |
450 | 450 |
451 aura::Window* active = window->GetFocusManager()->GetFocusedWindow(); | 451 aura::Window* active = |
| 452 aura::client::GetFocusClient(window)->GetFocusedWindow(); |
452 | 453 |
453 // Move the mouse cursor over the button to bring up the maximizer bubble. | 454 // Move the mouse cursor over the button to bring up the maximizer bubble. |
454 generator.MoveMouseTo(button_pos); | 455 generator.MoveMouseTo(button_pos); |
455 EXPECT_TRUE(maximize_button->maximizer()); | 456 EXPECT_TRUE(maximize_button->maximizer()); |
456 | 457 |
457 // Check that the focused window is still the same. | 458 // Check that the focused window is still the same. |
458 EXPECT_EQ(active, window->GetFocusManager()->GetFocusedWindow()); | 459 EXPECT_EQ(active, aura::client::GetFocusClient(window)->GetFocusedWindow()); |
459 } | 460 } |
460 | 461 |
461 TEST_F(CustomFrameViewAshTest, MaximizeTap) { | 462 TEST_F(CustomFrameViewAshTest, MaximizeTap) { |
462 views::Widget* widget = CreateWidget(); | 463 views::Widget* widget = CreateWidget(); |
463 aura::Window* window = widget->GetNativeWindow(); | 464 aura::Window* window = widget->GetNativeWindow(); |
464 aura::RootWindow* root_window = window->GetRootWindow(); | 465 aura::RootWindow* root_window = window->GetRootWindow(); |
465 CustomFrameViewAsh* frame = custom_frame_view_ash(widget); | 466 CustomFrameViewAsh* frame = custom_frame_view_ash(widget); |
466 CustomFrameViewAsh::TestApi test(frame); | 467 CustomFrameViewAsh::TestApi test(frame); |
467 ash::FrameMaximizeButton* maximize_button = test.maximize_button(); | 468 ash::FrameMaximizeButton* maximize_button = test.maximize_button(); |
468 gfx::Point button_pos = maximize_button->GetBoundsInScreen().CenterPoint(); | 469 gfx::Point button_pos = maximize_button->GetBoundsInScreen().CenterPoint(); |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
689 | 690 |
690 // We simulate the keystroke by calling minimizeWindow directly. | 691 // We simulate the keystroke by calling minimizeWindow directly. |
691 wm::MinimizeWindow(window); | 692 wm::MinimizeWindow(window); |
692 | 693 |
693 EXPECT_TRUE(ash::wm::IsWindowMinimized(window)); | 694 EXPECT_TRUE(ash::wm::IsWindowMinimized(window)); |
694 EXPECT_FALSE(maximize_button->maximizer()); | 695 EXPECT_FALSE(maximize_button->maximizer()); |
695 } | 696 } |
696 | 697 |
697 } // namespace internal | 698 } // namespace internal |
698 } // namespace ash | 699 } // namespace ash |
OLD | NEW |