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

Side by Side Diff: ash/drag_drop/drag_drop_tracker_unittest.cc

Issue 2653593004: chromeos: Remove AshTestBase::SupportsMultipleDisplays (Closed)
Patch Set: 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/drag_drop/drag_drop_interactive_uitest.cc ('k') | ash/extended_desktop_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/drag_drop/drag_drop_tracker.h" 5 #include "ash/drag_drop/drag_drop_tracker.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "ash/common/scoped_root_window_for_new_windows.h" 9 #include "ash/common/scoped_root_window_for_new_windows.h"
10 #include "ash/common/wm_shell.h" 10 #include "ash/common/wm_shell.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 static ui::LocatedEvent* ConvertEvent(aura::Window* target, 43 static ui::LocatedEvent* ConvertEvent(aura::Window* target,
44 const ui::MouseEvent& event) { 44 const ui::MouseEvent& event) {
45 std::unique_ptr<DragDropTracker> tracker( 45 std::unique_ptr<DragDropTracker> tracker(
46 new DragDropTracker(Shell::GetPrimaryRootWindow(), NULL)); 46 new DragDropTracker(Shell::GetPrimaryRootWindow(), NULL));
47 ui::LocatedEvent* converted = tracker->ConvertEvent(target, event); 47 ui::LocatedEvent* converted = tracker->ConvertEvent(target, event);
48 return converted; 48 return converted;
49 } 49 }
50 }; 50 };
51 51
52 TEST_F(DragDropTrackerTest, GetTarget) { 52 TEST_F(DragDropTrackerTest, GetTarget) {
53 if (!SupportsMultipleDisplays())
54 return;
55
56 UpdateDisplay("200x200,300x300"); 53 UpdateDisplay("200x200,300x300");
57 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); 54 aura::Window::Windows root_windows = Shell::GetAllRootWindows();
58 EXPECT_EQ(2U, root_windows.size()); 55 EXPECT_EQ(2U, root_windows.size());
59 56
60 std::unique_ptr<aura::Window> window0( 57 std::unique_ptr<aura::Window> window0(
61 CreateTestWindow(gfx::Rect(0, 0, 100, 100))); 58 CreateTestWindow(gfx::Rect(0, 0, 100, 100)));
62 window0->Show(); 59 window0->Show();
63 60
64 std::unique_ptr<aura::Window> window1( 61 std::unique_ptr<aura::Window> window1(
65 CreateTestWindow(gfx::Rect(300, 100, 100, 100))); 62 CreateTestWindow(gfx::Rect(300, 100, 100, 100)));
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 // |window1| covers. 105 // |window1| covers.
109 EXPECT_EQ(window1.get(), GetTarget(gfx::Point(150, 150))); 106 EXPECT_EQ(window1.get(), GetTarget(gfx::Point(150, 150)));
110 107
111 // Start tracking from the RootWindow1 and check the point on RootWindow1 that 108 // Start tracking from the RootWindow1 and check the point on RootWindow1 that
112 // neither |window0| nor |window1| covers. 109 // neither |window0| nor |window1| covers.
113 EXPECT_NE(window0.get(), GetTarget(gfx::Point(50, 50))); 110 EXPECT_NE(window0.get(), GetTarget(gfx::Point(50, 50)));
114 EXPECT_NE(window1.get(), GetTarget(gfx::Point(50, 50))); 111 EXPECT_NE(window1.get(), GetTarget(gfx::Point(50, 50)));
115 } 112 }
116 113
117 TEST_F(DragDropTrackerTest, ConvertEvent) { 114 TEST_F(DragDropTrackerTest, ConvertEvent) {
118 if (!SupportsMultipleDisplays())
119 return;
120
121 UpdateDisplay("200x200,300x300"); 115 UpdateDisplay("200x200,300x300");
122 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); 116 aura::Window::Windows root_windows = Shell::GetAllRootWindows();
123 EXPECT_EQ(2U, root_windows.size()); 117 EXPECT_EQ(2U, root_windows.size());
124 118
125 std::unique_ptr<aura::Window> window0( 119 std::unique_ptr<aura::Window> window0(
126 CreateTestWindow(gfx::Rect(0, 0, 100, 100))); 120 CreateTestWindow(gfx::Rect(0, 0, 100, 100)));
127 window0->Show(); 121 window0->Show();
128 122
129 std::unique_ptr<aura::Window> window1( 123 std::unique_ptr<aura::Window> window1(
130 CreateTestWindow(gfx::Rect(300, 100, 100, 100))); 124 CreateTestWindow(gfx::Rect(300, 100, 100, 100)));
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 std::unique_ptr<ui::LocatedEvent> converted11( 176 std::unique_ptr<ui::LocatedEvent> converted11(
183 ConvertEvent(window1.get(), original11)); 177 ConvertEvent(window1.get(), original11));
184 EXPECT_EQ(original11.type(), converted11->type()); 178 EXPECT_EQ(original11.type(), converted11->type());
185 EXPECT_EQ("50,50", converted11->location().ToString()); 179 EXPECT_EQ("50,50", converted11->location().ToString());
186 EXPECT_EQ("150,150", converted11->root_location().ToString()); 180 EXPECT_EQ("150,150", converted11->root_location().ToString());
187 EXPECT_EQ(original11.flags(), converted11->flags()); 181 EXPECT_EQ(original11.flags(), converted11->flags());
188 } 182 }
189 183
190 } // namespace test 184 } // namespace test
191 } // namespace aura 185 } // namespace aura
OLDNEW
« no previous file with comments | « ash/drag_drop/drag_drop_interactive_uitest.cc ('k') | ash/extended_desktop_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698