Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(877)

Side by Side Diff: ash/wm/toplevel_window_event_handler_unittest.cc

Issue 2618143002: cros: Remove some OS platform ifdefs from ash (Closed)
Patch Set: rebase Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/wm/system_gesture_event_filter.cc ('k') | ash/wm/window_manager_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/toplevel_window_event_handler.h" 5 #include "ash/wm/toplevel_window_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/public/cpp/shell_window_ids.h" 10 #include "ash/public/cpp/shell_window_ids.h"
(...skipping 15 matching lines...) Expand all
26 #include "ui/aura/window_event_dispatcher.h" 26 #include "ui/aura/window_event_dispatcher.h"
27 #include "ui/base/hit_test.h" 27 #include "ui/base/hit_test.h"
28 #include "ui/display/display_layout_builder.h" 28 #include "ui/display/display_layout_builder.h"
29 #include "ui/display/manager/display_manager.h" 29 #include "ui/display/manager/display_manager.h"
30 #include "ui/display/screen.h" 30 #include "ui/display/screen.h"
31 #include "ui/events/event.h" 31 #include "ui/events/event.h"
32 #include "ui/events/test/event_generator.h" 32 #include "ui/events/test/event_generator.h"
33 #include "ui/wm/core/window_util.h" 33 #include "ui/wm/core/window_util.h"
34 #include "ui/wm/public/window_move_client.h" 34 #include "ui/wm/public/window_move_client.h"
35 35
36 #if defined(OS_WIN)
37 // Windows headers define macros for these function names which screw with us.
38 #if defined(CreateWindow)
39 #undef CreateWindow
40 #endif
41 #endif
42
43 namespace ash { 36 namespace ash {
44 namespace test { 37 namespace test {
45 38
46 namespace { 39 namespace {
47 40
48 // A simple window delegate that returns the specified hit-test code when 41 // A simple window delegate that returns the specified hit-test code when
49 // requested and applies a minimum size constraint if there is one. 42 // requested and applies a minimum size constraint if there is one.
50 class TestWindowDelegate : public aura::test::TestWindowDelegate { 43 class TestWindowDelegate : public aura::test::TestWindowDelegate {
51 public: 44 public:
52 explicit TestWindowDelegate(int hittest_code) { 45 explicit TestWindowDelegate(int hittest_code) {
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after
671 ui::test::EventGenerator gen(Shell::GetPrimaryRootWindow(), notmoved.get()); 664 ui::test::EventGenerator gen(Shell::GetPrimaryRootWindow(), notmoved.get());
672 gfx::Point start = notmoved->bounds().origin() + gfx::Vector2d(10, 10); 665 gfx::Point start = notmoved->bounds().origin() + gfx::Vector2d(10, 10);
673 gfx::Point end = start + gfx::Vector2d(100, 10); 666 gfx::Point end = start + gfx::Vector2d(100, 10);
674 gen.GestureScrollSequence(start, end, base::TimeDelta::FromMilliseconds(10), 667 gen.GestureScrollSequence(start, end, base::TimeDelta::FromMilliseconds(10),
675 10); 668 10);
676 EXPECT_EQ(bounds.ToString(), notmoved->bounds().ToString()); 669 EXPECT_EQ(bounds.ToString(), notmoved->bounds().ToString());
677 } 670 }
678 } 671 }
679 672
680 // Verifies pressing escape resets the bounds to the original bounds. 673 // Verifies pressing escape resets the bounds to the original bounds.
681 // Disabled crbug.com/166219. 674 TEST_F(ToplevelWindowEventHandlerTest, EscapeReverts) {
682 #if defined(OS_WIN)
683 #define MAYBE_EscapeReverts DISABLED_EscapeReverts
684 #else
685 #define MAYBE_EscapeReverts EscapeReverts
686 #endif
687 TEST_F(ToplevelWindowEventHandlerTest, MAYBE_EscapeReverts) {
688 std::unique_ptr<aura::Window> target(CreateWindow(HTBOTTOMRIGHT)); 675 std::unique_ptr<aura::Window> target(CreateWindow(HTBOTTOMRIGHT));
689 ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), 676 ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow(),
690 target.get()); 677 target.get());
691 generator.PressLeftButton(); 678 generator.PressLeftButton();
692 generator.MoveMouseBy(10, 11); 679 generator.MoveMouseBy(10, 11);
693 680
694 // Execute any scheduled draws so that pending mouse events are processed. 681 // Execute any scheduled draws so that pending mouse events are processed.
695 RunAllPendingInMessageLoop(); 682 RunAllPendingInMessageLoop();
696 683
697 EXPECT_EQ("0,0 110x111", target->bounds().ToString()); 684 EXPECT_EQ("0,0 110x111", target->bounds().ToString());
698 generator.PressKey(ui::VKEY_ESCAPE, 0); 685 generator.PressKey(ui::VKEY_ESCAPE, 0);
699 generator.ReleaseKey(ui::VKEY_ESCAPE, 0); 686 generator.ReleaseKey(ui::VKEY_ESCAPE, 0);
700 EXPECT_EQ("0,0 100x100", target->bounds().ToString()); 687 EXPECT_EQ("0,0 100x100", target->bounds().ToString());
701 } 688 }
702 689
703 // Verifies window minimization/maximization completes drag. 690 // Verifies window minimization/maximization completes drag.
704 // Disabled crbug.com/166219. 691 TEST_F(ToplevelWindowEventHandlerTest, MinimizeMaximizeCompletes) {
705 #if defined(OS_WIN)
706 #define MAYBE_MinimizeMaximizeCompletes DISABLED_MinimizeMaximizeCompletes
707 #else
708 #define MAYBE_MinimizeMaximizeCompletes MinimizeMaximizeCompletes
709 #endif
710 TEST_F(ToplevelWindowEventHandlerTest, MAYBE_MinimizeMaximizeCompletes) {
711 // Once window is minimized, window dragging completes. 692 // Once window is minimized, window dragging completes.
712 { 693 {
713 std::unique_ptr<aura::Window> target(CreateWindow(HTCAPTION)); 694 std::unique_ptr<aura::Window> target(CreateWindow(HTCAPTION));
714 target->Focus(); 695 target->Focus();
715 ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow(), 696 ui::test::EventGenerator generator(Shell::GetPrimaryRootWindow(),
716 target.get()); 697 target.get());
717 generator.PressLeftButton(); 698 generator.PressLeftButton();
718 generator.MoveMouseBy(10, 11); 699 generator.MoveMouseBy(10, 11);
719 RunAllPendingInMessageLoop(); 700 RunAllPendingInMessageLoop();
720 EXPECT_EQ("10,11 100x100", target->bounds().ToString()); 701 EXPECT_EQ("10,11 100x100", target->bounds().ToString());
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
868 // The window is now fully contained in the secondary display. 849 // The window is now fully contained in the secondary display.
869 EXPECT_TRUE(display_manager()->GetSecondaryDisplay().bounds().Contains( 850 EXPECT_TRUE(display_manager()->GetSecondaryDisplay().bounds().Contains(
870 w1->GetBoundsInScreen())); 851 w1->GetBoundsInScreen()));
871 } 852 }
872 853
873 // Showing the resize shadows when the mouse is over the window edges is tested 854 // Showing the resize shadows when the mouse is over the window edges is tested
874 // in resize_shadow_and_cursor_test.cc 855 // in resize_shadow_and_cursor_test.cc
875 856
876 } // namespace test 857 } // namespace test
877 } // namespace ash 858 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/system_gesture_event_filter.cc ('k') | ash/wm/window_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698