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 "ash/test/display_manager_test_api.h" |
10 #include "base/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
11 #include "ui/aura/client/aura_constants.h" | 12 #include "ui/aura/client/aura_constants.h" |
12 #include "ui/aura/env.h" | 13 #include "ui/aura/env.h" |
13 #include "ui/aura/test/aura_test_utils.h" | 14 #include "ui/aura/test/aura_test_utils.h" |
14 #include "ui/aura/window_tree_host.h" | 15 #include "ui/aura/window_tree_host.h" |
15 #include "ui/base/ime/input_method.h" | 16 #include "ui/base/ime/input_method.h" |
16 #include "ui/chromeos/accessibility_types.h" | 17 #include "ui/chromeos/accessibility_types.h" |
17 #include "ui/events/test/event_generator.h" | 18 #include "ui/events/test/event_generator.h" |
18 #include "ui/gfx/geometry/rect_conversions.h" | 19 #include "ui/gfx/geometry/rect_conversions.h" |
19 #include "ui/gfx/screen.h" | 20 #include "ui/gfx/screen.h" |
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
580 gfx::Rect new_view_port = GetViewport(); | 581 gfx::Rect new_view_port = GetViewport(); |
581 EXPECT_TRUE(new_view_port.Contains(caret_bounds)); | 582 EXPECT_TRUE(new_view_port.Contains(caret_bounds)); |
582 EXPECT_EQ(caret_bounds.x(), new_view_port.CenterPoint().x()); | 583 EXPECT_EQ(caret_bounds.x(), new_view_port.CenterPoint().x()); |
583 EXPECT_EQ(view_port.y(), new_view_port.y()); | 584 EXPECT_EQ(view_port.y(), new_view_port.y()); |
584 } | 585 } |
585 | 586 |
586 // Make sure that unified desktop can enter magnified mode. | 587 // Make sure that unified desktop can enter magnified mode. |
587 TEST_F(MagnificationControllerTest, EnableMagnifierInUnifiedDesktop) { | 588 TEST_F(MagnificationControllerTest, EnableMagnifierInUnifiedDesktop) { |
588 if (!SupportsMultipleDisplays()) | 589 if (!SupportsMultipleDisplays()) |
589 return; | 590 return; |
| 591 test::DisplayManagerTestApi::EnableUnifiedDesktopForTest(); |
590 | 592 |
591 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); | 593 DisplayManager* display_manager = Shell::GetInstance()->display_manager(); |
592 display_manager->SetDefaultMultiDisplayMode(DisplayManager::UNIFIED); | 594 display_manager->SetDefaultMultiDisplayMode(DisplayManager::UNIFIED); |
593 display_manager->SetMultiDisplayMode(DisplayManager::UNIFIED); | 595 display_manager->SetMultiDisplayMode(DisplayManager::UNIFIED); |
594 | 596 |
595 EXPECT_EQ(1.0f, GetMagnificationController()->GetScale()); | 597 EXPECT_EQ(1.0f, GetMagnificationController()->GetScale()); |
596 | 598 |
597 GetMagnificationController()->SetEnabled(true); | 599 GetMagnificationController()->SetEnabled(true); |
598 | 600 |
599 gfx::Screen* screen = | 601 gfx::Screen* screen = |
(...skipping 13 matching lines...) Expand all Loading... |
613 UpdateDisplay("500x500"); | 615 UpdateDisplay("500x500"); |
614 EXPECT_EQ("0,0 500x500", screen->GetPrimaryDisplay().bounds().ToString()); | 616 EXPECT_EQ("0,0 500x500", screen->GetPrimaryDisplay().bounds().ToString()); |
615 EXPECT_EQ(2.0f, GetMagnificationController()->GetScale()); | 617 EXPECT_EQ(2.0f, GetMagnificationController()->GetScale()); |
616 | 618 |
617 GetMagnificationController()->SetEnabled(false); | 619 GetMagnificationController()->SetEnabled(false); |
618 EXPECT_EQ("0,0 500x500", screen->GetPrimaryDisplay().bounds().ToString()); | 620 EXPECT_EQ("0,0 500x500", screen->GetPrimaryDisplay().bounds().ToString()); |
619 EXPECT_EQ(1.0f, GetMagnificationController()->GetScale()); | 621 EXPECT_EQ(1.0f, GetMagnificationController()->GetScale()); |
620 } | 622 } |
621 | 623 |
622 } // namespace ash | 624 } // namespace ash |
OLD | NEW |