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

Side by Side Diff: ash/display/unified_mouse_warp_controller_unittest.cc

Issue 2286523002: Relocate reuseable portions of ash/display/display_util.* (Closed)
Patch Set: fixed ozone build Created 4 years, 3 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/display/unified_mouse_warp_controller.cc ('k') | ash/test/display_manager_test_api.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/display/unified_mouse_warp_controller.h" 5 #include "ash/display/unified_mouse_warp_controller.h"
6 6
7 #include "ash/display/display_manager.h" 7 #include "ash/display/display_manager.h"
8 #include "ash/display/display_util.h" 8 #include "ash/display/display_util.h"
9 #include "ash/display/mirror_window_controller.h" 9 #include "ash/display/mirror_window_controller.h"
10 #include "ash/display/mouse_cursor_event_filter.h" 10 #include "ash/display/mouse_cursor_event_filter.h"
11 #include "ash/host/ash_window_tree_host.h" 11 #include "ash/host/ash_window_tree_host.h"
12 #include "ash/shell.h" 12 #include "ash/shell.h"
13 #include "ash/test/ash_test_base.h" 13 #include "ash/test/ash_test_base.h"
14 #include "ash/test/display_manager_test_api.h" 14 #include "ash/test/display_manager_test_api.h"
15 #include "ui/aura/env.h" 15 #include "ui/aura/env.h"
16 #include "ui/aura/window_tree_host.h" 16 #include "ui/aura/window_tree_host.h"
17 #include "ui/display/display.h" 17 #include "ui/display/display.h"
18 #include "ui/display/manager/display_manager_utilities.h"
18 #include "ui/display/screen.h" 19 #include "ui/display/screen.h"
19 #include "ui/events/test/event_generator.h" 20 #include "ui/events/test/event_generator.h"
20 #include "ui/wm/core/coordinate_conversion.h" 21 #include "ui/wm/core/coordinate_conversion.h"
21 22
22 namespace ash { 23 namespace ash {
23 24
24 class UnifiedMouseWarpControllerTest : public test::AshTestBase { 25 class UnifiedMouseWarpControllerTest : public test::AshTestBase {
25 public: 26 public:
26 UnifiedMouseWarpControllerTest() {} 27 UnifiedMouseWarpControllerTest() {}
27 ~UnifiedMouseWarpControllerTest() override {} 28 ~UnifiedMouseWarpControllerTest() override {}
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 #else 85 #else
85 GetEventGenerator().MoveMouseToWithNative(point_in_unified_host, 86 GetEventGenerator().MoveMouseToWithNative(point_in_unified_host,
86 point_in_native); 87 point_in_native);
87 #endif 88 #endif
88 aura::Window* root = Shell::GetPrimaryRootWindow(); 89 aura::Window* root = Shell::GetPrimaryRootWindow();
89 gfx::Point new_location_in_unified_host = 90 gfx::Point new_location_in_unified_host =
90 aura::Env::GetInstance()->last_mouse_location(); 91 aura::Env::GetInstance()->last_mouse_location();
91 // Convert screen to the host. 92 // Convert screen to the host.
92 root->GetHost()->ConvertPointToHost(&new_location_in_unified_host); 93 root->GetHost()->ConvertPointToHost(&new_location_in_unified_host);
93 94
94 int new_index = FindDisplayIndexContainingPoint( 95 int new_index = display::FindDisplayIndexContainingPoint(
95 display_manager->software_mirroring_display_list(), 96 display_manager->software_mirroring_display_list(),
96 new_location_in_unified_host); 97 new_location_in_unified_host);
97 if (new_index < 0) 98 if (new_index < 0)
98 return false; 99 return false;
99 return orig_mirroring_display_id != 100 return orig_mirroring_display_id !=
100 display_manager->software_mirroring_display_list()[new_index].id(); 101 display_manager->software_mirroring_display_list()[new_index].id();
101 } 102 }
102 103
103 MouseCursorEventFilter* event_filter() { 104 MouseCursorEventFilter* event_filter() {
104 return Shell::GetInstance()->mouse_cursor_filter(); 105 return Shell::GetInstance()->mouse_cursor_filter();
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 EXPECT_TRUE(TestIfMouseWarpsAt(gfx::Point(600, 10))); 256 EXPECT_TRUE(TestIfMouseWarpsAt(gfx::Point(600, 10)));
256 EXPECT_EQ("249,5", // moved to 498 by 2px, divided by 2 (dsf). 257 EXPECT_EQ("249,5", // moved to 498 by 2px, divided by 2 (dsf).
257 aura::Env::GetInstance()->last_mouse_location().ToString()); 258 aura::Env::GetInstance()->last_mouse_location().ToString());
258 { 259 {
259 SCOPED_TRACE("1x2 NO WARP"); 260 SCOPED_TRACE("1x2 NO WARP");
260 NoWarpTestBody(); 261 NoWarpTestBody();
261 } 262 }
262 } 263 }
263 264
264 } // namespace aura 265 } // namespace aura
OLDNEW
« no previous file with comments | « ash/display/unified_mouse_warp_controller.cc ('k') | ash/test/display_manager_test_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698