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/shell.h" | 8 #include "ash/shell.h" |
8 #include "ash/test/ash_test_base.h" | 9 #include "ash/test/ash_test_base.h" |
9 #include "ash/test/display_manager_test_api.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/events/test/event_generator.h" | 16 #include "ui/events/test/event_generator.h" |
17 #include "ui/gfx/geometry/rect_conversions.h" | 17 #include "ui/gfx/geometry/rect_conversions.h" |
18 #include "ui/gfx/screen.h" | 18 #include "ui/gfx/screen.h" |
19 #include "ui/views/controls/textfield/textfield.h" | 19 #include "ui/views/controls/textfield/textfield.h" |
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
663 EXPECT_TRUE(new_view_port.Contains(text_input_bounds)); | 663 EXPECT_TRUE(new_view_port.Contains(text_input_bounds)); |
664 gfx::Rect caret_bounds = GetCaretBounds(); | 664 gfx::Rect caret_bounds = GetCaretBounds(); |
665 EXPECT_EQ(caret_bounds.CenterPoint(), new_view_port.CenterPoint()); | 665 EXPECT_EQ(caret_bounds.CenterPoint(), new_view_port.CenterPoint()); |
666 } | 666 } |
667 | 667 |
668 | 668 |
669 // Make sure that unified desktop can enter magnified mode. | 669 // Make sure that unified desktop can enter magnified mode. |
670 TEST_F(MagnificationControllerTest, EnableMagnifierInUnifiedDesktop) { | 670 TEST_F(MagnificationControllerTest, EnableMagnifierInUnifiedDesktop) { |
671 if (!SupportsMultipleDisplays()) | 671 if (!SupportsMultipleDisplays()) |
672 return; | 672 return; |
673 test::DisplayManagerTestApi::EnableUnifiedDesktopForTest(); | 673 Shell::GetInstance()->display_manager()->SetUnifiedDesktopEnabled(true); |
674 | 674 |
675 EXPECT_EQ(1.0f, GetMagnificationController()->GetScale()); | 675 EXPECT_EQ(1.0f, GetMagnificationController()->GetScale()); |
676 | 676 |
677 GetMagnificationController()->SetEnabled(true); | 677 GetMagnificationController()->SetEnabled(true); |
678 | 678 |
679 gfx::Screen* screen = | 679 gfx::Screen* screen = |
680 gfx::Screen::GetScreenFor(Shell::GetPrimaryRootWindow()); | 680 gfx::Screen::GetScreenFor(Shell::GetPrimaryRootWindow()); |
681 | 681 |
682 UpdateDisplay("500x500, 500x500"); | 682 UpdateDisplay("500x500, 500x500"); |
683 EXPECT_EQ("0,0 1000x500", screen->GetPrimaryDisplay().bounds().ToString()); | 683 EXPECT_EQ("0,0 1000x500", screen->GetPrimaryDisplay().bounds().ToString()); |
684 EXPECT_EQ(2.0f, GetMagnificationController()->GetScale()); | 684 EXPECT_EQ(2.0f, GetMagnificationController()->GetScale()); |
685 | 685 |
686 GetMagnificationController()->SetEnabled(false); | 686 GetMagnificationController()->SetEnabled(false); |
687 | 687 |
688 EXPECT_EQ(1.0f, GetMagnificationController()->GetScale()); | 688 EXPECT_EQ(1.0f, GetMagnificationController()->GetScale()); |
689 | 689 |
690 GetMagnificationController()->SetEnabled(true); | 690 GetMagnificationController()->SetEnabled(true); |
691 EXPECT_EQ(2.0f, GetMagnificationController()->GetScale()); | 691 EXPECT_EQ(2.0f, GetMagnificationController()->GetScale()); |
692 | 692 |
693 UpdateDisplay("500x500"); | 693 UpdateDisplay("500x500"); |
694 EXPECT_EQ("0,0 500x500", screen->GetPrimaryDisplay().bounds().ToString()); | 694 EXPECT_EQ("0,0 500x500", screen->GetPrimaryDisplay().bounds().ToString()); |
695 EXPECT_EQ(2.0f, GetMagnificationController()->GetScale()); | 695 EXPECT_EQ(2.0f, GetMagnificationController()->GetScale()); |
696 | 696 |
697 GetMagnificationController()->SetEnabled(false); | 697 GetMagnificationController()->SetEnabled(false); |
698 EXPECT_EQ("0,0 500x500", screen->GetPrimaryDisplay().bounds().ToString()); | 698 EXPECT_EQ("0,0 500x500", screen->GetPrimaryDisplay().bounds().ToString()); |
699 EXPECT_EQ(1.0f, GetMagnificationController()->GetScale()); | 699 EXPECT_EQ(1.0f, GetMagnificationController()->GetScale()); |
700 } | 700 } |
701 | 701 |
702 } // namespace ash | 702 } // namespace ash |
OLD | NEW |