Home | History | Annotate | Download | only in accessibility
      1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #include <string>
      6 
      7 #include "ash/magnifier/magnification_controller.h"
      8 #include "ash/shell.h"
      9 #include "base/command_line.h"
     10 #include "base/prefs/pref_service.h"
     11 #include "chrome/browser/browser_process.h"
     12 #include "chrome/browser/chrome_notification_types.h"
     13 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h"
     14 #include "chrome/browser/chromeos/accessibility/magnification_manager.h"
     15 #include "chrome/browser/chromeos/login/helper.h"
     16 #include "chrome/browser/chromeos/login/login_utils.h"
     17 #include "chrome/browser/profiles/profile.h"
     18 #include "chrome/browser/profiles/profile_manager.h"
     19 #include "chrome/common/chrome_switches.h"
     20 #include "chrome/common/pref_names.h"
     21 #include "chrome/test/base/in_process_browser_test.h"
     22 #include "chrome/test/base/testing_profile.h"
     23 #include "chromeos/chromeos_switches.h"
     24 #include "components/user_manager/user_manager.h"
     25 #include "components/user_prefs/user_prefs.h"
     26 #include "content/public/browser/notification_details.h"
     27 #include "content/public/browser/notification_service.h"
     28 #include "testing/gtest/include/gtest/gtest.h"
     29 
     30 namespace chromeos {
     31 
     32 namespace {
     33 
     34 const char kTestUserName[] = "owner (at) invalid.domain";
     35 
     36 void SetMagnifierEnabled(bool enabled) {
     37   MagnificationManager::Get()->SetMagnifierEnabled(enabled);
     38 }
     39 
     40 void SetMagnifierType(ash::MagnifierType type) {
     41   MagnificationManager::Get()->SetMagnifierType(type);
     42 }
     43 
     44 void SetFullScreenMagnifierScale(double scale) {
     45   ash::Shell::GetInstance()->
     46       magnification_controller()->SetScale(scale, false);
     47 }
     48 
     49 double GetFullScreenMagnifierScale() {
     50   return ash::Shell::GetInstance()->magnification_controller()->GetScale();
     51 }
     52 
     53 void SetSavedFullScreenMagnifierScale(double scale) {
     54   MagnificationManager::Get()->SaveScreenMagnifierScale(scale);
     55 }
     56 
     57 double GetSavedFullScreenMagnifierScale() {
     58   return MagnificationManager::Get()->GetSavedScreenMagnifierScale();
     59 }
     60 
     61 ash::MagnifierType GetMagnifierType() {
     62   return MagnificationManager::Get()->GetMagnifierType();
     63 }
     64 
     65 bool IsMagnifierEnabled() {
     66   return MagnificationManager::Get()->IsMagnifierEnabled();
     67 }
     68 
     69 Profile* profile() {
     70   Profile* profile = ProfileManager::GetActiveUserProfile();
     71   DCHECK(profile);
     72   return profile;
     73 }
     74 
     75 PrefService* prefs() {
     76   return user_prefs::UserPrefs::Get(profile());
     77 }
     78 
     79 void SetScreenMagnifierEnabledPref(bool enabled) {
     80   prefs()->SetBoolean(prefs::kAccessibilityScreenMagnifierEnabled, enabled);
     81 }
     82 
     83 void SetScreenMagnifierTypePref(ash::MagnifierType type) {
     84   prefs()->SetInteger(prefs::kAccessibilityScreenMagnifierType, type);
     85 }
     86 
     87 void SetFullScreenMagnifierScalePref(double scale) {
     88   prefs()->SetDouble(prefs::kAccessibilityScreenMagnifierScale, scale);
     89 }
     90 
     91 bool GetScreenMagnifierEnabledFromPref() {
     92   return prefs()->GetBoolean(prefs::kAccessibilityScreenMagnifierEnabled);
     93 }
     94 
     95 // Creates and logs into a profile with account |name|, and makes sure that
     96 // the profile is regarded as "non new" in the next login. This is used in
     97 // PRE_XXX cases so that in the main XXX case we can test non new profiles.
     98 void PrepareNonNewProfile(const std::string& name) {
     99   user_manager::UserManager::Get()->UserLoggedIn(name, name, true);
    100   // To prepare a non-new profile for tests, we must ensure the profile
    101   // directory and the preference files are created, because that's what
    102   // Profile::IsNewProfile() checks. UserLoggedIn(), however, does not yet
    103   // create the profile directory until GetActiveUserProfile() is called.
    104   ProfileManager::GetActiveUserProfile();
    105 }
    106 
    107 }  // namespace
    108 
    109 class MockMagnificationObserver {
    110  public:
    111   MockMagnificationObserver() : observed_(false),
    112                                 observed_enabled_(false),
    113                                 magnifier_type_(-1)
    114   {
    115     AccessibilityManager* accessibility_manager = AccessibilityManager::Get();
    116     CHECK(accessibility_manager);
    117     accessibility_subscription_ = accessibility_manager->RegisterCallback(
    118         base::Bind(&MockMagnificationObserver::OnAccessibilityStatusChanged,
    119                    base::Unretained(this)));
    120   }
    121 
    122   virtual ~MockMagnificationObserver() {}
    123 
    124   bool observed() const { return observed_; }
    125   bool observed_enabled() const { return observed_enabled_; }
    126   int magnifier_type() const { return magnifier_type_; }
    127 
    128   void reset() { observed_ = false; }
    129 
    130  private:
    131   void OnAccessibilityStatusChanged(
    132       const AccessibilityStatusEventDetails& details) {
    133     if (details.notification_type == ACCESSIBILITY_TOGGLE_SCREEN_MAGNIFIER) {
    134       magnifier_type_ = details.magnifier_type;
    135       observed_enabled_ = details.enabled;
    136       observed_ = true;
    137     }
    138   }
    139 
    140   bool observed_;
    141   bool observed_enabled_;
    142   int magnifier_type_;
    143 
    144   scoped_ptr<AccessibilityStatusSubscription> accessibility_subscription_;
    145 
    146   DISALLOW_COPY_AND_ASSIGN(MockMagnificationObserver);
    147 };
    148 
    149 
    150 class MagnificationManagerTest : public InProcessBrowserTest {
    151  protected:
    152   MagnificationManagerTest() {}
    153   virtual ~MagnificationManagerTest() {}
    154 
    155   virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
    156     command_line->AppendSwitch(switches::kLoginManager);
    157     command_line->AppendSwitchASCII(switches::kLoginProfile,
    158                                     TestingProfile::kTestUserProfileDir);
    159   }
    160 
    161   virtual void SetUpOnMainThread() OVERRIDE {
    162     // Set the login-screen profile.
    163     MagnificationManager::Get()->SetProfileForTest(
    164         ProfileManager::GetActiveUserProfile());
    165   }
    166 
    167   DISALLOW_COPY_AND_ASSIGN(MagnificationManagerTest);
    168 };
    169 
    170 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, PRE_LoginOffToOff) {
    171   // Create a new profile once, to run the test with non-new profile.
    172   PrepareNonNewProfile(kTestUserName);
    173 
    174   // Sets pref to explicitly disable the magnifier.
    175   SetScreenMagnifierEnabledPref(false);
    176 }
    177 
    178 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginOffToOff) {
    179   // Confirms that magnifier is disabled on the login screen.
    180   EXPECT_FALSE(IsMagnifierEnabled());
    181 
    182   // Disables magnifier on login screen.
    183   SetMagnifierEnabled(false);
    184   EXPECT_FALSE(IsMagnifierEnabled());
    185 
    186   // Logs in with existing profile.
    187   user_manager::UserManager::Get()->UserLoggedIn(
    188       kTestUserName, kTestUserName, true);
    189 
    190   // Confirms that magnifier is still disabled just after login.
    191   EXPECT_FALSE(IsMagnifierEnabled());
    192 
    193   user_manager::UserManager::Get()->SessionStarted();
    194 
    195   // Confirms that magnifier is still disabled just after session starts.
    196   EXPECT_FALSE(IsMagnifierEnabled());
    197 
    198   // Enables magnifier.
    199   SetMagnifierEnabled(true);
    200   // Confirms that magnifier is enabled.
    201   EXPECT_TRUE(IsMagnifierEnabled());
    202   EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
    203   EXPECT_TRUE(GetScreenMagnifierEnabledFromPref());
    204 }
    205 
    206 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, PRE_LoginFullToOff) {
    207   // Create a new profile once, to run the test with non-new profile.
    208   PrepareNonNewProfile(kTestUserName);
    209 
    210   // Sets pref to explicitly disable the magnifier.
    211   SetScreenMagnifierEnabledPref(false);
    212 }
    213 
    214 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginFullToOff) {
    215   // Confirms that magnifier is disabled on the login screen.
    216   EXPECT_FALSE(IsMagnifierEnabled());
    217 
    218   // Enables magnifier on login screen.
    219   SetMagnifierEnabled(true);
    220   SetMagnifierType(ash::MAGNIFIER_FULL);
    221   SetFullScreenMagnifierScale(2.5);
    222   EXPECT_TRUE(IsMagnifierEnabled());
    223   EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
    224   EXPECT_EQ(2.5, GetFullScreenMagnifierScale());
    225 
    226   // Logs in (but the session is not started yet).
    227   user_manager::UserManager::Get()->UserLoggedIn(
    228       kTestUserName, kTestUserName, true);
    229 
    230   // Confirms that magnifier is keeping enabled.
    231   EXPECT_TRUE(IsMagnifierEnabled());
    232   EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
    233 
    234   user_manager::UserManager::Get()->SessionStarted();
    235 
    236   // Confirms that magnifier is disabled just after session start.
    237   EXPECT_FALSE(IsMagnifierEnabled());
    238   EXPECT_FALSE(GetScreenMagnifierEnabledFromPref());
    239 }
    240 
    241 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, PRE_LoginOffToFull) {
    242   // Create a new profile once, to run the test with non-new profile.
    243   PrepareNonNewProfile(kTestUserName);
    244 
    245   // Sets prefs to explicitly enable the magnifier.
    246   SetScreenMagnifierEnabledPref(true);
    247   SetScreenMagnifierTypePref(ash::MAGNIFIER_FULL);
    248   SetFullScreenMagnifierScalePref(2.5);
    249 }
    250 
    251 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginOffToFull) {
    252   // Disables magnifier on login screen.
    253   SetMagnifierEnabled(false);
    254   EXPECT_FALSE(IsMagnifierEnabled());
    255 
    256   // Logs in (but the session is not started yet).
    257   user_manager::UserManager::Get()->UserLoggedIn(
    258       kTestUserName, kTestUserName, true);
    259 
    260   // Confirms that magnifier is keeping disabled.
    261   EXPECT_FALSE(IsMagnifierEnabled());
    262 
    263   user_manager::UserManager::Get()->SessionStarted();
    264 
    265   // Confirms that the magnifier is enabled and configured according to the
    266   // explicitly set prefs just after session start.
    267   EXPECT_TRUE(IsMagnifierEnabled());
    268   EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
    269   EXPECT_EQ(2.5, GetFullScreenMagnifierScale());
    270   EXPECT_TRUE(GetScreenMagnifierEnabledFromPref());
    271 }
    272 
    273 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, PRE_LoginFullToFull) {
    274   // Create a new profile once, to run the test with non-new profile.
    275   PrepareNonNewProfile(kTestUserName);
    276 
    277   // Sets prefs to explicitly enable the magnifier.
    278   SetScreenMagnifierEnabledPref(true);
    279   SetScreenMagnifierTypePref(ash::MAGNIFIER_FULL);
    280   SetFullScreenMagnifierScalePref(2.5);
    281 }
    282 
    283 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginFullToFull) {
    284   // Enables magnifier on login screen.
    285   SetMagnifierType(ash::MAGNIFIER_FULL);
    286   SetMagnifierEnabled(true);
    287   SetFullScreenMagnifierScale(3.0);
    288   EXPECT_TRUE(IsMagnifierEnabled());
    289   EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
    290   EXPECT_EQ(3.0, GetFullScreenMagnifierScale());
    291 
    292   // Logs in (but the session is not started yet).
    293   user_manager::UserManager::Get()->UserLoggedIn(
    294       kTestUserName, kTestUserName, true);
    295 
    296   // Confirms that magnifier is keeping enabled.
    297   EXPECT_TRUE(IsMagnifierEnabled());
    298   EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
    299 
    300   user_manager::UserManager::Get()->SessionStarted();
    301 
    302   // Confirms that the magnifier is enabled and configured according to the
    303   // explicitly set prefs just after session start.
    304   EXPECT_TRUE(IsMagnifierEnabled());
    305   EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
    306   EXPECT_EQ(2.5, GetFullScreenMagnifierScale());
    307   EXPECT_TRUE(GetScreenMagnifierEnabledFromPref());
    308 }
    309 
    310 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, PRE_LoginFullToUnset) {
    311   // Creates a new profile once, to run the test with non-new profile.
    312   PrepareNonNewProfile(kTestUserName);
    313 }
    314 
    315 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginFullToUnset) {
    316   // Enables full screen magnifier.
    317   SetMagnifierType(ash::MAGNIFIER_FULL);
    318   SetMagnifierEnabled(true);
    319   EXPECT_TRUE(IsMagnifierEnabled());
    320   EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
    321 
    322   // Logs in (but the session is not started yet).
    323   user_manager::UserManager::Get()->UserLoggedIn(
    324       kTestUserName, kTestUserName, true);
    325 
    326   // Confirms that magnifier is keeping enabled.
    327   EXPECT_TRUE(IsMagnifierEnabled());
    328   EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
    329 
    330   user_manager::UserManager::Get()->SessionStarted();
    331 
    332   // Confirms that magnifier is disabled.
    333   EXPECT_FALSE(IsMagnifierEnabled());
    334   EXPECT_FALSE(GetScreenMagnifierEnabledFromPref());
    335 }
    336 
    337 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginAsNewUserOff) {
    338   // Confirms that magnifier is disabled on the login screen.
    339   EXPECT_FALSE(IsMagnifierEnabled());
    340 
    341   // Disables magnifier on login screen explicitly.
    342   SetMagnifierEnabled(false);
    343 
    344   // Logs in (but the session is not started yet).
    345   user_manager::UserManager::Get()->UserLoggedIn(
    346       kTestUserName, kTestUserName, true);
    347 
    348   // Confirms that magnifier is keeping disabled.
    349   EXPECT_FALSE(IsMagnifierEnabled());
    350 
    351   user_manager::UserManager::Get()->SessionStarted();
    352 
    353   // Confirms that magnifier is keeping disabled.
    354   EXPECT_FALSE(IsMagnifierEnabled());
    355   EXPECT_FALSE(GetScreenMagnifierEnabledFromPref());
    356 }
    357 
    358 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginAsNewUserFull) {
    359   // Enables magnifier on login screen.
    360   SetMagnifierType(ash::MAGNIFIER_FULL);
    361   SetMagnifierEnabled(true);
    362   SetFullScreenMagnifierScale(2.5);
    363   EXPECT_TRUE(IsMagnifierEnabled());
    364   EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
    365   EXPECT_EQ(2.5, GetFullScreenMagnifierScale());
    366 
    367   // Logs in (but the session is not started yet).
    368   user_manager::UserManager::Get()->UserLoggedIn(
    369       kTestUserName, kTestUserName, true);
    370 
    371   // Confirms that magnifier is keeping enabled.
    372   EXPECT_TRUE(IsMagnifierEnabled());
    373   EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
    374 
    375   user_manager::UserManager::Get()->SessionStarted();
    376 
    377   // Confirms that magnifier keeps enabled.
    378   EXPECT_TRUE(IsMagnifierEnabled());
    379   EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
    380   EXPECT_EQ(2.5, GetFullScreenMagnifierScale());
    381   EXPECT_TRUE(GetScreenMagnifierEnabledFromPref());
    382 }
    383 
    384 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginAsNewUserUnset) {
    385   // Confirms that magnifier is disabled on the login screen.
    386   EXPECT_FALSE(IsMagnifierEnabled());
    387 
    388   // Logs in (but the session is not started yet).
    389   user_manager::UserManager::Get()->UserLoggedIn(
    390       kTestUserName, kTestUserName, true);
    391 
    392   // Confirms that magnifier is keeping disabled.
    393   EXPECT_FALSE(IsMagnifierEnabled());
    394 
    395   user_manager::UserManager::Get()->SessionStarted();
    396 
    397   // Confirms that magnifier is keeping disabled.
    398   EXPECT_FALSE(IsMagnifierEnabled());
    399   EXPECT_FALSE(GetScreenMagnifierEnabledFromPref());
    400 }
    401 
    402 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, ChangeMagnifierType) {
    403   // Enables/disables full screen magnifier.
    404   SetMagnifierEnabled(false);
    405   SetMagnifierType(ash::MAGNIFIER_FULL);
    406   EXPECT_FALSE(IsMagnifierEnabled());
    407   EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
    408 
    409   SetMagnifierEnabled(true);
    410   EXPECT_TRUE(IsMagnifierEnabled());
    411   EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
    412 
    413   SetMagnifierEnabled(false);
    414   EXPECT_FALSE(IsMagnifierEnabled());
    415   EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
    416 
    417   // Enables/disables partial screen magnifier.
    418   SetMagnifierType(ash::MAGNIFIER_PARTIAL);
    419   EXPECT_FALSE(IsMagnifierEnabled());
    420   EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
    421 
    422   SetMagnifierEnabled(true);
    423   EXPECT_TRUE(IsMagnifierEnabled());
    424   EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
    425 
    426   SetMagnifierEnabled(false);
    427   EXPECT_FALSE(IsMagnifierEnabled());
    428   EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
    429 
    430   // Changes the magnifier type when the magnifier is enabled.
    431   SetMagnifierType(ash::MAGNIFIER_FULL);
    432   SetMagnifierEnabled(true);
    433   EXPECT_TRUE(IsMagnifierEnabled());
    434   EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
    435 
    436   SetMagnifierType(ash::MAGNIFIER_PARTIAL);
    437   EXPECT_TRUE(IsMagnifierEnabled());
    438   EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
    439 
    440   SetMagnifierType(ash::MAGNIFIER_FULL);
    441   EXPECT_TRUE(IsMagnifierEnabled());
    442   EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
    443 
    444   // Changes the magnifier type when the magnifier is disabled.
    445   SetMagnifierEnabled(false);
    446   SetMagnifierType(ash::MAGNIFIER_FULL);
    447   EXPECT_FALSE(IsMagnifierEnabled());
    448   EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
    449 
    450   SetMagnifierType(ash::MAGNIFIER_PARTIAL);
    451   EXPECT_FALSE(IsMagnifierEnabled());
    452   EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
    453 
    454   SetMagnifierType(ash::MAGNIFIER_FULL);
    455   EXPECT_FALSE(IsMagnifierEnabled());
    456   EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
    457 }
    458 
    459 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, TypePref) {
    460   // Logs in
    461   user_manager::UserManager::Get()->UserLoggedIn(
    462       kTestUserName, kTestUserName, true);
    463   user_manager::UserManager::Get()->SessionStarted();
    464 
    465   // Confirms that magnifier is disabled just after login.
    466   EXPECT_FALSE(IsMagnifierEnabled());
    467 
    468   // Sets the pref as true to enable magnifier.
    469   SetScreenMagnifierTypePref(ash::MAGNIFIER_FULL);
    470   SetScreenMagnifierEnabledPref(true);
    471   // Confirms that magnifier is enabled.
    472   EXPECT_TRUE(IsMagnifierEnabled());
    473   EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
    474 }
    475 
    476 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, ScalePref) {
    477   SetMagnifierEnabled(false);
    478   EXPECT_FALSE(IsMagnifierEnabled());
    479 
    480   // Sets 2.5x to the pref.
    481   SetSavedFullScreenMagnifierScale(2.5);
    482 
    483   // Enables full screen magnifier.
    484   SetMagnifierType(ash::MAGNIFIER_FULL);
    485   SetMagnifierEnabled(true);
    486   EXPECT_TRUE(IsMagnifierEnabled());
    487   EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
    488 
    489   // Confirms that 2.5x is restored.
    490   EXPECT_EQ(2.5, GetFullScreenMagnifierScale());
    491 
    492   // Sets the scale and confirms that the scale is saved to pref.
    493   SetFullScreenMagnifierScale(3.0);
    494   EXPECT_EQ(3.0, GetSavedFullScreenMagnifierScale());
    495 }
    496 
    497 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, InvalidScalePref) {
    498   // TEST 1: Sets too small scale
    499   SetMagnifierEnabled(false);
    500   EXPECT_FALSE(IsMagnifierEnabled());
    501 
    502   // Sets too small value to the pref.
    503   SetSavedFullScreenMagnifierScale(0.5);
    504 
    505   // Enables full screen magnifier.
    506   SetMagnifierType(ash::MAGNIFIER_FULL);
    507   SetMagnifierEnabled(true);
    508   EXPECT_TRUE(IsMagnifierEnabled());
    509   EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
    510 
    511   // Confirms that the actual scale is set to the minimum scale.
    512   EXPECT_EQ(1.0, GetFullScreenMagnifierScale());
    513 
    514   // TEST 2: Sets too large scale
    515   SetMagnifierEnabled(false);
    516   EXPECT_FALSE(IsMagnifierEnabled());
    517 
    518   // Sets too large value to the pref.
    519   SetSavedFullScreenMagnifierScale(50.0);
    520 
    521   // Enables full screen magnifier.
    522   SetMagnifierEnabled(true);
    523   EXPECT_TRUE(IsMagnifierEnabled());
    524   EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
    525 
    526   // Confirms that the actual scale is set to the maximum scale.
    527   EXPECT_EQ(4.0, GetFullScreenMagnifierScale());
    528 }
    529 
    530 IN_PROC_BROWSER_TEST_F(MagnificationManagerTest,
    531                        ChangingTypeInvokesNotification) {
    532   MockMagnificationObserver observer;
    533 
    534   EXPECT_FALSE(observer.observed());
    535 
    536   // Set full screen magnifier, and confirm the observer is called.
    537   SetMagnifierEnabled(true);
    538   SetMagnifierType(ash::MAGNIFIER_FULL);
    539   EXPECT_TRUE(observer.observed());
    540   EXPECT_TRUE(observer.observed_enabled());
    541   EXPECT_EQ(observer.magnifier_type(), ash::MAGNIFIER_FULL);
    542   EXPECT_EQ(GetMagnifierType(), ash::MAGNIFIER_FULL);
    543   observer.reset();
    544 
    545   // Set full screen magnifier again, and confirm the observer is not called.
    546   SetMagnifierType(ash::MAGNIFIER_FULL);
    547   EXPECT_FALSE(observer.observed());
    548   EXPECT_EQ(GetMagnifierType(), ash::MAGNIFIER_FULL);
    549   observer.reset();
    550 }
    551 
    552 }  // namespace chromeos
    553