| 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 "chrome/browser/chromeos/accessibility/magnification_manager.h" | 5 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" |
| 6 | 6 |
| 7 #include "ash/magnifier/magnifier_constants.h" | 7 #include "ash/magnifier/magnifier_constants.h" |
| 8 #include "ash/test/ash_test_base.h" | 8 #include "ash/test/ash_test_base.h" |
| 9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "chrome/common/pref_names.h" | 10 #include "chrome/common/pref_names.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 return MagnificationManager::Get()->SetMagnifierType(type); | 34 return MagnificationManager::Get()->SetMagnifierType(type); |
| 35 } | 35 } |
| 36 | 36 |
| 37 } // namespace | 37 } // namespace |
| 38 | 38 |
| 39 class MagnificationManagerTest : public ash::test::AshTestBase { | 39 class MagnificationManagerTest : public ash::test::AshTestBase { |
| 40 public: | 40 public: |
| 41 MagnificationManagerTest() { | 41 MagnificationManagerTest() { |
| 42 } | 42 } |
| 43 | 43 |
| 44 virtual void SetUp() OVERRIDE { | 44 virtual void SetUp() override { |
| 45 ash::test::AshTestBase::SetUp(); | 45 ash::test::AshTestBase::SetUp(); |
| 46 MagnificationManager::Initialize(); | 46 MagnificationManager::Initialize(); |
| 47 ASSERT_TRUE(MagnificationManager::Get()); | 47 ASSERT_TRUE(MagnificationManager::Get()); |
| 48 MagnificationManager::Get()->SetProfileForTest(&profile_); | 48 MagnificationManager::Get()->SetProfileForTest(&profile_); |
| 49 } | 49 } |
| 50 | 50 |
| 51 virtual void TearDown() OVERRIDE { | 51 virtual void TearDown() override { |
| 52 MagnificationManager::Shutdown(); | 52 MagnificationManager::Shutdown(); |
| 53 ash::test::AshTestBase::TearDown(); | 53 ash::test::AshTestBase::TearDown(); |
| 54 } | 54 } |
| 55 | 55 |
| 56 TestingProfile profile_; | 56 TestingProfile profile_; |
| 57 }; | 57 }; |
| 58 | 58 |
| 59 TEST_F(MagnificationManagerTest, ChangeType) { | 59 TEST_F(MagnificationManagerTest, ChangeType) { |
| 60 // Set full screen magnifier, and confirm the status is set successfully. | 60 // Set full screen magnifier, and confirm the status is set successfully. |
| 61 EnableMagnifier(); | 61 EnableMagnifier(); |
| 62 SetMagnifierType(ash::MAGNIFIER_FULL); | 62 SetMagnifierType(ash::MAGNIFIER_FULL); |
| 63 EXPECT_TRUE(IsMagnifierEnabled()); | 63 EXPECT_TRUE(IsMagnifierEnabled()); |
| 64 EXPECT_EQ(GetMagnifierType(), ash::MAGNIFIER_FULL); | 64 EXPECT_EQ(GetMagnifierType(), ash::MAGNIFIER_FULL); |
| 65 | 65 |
| 66 // Set partial screen magnifier, and confirm the change is ignored. | 66 // Set partial screen magnifier, and confirm the change is ignored. |
| 67 SetMagnifierType(ash::MAGNIFIER_PARTIAL); | 67 SetMagnifierType(ash::MAGNIFIER_PARTIAL); |
| 68 EXPECT_TRUE(IsMagnifierEnabled()); | 68 EXPECT_TRUE(IsMagnifierEnabled()); |
| 69 EXPECT_EQ(GetMagnifierType(), ash::MAGNIFIER_FULL); | 69 EXPECT_EQ(GetMagnifierType(), ash::MAGNIFIER_FULL); |
| 70 | 70 |
| 71 // Disables magnifier, and confirm the status is set successfully. | 71 // Disables magnifier, and confirm the status is set successfully. |
| 72 DisableMagnifier(); | 72 DisableMagnifier(); |
| 73 EXPECT_FALSE(IsMagnifierEnabled()); | 73 EXPECT_FALSE(IsMagnifierEnabled()); |
| 74 EXPECT_EQ(GetMagnifierType(), ash::MAGNIFIER_FULL); | 74 EXPECT_EQ(GetMagnifierType(), ash::MAGNIFIER_FULL); |
| 75 } | 75 } |
| 76 | 76 |
| 77 } // namespace chromeos | 77 } // namespace chromeos |
| OLD | NEW |