| OLD | NEW |
| 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/display/display_manager.h" | 7 #include "ash/display/display_manager.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/env.h" | 11 #include "ui/aura/env.h" |
| 12 #include "ui/aura/test/aura_test_utils.h" | 12 #include "ui/aura/test/aura_test_utils.h" |
| 13 #include "ui/aura/window_tree_host.h" | 13 #include "ui/aura/window_tree_host.h" |
| 14 #include "ui/base/ime/input_method.h" | 14 #include "ui/base/ime/input_method.h" |
| 15 #include "ui/chromeos/accessibility_types.h" | 15 #include "ui/chromeos/accessibility_types.h" |
| 16 #include "ui/display/screen.h" |
| 16 #include "ui/events/test/event_generator.h" | 17 #include "ui/events/test/event_generator.h" |
| 17 #include "ui/gfx/geometry/rect_conversions.h" | 18 #include "ui/gfx/geometry/rect_conversions.h" |
| 18 #include "ui/gfx/screen.h" | |
| 19 #include "ui/views/controls/textfield/textfield.h" | 19 #include "ui/views/controls/textfield/textfield.h" |
| 20 #include "ui/views/layout/fill_layout.h" | 20 #include "ui/views/layout/fill_layout.h" |
| 21 #include "ui/views/widget/widget.h" | 21 #include "ui/views/widget/widget.h" |
| 22 #include "ui/views/widget/widget_delegate.h" | 22 #include "ui/views/widget/widget_delegate.h" |
| 23 #include "ui/wm/core/coordinate_conversion.h" | 23 #include "ui/wm/core/coordinate_conversion.h" |
| 24 | 24 |
| 25 namespace ash { | 25 namespace ash { |
| 26 namespace { | 26 namespace { |
| 27 | 27 |
| 28 const int kRootHeight = 600; | 28 const int kRootHeight = 600; |
| (...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 688 // Make sure that unified desktop can enter magnified mode. | 688 // Make sure that unified desktop can enter magnified mode. |
| 689 TEST_F(MagnificationControllerTest, EnableMagnifierInUnifiedDesktop) { | 689 TEST_F(MagnificationControllerTest, EnableMagnifierInUnifiedDesktop) { |
| 690 if (!SupportsMultipleDisplays()) | 690 if (!SupportsMultipleDisplays()) |
| 691 return; | 691 return; |
| 692 Shell::GetInstance()->display_manager()->SetUnifiedDesktopEnabled(true); | 692 Shell::GetInstance()->display_manager()->SetUnifiedDesktopEnabled(true); |
| 693 | 693 |
| 694 EXPECT_EQ(1.0f, GetMagnificationController()->GetScale()); | 694 EXPECT_EQ(1.0f, GetMagnificationController()->GetScale()); |
| 695 | 695 |
| 696 GetMagnificationController()->SetEnabled(true); | 696 GetMagnificationController()->SetEnabled(true); |
| 697 | 697 |
| 698 gfx::Screen* screen = gfx::Screen::GetScreen(); | 698 display::Screen* screen = display::Screen::GetScreen(); |
| 699 | 699 |
| 700 UpdateDisplay("500x500, 500x500"); | 700 UpdateDisplay("500x500, 500x500"); |
| 701 EXPECT_EQ("0,0 1000x500", screen->GetPrimaryDisplay().bounds().ToString()); | 701 EXPECT_EQ("0,0 1000x500", screen->GetPrimaryDisplay().bounds().ToString()); |
| 702 EXPECT_EQ(2.0f, GetMagnificationController()->GetScale()); | 702 EXPECT_EQ(2.0f, GetMagnificationController()->GetScale()); |
| 703 | 703 |
| 704 GetMagnificationController()->SetEnabled(false); | 704 GetMagnificationController()->SetEnabled(false); |
| 705 | 705 |
| 706 EXPECT_EQ(1.0f, GetMagnificationController()->GetScale()); | 706 EXPECT_EQ(1.0f, GetMagnificationController()->GetScale()); |
| 707 | 707 |
| 708 GetMagnificationController()->SetEnabled(true); | 708 GetMagnificationController()->SetEnabled(true); |
| 709 EXPECT_EQ(2.0f, GetMagnificationController()->GetScale()); | 709 EXPECT_EQ(2.0f, GetMagnificationController()->GetScale()); |
| 710 | 710 |
| 711 UpdateDisplay("500x500"); | 711 UpdateDisplay("500x500"); |
| 712 EXPECT_EQ("0,0 500x500", screen->GetPrimaryDisplay().bounds().ToString()); | 712 EXPECT_EQ("0,0 500x500", screen->GetPrimaryDisplay().bounds().ToString()); |
| 713 EXPECT_EQ(2.0f, GetMagnificationController()->GetScale()); | 713 EXPECT_EQ(2.0f, GetMagnificationController()->GetScale()); |
| 714 | 714 |
| 715 GetMagnificationController()->SetEnabled(false); | 715 GetMagnificationController()->SetEnabled(false); |
| 716 EXPECT_EQ("0,0 500x500", screen->GetPrimaryDisplay().bounds().ToString()); | 716 EXPECT_EQ("0,0 500x500", screen->GetPrimaryDisplay().bounds().ToString()); |
| 717 EXPECT_EQ(1.0f, GetMagnificationController()->GetScale()); | 717 EXPECT_EQ(1.0f, GetMagnificationController()->GetScale()); |
| 718 } | 718 } |
| 719 | 719 |
| 720 } // namespace ash | 720 } // namespace ash |
| OLD | NEW |