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

Side by Side Diff: chrome/browser/chromeos/accessibility/magnification_manager_unittest.cc

Issue 2078393005: mash: Move accessibility_types.h from ui namespace to ash namespace (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@a11y
Patch Set: fix chromevox code generated from js Created 4 years, 6 months 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
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 "chrome/browser/chromeos/accessibility/magnification_manager.h" 5 #include "chrome/browser/chromeos/accessibility/magnification_manager.h"
6 6
7 #include "ash/common/accessibility_types.h" 7 #include "ash/common/accessibility_types.h"
8 #include "ash/test/ash_test_base.h" 8 #include "ash/test/ash_test_base.h"
9 #include "chrome/test/base/testing_profile.h" 9 #include "chrome/test/base/testing_profile.h"
10 #include "components/prefs/pref_service.h" 10 #include "components/prefs/pref_service.h"
11 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
12 12
13 namespace chromeos { 13 namespace chromeos {
14 namespace { 14 namespace {
15 15
16 void EnableMagnifier() { 16 void EnableMagnifier() {
17 return MagnificationManager::Get()->SetMagnifierEnabled(true); 17 return MagnificationManager::Get()->SetMagnifierEnabled(true);
18 } 18 }
19 19
20 void DisableMagnifier() { 20 void DisableMagnifier() {
21 return MagnificationManager::Get()->SetMagnifierEnabled(false); 21 return MagnificationManager::Get()->SetMagnifierEnabled(false);
22 } 22 }
23 23
24 bool IsMagnifierEnabled() { 24 bool IsMagnifierEnabled() {
25 return MagnificationManager::Get()->IsMagnifierEnabled(); 25 return MagnificationManager::Get()->IsMagnifierEnabled();
26 } 26 }
27 27
28 ui::MagnifierType GetMagnifierType() { 28 ash::MagnifierType GetMagnifierType() {
29 return MagnificationManager::Get()->GetMagnifierType(); 29 return MagnificationManager::Get()->GetMagnifierType();
30 } 30 }
31 31
32 void SetMagnifierType(ui::MagnifierType type) { 32 void SetMagnifierType(ash::MagnifierType type) {
33 return MagnificationManager::Get()->SetMagnifierType(type); 33 return MagnificationManager::Get()->SetMagnifierType(type);
34 } 34 }
35 35
36 } // namespace 36 } // namespace
37 37
38 class MagnificationManagerTest : public ash::test::AshTestBase { 38 class MagnificationManagerTest : public ash::test::AshTestBase {
39 public: 39 public:
40 MagnificationManagerTest() { 40 MagnificationManagerTest() {
41 } 41 }
42 42
43 void SetUp() override { 43 void SetUp() override {
44 ash::test::AshTestBase::SetUp(); 44 ash::test::AshTestBase::SetUp();
45 MagnificationManager::Initialize(); 45 MagnificationManager::Initialize();
46 ASSERT_TRUE(MagnificationManager::Get()); 46 ASSERT_TRUE(MagnificationManager::Get());
47 MagnificationManager::Get()->SetProfileForTest(&profile_); 47 MagnificationManager::Get()->SetProfileForTest(&profile_);
48 } 48 }
49 49
50 void TearDown() override { 50 void TearDown() override {
51 MagnificationManager::Shutdown(); 51 MagnificationManager::Shutdown();
52 ash::test::AshTestBase::TearDown(); 52 ash::test::AshTestBase::TearDown();
53 } 53 }
54 54
55 TestingProfile profile_; 55 TestingProfile profile_;
56 }; 56 };
57 57
58 TEST_F(MagnificationManagerTest, ChangeType) { 58 TEST_F(MagnificationManagerTest, ChangeType) {
59 // Set full screen magnifier, and confirm the status is set successfully. 59 // Set full screen magnifier, and confirm the status is set successfully.
60 EnableMagnifier(); 60 EnableMagnifier();
61 SetMagnifierType(ui::MAGNIFIER_FULL); 61 SetMagnifierType(ash::MAGNIFIER_FULL);
62 EXPECT_TRUE(IsMagnifierEnabled()); 62 EXPECT_TRUE(IsMagnifierEnabled());
63 EXPECT_EQ(GetMagnifierType(), ui::MAGNIFIER_FULL); 63 EXPECT_EQ(GetMagnifierType(), ash::MAGNIFIER_FULL);
64 64
65 // Set partial screen magnifier, and confirm the change is ignored. 65 // Set partial screen magnifier, and confirm the change is ignored.
66 SetMagnifierType(ui::MAGNIFIER_PARTIAL); 66 SetMagnifierType(ash::MAGNIFIER_PARTIAL);
67 EXPECT_TRUE(IsMagnifierEnabled()); 67 EXPECT_TRUE(IsMagnifierEnabled());
68 EXPECT_EQ(GetMagnifierType(), ui::MAGNIFIER_FULL); 68 EXPECT_EQ(GetMagnifierType(), ash::MAGNIFIER_FULL);
69 69
70 // Disables magnifier, and confirm the status is set successfully. 70 // Disables magnifier, and confirm the status is set successfully.
71 DisableMagnifier(); 71 DisableMagnifier();
72 EXPECT_FALSE(IsMagnifierEnabled()); 72 EXPECT_FALSE(IsMagnifierEnabled());
73 EXPECT_EQ(GetMagnifierType(), ui::MAGNIFIER_FULL); 73 EXPECT_EQ(GetMagnifierType(), ash::MAGNIFIER_FULL);
74 } 74 }
75 75
76 } // namespace chromeos 76 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698