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

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

Issue 37733003: Make GetRootWindow() return a Window instead of a RootWindow. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 1 month 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
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 #include "ash/magnifier/magnifier_constants.h" 6 #include "ash/magnifier/magnifier_constants.h"
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/test/ash_test_base.h" 8 #include "ash/test/ash_test_base.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "ui/aura/client/aura_constants.h" 10 #include "ui/aura/client/aura_constants.h"
(...skipping 14 matching lines...) Expand all
25 25
26 class MagnificationControllerTest: public test::AshTestBase { 26 class MagnificationControllerTest: public test::AshTestBase {
27 public: 27 public:
28 MagnificationControllerTest() {} 28 MagnificationControllerTest() {}
29 virtual ~MagnificationControllerTest() {} 29 virtual ~MagnificationControllerTest() {}
30 30
31 virtual void SetUp() OVERRIDE { 31 virtual void SetUp() OVERRIDE {
32 AshTestBase::SetUp(); 32 AshTestBase::SetUp();
33 UpdateDisplay(base::StringPrintf("%dx%d", kRootWidth, kRootHeight)); 33 UpdateDisplay(base::StringPrintf("%dx%d", kRootWidth, kRootHeight));
34 34
35 aura::RootWindow* root = GetRootWindow(); 35 aura::Window* root = GetRootWindow();
36 gfx::Rect root_bounds(root->bounds()); 36 gfx::Rect root_bounds(root->bounds());
37 37
38 #if defined(OS_WIN) 38 #if defined(OS_WIN)
39 // RootWindow and Display can't resize on Windows Ash. 39 // RootWindow and Display can't resize on Windows Ash.
40 // http://crbug.com/165962 40 // http://crbug.com/165962
41 EXPECT_EQ(kRootHeight, root_bounds.height()); 41 EXPECT_EQ(kRootHeight, root_bounds.height());
42 EXPECT_EQ(kRootWidth, root_bounds.width()); 42 EXPECT_EQ(kRootWidth, root_bounds.width());
43 #endif 43 #endif
44 } 44 }
45 45
46 virtual void TearDown() OVERRIDE { 46 virtual void TearDown() OVERRIDE {
47 AshTestBase::TearDown(); 47 AshTestBase::TearDown();
48 } 48 }
49 49
50 protected: 50 protected:
51 aura::RootWindow* GetRootWindow() const { 51 aura::Window* GetRootWindow() const {
52 return Shell::GetPrimaryRootWindow(); 52 return Shell::GetPrimaryRootWindow();
53 } 53 }
54 54
55 std::string GetHostMouseLocation() { 55 std::string GetHostMouseLocation() {
56 gfx::Point point; 56 gfx::Point point;
57 GetRootWindow()->QueryMouseLocationForTest(&point); 57 GetRootWindow()->GetDispatcher()->QueryMouseLocationForTest(&point);
58 return point.ToString(); 58 return point.ToString();
59 } 59 }
60 60
61 ash::MagnificationController* GetMagnificationController() const { 61 ash::MagnificationController* GetMagnificationController() const {
62 return ash::Shell::GetInstance()->magnification_controller(); 62 return ash::Shell::GetInstance()->magnification_controller();
63 } 63 }
64 64
65 gfx::Rect GetViewport() const { 65 gfx::Rect GetViewport() const {
66 gfx::RectF bounds(0, 0, kRootWidth, kRootHeight); 66 gfx::RectF bounds(0, 0, kRootWidth, kRootHeight);
67 GetRootWindow()->layer()->transform().TransformRectReverse(&bounds); 67 GetRootWindow()->layer()->transform().TransformRectReverse(&bounds);
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 scale *= kMagnificationScaleFactor; 433 scale *= kMagnificationScaleFactor;
434 GetMagnificationController()->SetScale(scale, false); 434 GetMagnificationController()->SetScale(scale, false);
435 EXPECT_FLOAT_EQ(4.f, GetMagnificationController()->GetScale()); 435 EXPECT_FLOAT_EQ(4.f, GetMagnificationController()->GetScale());
436 generator.MoveMouseToInHost(gfx::Point(0, 300)); 436 generator.MoveMouseToInHost(gfx::Point(0, 300));
437 EXPECT_EQ("139,298", env->last_mouse_location().ToString()); 437 EXPECT_EQ("139,298", env->last_mouse_location().ToString());
438 EXPECT_EQ("100,300", GetHostMouseLocation()); 438 EXPECT_EQ("100,300", GetHostMouseLocation());
439 } 439 }
440 440
441 } // namespace internal 441 } // namespace internal
442 } // namespace ash 442 } // namespace ash
OLDNEW
« no previous file with comments | « ash/magnifier/magnification_controller.cc ('k') | ash/magnifier/partial_magnification_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698