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

Side by Side Diff: ash/magnifier/magnification_controller_unittest.cc

Issue 251743004: aura: Remove WindowTreeHost::QueryMouseLocation(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | ash/wm/ash_native_cursor_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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/magnifier/magnification_controller.h" 5 #include "ash/magnifier/magnification_controller.h"
6 6
7 #include "ash/magnifier/magnifier_constants.h" 7 #include "ash/magnifier/magnifier_constants.h"
8 #include "ash/shell.h" 8 #include "ash/shell.h"
9 #include "ash/test/ash_test_base.h" 9 #include "ash/test/ash_test_base.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
11 #include "ui/aura/client/aura_constants.h" 11 #include "ui/aura/client/aura_constants.h"
12 #include "ui/aura/env.h" 12 #include "ui/aura/env.h"
13 #include "ui/aura/test/aura_test_utils.h"
13 #include "ui/aura/test/event_generator.h" 14 #include "ui/aura/test/event_generator.h"
14 #include "ui/aura/window_tree_host.h" 15 #include "ui/aura/window_tree_host.h"
15 #include "ui/gfx/rect_conversions.h" 16 #include "ui/gfx/rect_conversions.h"
16 #include "ui/gfx/screen.h" 17 #include "ui/gfx/screen.h"
17 18
18 namespace ash { 19 namespace ash {
19 namespace { 20 namespace {
20 21
21 const int kRootHeight = 600; 22 const int kRootHeight = 600;
22 const int kRootWidth = 800; 23 const int kRootWidth = 800;
(...skipping 23 matching lines...) Expand all
46 virtual void TearDown() OVERRIDE { 47 virtual void TearDown() OVERRIDE {
47 AshTestBase::TearDown(); 48 AshTestBase::TearDown();
48 } 49 }
49 50
50 protected: 51 protected:
51 aura::Window* GetRootWindow() const { 52 aura::Window* GetRootWindow() const {
52 return Shell::GetPrimaryRootWindow(); 53 return Shell::GetPrimaryRootWindow();
53 } 54 }
54 55
55 std::string GetHostMouseLocation() { 56 std::string GetHostMouseLocation() {
56 gfx::Point point; 57 const gfx::Point& location =
57 GetRootWindow()->GetHost()->QueryMouseLocation(&point); 58 aura::test::QueryLatestMousePositionRequestInHost(
58 return point.ToString(); 59 GetRootWindow()->GetHost());
60 return location.ToString();
59 } 61 }
60 62
61 ash::MagnificationController* GetMagnificationController() const { 63 ash::MagnificationController* GetMagnificationController() const {
62 return ash::Shell::GetInstance()->magnification_controller(); 64 return ash::Shell::GetInstance()->magnification_controller();
63 } 65 }
64 66
65 gfx::Rect GetViewport() const { 67 gfx::Rect GetViewport() const {
66 gfx::RectF bounds(0, 0, kRootWidth, kRootHeight); 68 gfx::RectF bounds(0, 0, kRootWidth, kRootHeight);
67 GetRootWindow()->layer()->transform().TransformRectReverse(&bounds); 69 GetRootWindow()->layer()->transform().TransformRectReverse(&bounds);
68 return gfx::ToEnclosingRect(bounds); 70 return gfx::ToEnclosingRect(bounds);
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 434
433 scale *= kMagnificationScaleFactor; 435 scale *= kMagnificationScaleFactor;
434 GetMagnificationController()->SetScale(scale, false); 436 GetMagnificationController()->SetScale(scale, false);
435 EXPECT_FLOAT_EQ(4.f, GetMagnificationController()->GetScale()); 437 EXPECT_FLOAT_EQ(4.f, GetMagnificationController()->GetScale());
436 generator.MoveMouseToInHost(gfx::Point(0, 300)); 438 generator.MoveMouseToInHost(gfx::Point(0, 300));
437 EXPECT_EQ("139,298", env->last_mouse_location().ToString()); 439 EXPECT_EQ("139,298", env->last_mouse_location().ToString());
438 EXPECT_EQ("100,300", GetHostMouseLocation()); 440 EXPECT_EQ("100,300", GetHostMouseLocation());
439 } 441 }
440 442
441 } // namespace ash 443 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/wm/ash_native_cursor_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698