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

Side by Side Diff: ash/display/cursor_window_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/cursor_window_controller.cc ('k') | ash/display/display_util.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/cursor_window_controller.h" 5 #include "ash/display/cursor_window_controller.h"
6 6
7 #include "ash/display/display_util.h" 7 #include "ash/display/display_util.h"
8 #include "ash/display/window_tree_host_manager.h" 8 #include "ash/display/window_tree_host_manager.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/test/ash_test_base.h" 10 #include "ash/test/ash_test_base.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 // WindowTreeHost::MoveCursorTo(). EventGenerator uses a hack to move the 95 // WindowTreeHost::MoveCursorTo(). EventGenerator uses a hack to move the
96 // cursor between displays. 96 // cursor between displays.
97 // Screen location: 220, 50 97 // Screen location: 220, 50
98 // Root location: 20, 50 98 // Root location: 20, 50
99 secondary_root->MoveCursorTo(gfx::Point(20, 50)); 99 secondary_root->MoveCursorTo(gfx::Point(20, 50));
100 100
101 // Chrome relies on WindowTreeHost::MoveCursorTo() dispatching a mouse move 101 // Chrome relies on WindowTreeHost::MoveCursorTo() dispatching a mouse move
102 // asynchronously. This is implemented in a platform specific way. Generate a 102 // asynchronously. This is implemented in a platform specific way. Generate a
103 // fake mouse move instead of waiting. 103 // fake mouse move instead of waiting.
104 gfx::Point new_cursor_position_in_host(20, 50); 104 gfx::Point new_cursor_position_in_host(20, 50);
105 secondary_root->GetHost()->ConvertPointToHost(&new_cursor_position_in_host); 105 secondary_root->GetHost()->ConvertDIPToPixels(&new_cursor_position_in_host);
106 ui::test::EventGenerator secondary_generator(secondary_root); 106 ui::test::EventGenerator secondary_generator(secondary_root);
107 secondary_generator.MoveMouseToInHost(new_cursor_position_in_host); 107 secondary_generator.MoveMouseToInHost(new_cursor_position_in_host);
108 108
109 EXPECT_TRUE(secondary_root->Contains(GetCursorWindow())); 109 EXPECT_TRUE(secondary_root->Contains(GetCursorWindow()));
110 EXPECT_EQ(secondary_display_id, GetCursorDisplayId()); 110 EXPECT_EQ(secondary_display_id, GetCursorDisplayId());
111 EXPECT_EQ(ui::kCursorNull, GetCursorType()); 111 EXPECT_EQ(ui::kCursorNull, GetCursorType());
112 hot_point = GetCursorHotPoint(); 112 hot_point = GetCursorHotPoint();
113 EXPECT_EQ("3,3", hot_point.ToString()); 113 EXPECT_EQ("3,3", hot_point.ToString());
114 cursor_bounds = GetCursorWindow()->GetBoundsInScreen(); 114 cursor_bounds = GetCursorWindow()->GetBoundsInScreen();
115 EXPECT_EQ(220, cursor_bounds.x() + hot_point.x()); 115 EXPECT_EQ(220, cursor_bounds.x() + hot_point.x());
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 ASSERT_TRUE(display::test::DisplayManagerTestApi(display_manager()) 167 ASSERT_TRUE(display::test::DisplayManagerTestApi(display_manager())
168 .SetDisplayUIScale(primary_id, 2.0f)); 168 .SetDisplayUIScale(primary_id, 2.0f));
169 ASSERT_EQ( 169 ASSERT_EQ(
170 1.0f, 170 1.0f,
171 display::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor()); 171 display::Screen::GetScreen()->GetPrimaryDisplay().device_scale_factor());
172 EXPECT_TRUE(GetCursorImage().HasRepresentation(2.0f)); 172 EXPECT_TRUE(GetCursorImage().HasRepresentation(2.0f));
173 } 173 }
174 #endif 174 #endif
175 175
176 } // namespace ash 176 } // namespace ash
OLDNEW
« no previous file with comments | « ash/display/cursor_window_controller.cc ('k') | ash/display/display_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698