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

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

Issue 2525113002: Rename WindowTreeHost functions to indicate pixels/dips. (Closed)
Patch Set: win Created 4 years 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/screen_position_controller.cc ('k') | ash/display/window_tree_host_manager.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_util.h" 7 #include "ash/display/display_util.h"
8 #include "ash/display/mirror_window_controller.h" 8 #include "ash/display/mirror_window_controller.h"
9 #include "ash/display/mouse_cursor_event_filter.h" 9 #include "ash/display/mouse_cursor_event_filter.h"
10 #include "ash/host/ash_window_tree_host.h" 10 #include "ash/host/ash_window_tree_host.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 const gfx::Point& origin = info.bounds_in_native().origin(); 46 const gfx::Point& origin = info.bounds_in_native().origin();
47 // Convert to mirroring host. 47 // Convert to mirroring host.
48 point_in_unified_host->Offset(-origin.x(), -origin.y()); 48 point_in_unified_host->Offset(-origin.x(), -origin.y());
49 *point_in_mirroring_host = *point_in_unified_host; 49 *point_in_mirroring_host = *point_in_unified_host;
50 // Convert from mirroring host to unified host. 50 // Convert from mirroring host to unified host.
51 AshWindowTreeHost* ash_host = 51 AshWindowTreeHost* ash_host =
52 Shell::GetInstance() 52 Shell::GetInstance()
53 ->window_tree_host_manager() 53 ->window_tree_host_manager()
54 ->mirror_window_controller() 54 ->mirror_window_controller()
55 ->GetAshWindowTreeHostForDisplayId(info.id()); 55 ->GetAshWindowTreeHostForDisplayId(info.id());
56 ash_host->AsWindowTreeHost()->ConvertPointFromHost( 56 ash_host->AsWindowTreeHost()->ConvertPixelsToDIP(point_in_unified_host);
57 point_in_unified_host);
58 return true; 57 return true;
59 } 58 }
60 } 59 }
61 return false; 60 return false;
62 } 61 }
63 62
64 bool TestIfMouseWarpsAt(const gfx::Point& point_in_native) { 63 bool TestIfMouseWarpsAt(const gfx::Point& point_in_native) {
65 static_cast<UnifiedMouseWarpController*>( 64 static_cast<UnifiedMouseWarpController*>(
66 Shell::GetInstance() 65 Shell::GetInstance()
67 ->mouse_cursor_filter() 66 ->mouse_cursor_filter()
(...skipping 12 matching lines...) Expand all
80 GetEventGenerator().MoveMouseToWithNative(point_in_unified_host, 79 GetEventGenerator().MoveMouseToWithNative(point_in_unified_host,
81 point_in_mirroring_host); 80 point_in_mirroring_host);
82 #else 81 #else
83 GetEventGenerator().MoveMouseToWithNative(point_in_unified_host, 82 GetEventGenerator().MoveMouseToWithNative(point_in_unified_host,
84 point_in_native); 83 point_in_native);
85 #endif 84 #endif
86 aura::Window* root = Shell::GetPrimaryRootWindow(); 85 aura::Window* root = Shell::GetPrimaryRootWindow();
87 gfx::Point new_location_in_unified_host = 86 gfx::Point new_location_in_unified_host =
88 aura::Env::GetInstance()->last_mouse_location(); 87 aura::Env::GetInstance()->last_mouse_location();
89 // Convert screen to the host. 88 // Convert screen to the host.
90 root->GetHost()->ConvertPointToHost(&new_location_in_unified_host); 89 root->GetHost()->ConvertDIPToPixels(&new_location_in_unified_host);
91 90
92 int new_index = display::FindDisplayIndexContainingPoint( 91 int new_index = display::FindDisplayIndexContainingPoint(
93 display_manager()->software_mirroring_display_list(), 92 display_manager()->software_mirroring_display_list(),
94 new_location_in_unified_host); 93 new_location_in_unified_host);
95 if (new_index < 0) 94 if (new_index < 0)
96 return false; 95 return false;
97 return orig_mirroring_display_id != 96 return orig_mirroring_display_id !=
98 display_manager()->software_mirroring_display_list()[new_index].id(); 97 display_manager()->software_mirroring_display_list()[new_index].id();
99 } 98 }
100 99
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 EXPECT_TRUE(TestIfMouseWarpsAt(gfx::Point(600, 10))); 252 EXPECT_TRUE(TestIfMouseWarpsAt(gfx::Point(600, 10)));
254 EXPECT_EQ("249,5", // moved to 498 by 2px, divided by 2 (dsf). 253 EXPECT_EQ("249,5", // moved to 498 by 2px, divided by 2 (dsf).
255 aura::Env::GetInstance()->last_mouse_location().ToString()); 254 aura::Env::GetInstance()->last_mouse_location().ToString());
256 { 255 {
257 SCOPED_TRACE("1x2 NO WARP"); 256 SCOPED_TRACE("1x2 NO WARP");
258 NoWarpTestBody(); 257 NoWarpTestBody();
259 } 258 }
260 } 259 }
261 260
262 } // namespace aura 261 } // namespace aura
OLDNEW
« no previous file with comments | « ash/display/screen_position_controller.cc ('k') | ash/display/window_tree_host_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698