| 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/common/wm/workspace/workspace_event_handler.h" | 5 #include "ash/common/wm/workspace/workspace_event_handler.h" |
| 6 | 6 |
| 7 #include "ash/common/wm/window_state.h" | 7 #include "ash/common/wm/window_state.h" |
| 8 #include "ash/common/wm/wm_event.h" | 8 #include "ash/common/wm/wm_event.h" |
| 9 #include "ash/common/wm/workspace_controller.h" | 9 #include "ash/common/wm/workspace_controller.h" |
| 10 #include "ash/screen_util.h" | 10 #include "ash/screen_util.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "ui/aura/window_tree_host.h" | 21 #include "ui/aura/window_tree_host.h" |
| 22 #include "ui/base/hit_test.h" | 22 #include "ui/base/hit_test.h" |
| 23 #include "ui/display/manager/display_manager.h" | 23 #include "ui/display/manager/display_manager.h" |
| 24 #include "ui/display/screen.h" | 24 #include "ui/display/screen.h" |
| 25 #include "ui/events/event_processor.h" | 25 #include "ui/events/event_processor.h" |
| 26 #include "ui/events/event_utils.h" | 26 #include "ui/events/event_utils.h" |
| 27 #include "ui/events/test/event_generator.h" | 27 #include "ui/events/test/event_generator.h" |
| 28 #include "ui/wm/core/window_util.h" | 28 #include "ui/wm/core/window_util.h" |
| 29 #include "ui/wm/public/window_move_client.h" | 29 #include "ui/wm/public/window_move_client.h" |
| 30 | 30 |
| 31 #if defined(OS_WIN) | |
| 32 #include "base/win/windows_version.h" | |
| 33 #endif | |
| 34 | |
| 35 namespace ash { | 31 namespace ash { |
| 36 | 32 |
| 37 namespace { | 33 namespace { |
| 38 | 34 |
| 39 // Clicks |button| with |flags|. | 35 // Clicks |button| with |flags|. |
| 40 void ClickButtonWithFlags(ui::test::EventGenerator* generator, | 36 void ClickButtonWithFlags(ui::test::EventGenerator* generator, |
| 41 int button, | 37 int button, |
| 42 int flags) { | 38 int flags) { |
| 43 gfx::Point location = generator->current_location(); | 39 gfx::Point location = generator->current_location(); |
| 44 ui::MouseEvent press(ui::ET_MOUSE_PRESSED, location, location, | 40 ui::MouseEvent press(ui::ET_MOUSE_PRESSED, location, location, |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 EXPECT_EQ(restored_bounds.height(), bounds_in_screen.height()); | 149 EXPECT_EQ(restored_bounds.height(), bounds_in_screen.height()); |
| 154 EXPECT_EQ(work_area.x(), bounds_in_screen.x()); | 150 EXPECT_EQ(work_area.x(), bounds_in_screen.x()); |
| 155 EXPECT_EQ(work_area.width(), bounds_in_screen.width()); | 151 EXPECT_EQ(work_area.width(), bounds_in_screen.width()); |
| 156 // Single-axis maximization is not considered real maximization. | 152 // Single-axis maximization is not considered real maximization. |
| 157 EXPECT_FALSE(window_state->IsMaximized()); | 153 EXPECT_FALSE(window_state->IsMaximized()); |
| 158 | 154 |
| 159 // Restore. | 155 // Restore. |
| 160 generator.DoubleClickLeftButton(); | 156 generator.DoubleClickLeftButton(); |
| 161 EXPECT_EQ(restored_bounds.ToString(), window->GetBoundsInScreen().ToString()); | 157 EXPECT_EQ(restored_bounds.ToString(), window->GetBoundsInScreen().ToString()); |
| 162 | 158 |
| 163 #if defined(OS_WIN) | |
| 164 // Multi display test does not run on Win8 bot. crbug.com/247427. | |
| 165 if (!SupportsMultipleDisplays()) | |
| 166 return; | |
| 167 #endif | |
| 168 | |
| 169 // Verify the double clicking the resize edge works on 2nd display too. | 159 // Verify the double clicking the resize edge works on 2nd display too. |
| 170 UpdateDisplay("200x200,400x300"); | 160 UpdateDisplay("200x200,400x300"); |
| 171 gfx::Rect work_area2 = display_manager()->GetSecondaryDisplay().work_area(); | 161 gfx::Rect work_area2 = display_manager()->GetSecondaryDisplay().work_area(); |
| 172 restored_bounds.SetRect(220, 20, 50, 50); | 162 restored_bounds.SetRect(220, 20, 50, 50); |
| 173 window->SetBoundsInScreen(restored_bounds, | 163 window->SetBoundsInScreen(restored_bounds, |
| 174 display_manager()->GetSecondaryDisplay()); | 164 display_manager()->GetSecondaryDisplay()); |
| 175 aura::Window* second_root = Shell::GetAllRootWindows()[1]; | 165 aura::Window* second_root = Shell::GetAllRootWindows()[1]; |
| 176 EXPECT_EQ(second_root, window->GetRootWindow()); | 166 EXPECT_EQ(second_root, window->GetRootWindow()); |
| 177 ui::test::EventGenerator generator2(second_root, window.get()); | 167 ui::test::EventGenerator generator2(second_root, window.get()); |
| 178 | 168 |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 delegate.set_window_component(HTCAPTION); | 529 delegate.set_window_component(HTCAPTION); |
| 540 generator.PressRightButton(); | 530 generator.PressRightButton(); |
| 541 generator.ReleaseRightButton(); | 531 generator.ReleaseRightButton(); |
| 542 EXPECT_FALSE(window_state->IsMaximized()); | 532 EXPECT_FALSE(window_state->IsMaximized()); |
| 543 ClickButtonWithFlags(&generator, ui::EF_LEFT_MOUSE_BUTTON, | 533 ClickButtonWithFlags(&generator, ui::EF_LEFT_MOUSE_BUTTON, |
| 544 ui::EF_IS_DOUBLE_CLICK); | 534 ui::EF_IS_DOUBLE_CLICK); |
| 545 EXPECT_FALSE(window_state->IsMaximized()); | 535 EXPECT_FALSE(window_state->IsMaximized()); |
| 546 } | 536 } |
| 547 | 537 |
| 548 } // namespace ash | 538 } // namespace ash |
| OLD | NEW |