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

Unified Diff: chrome/browser/chromeos/accessibility/magnification_manager_browsertest.cc

Issue 11642014: Re-introduce the partial magnifier (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/accessibility/magnification_manager_browsertest.cc
diff --git a/chrome/browser/chromeos/accessibility/magnification_manager_browsertest.cc b/chrome/browser/chromeos/accessibility/magnification_manager_browsertest.cc
index 6a1a89a54ac8f8dae03fc203f90adc96a354f38f..206e39cdc26b978cd115394245407692a5e62fd8 100644
--- a/chrome/browser/chromeos/accessibility/magnification_manager_browsertest.cc
+++ b/chrome/browser/chromeos/accessibility/magnification_manager_browsertest.cc
@@ -24,11 +24,63 @@
namespace chromeos {
+namespace {
+
+void SetMagnifier(bool enabled, ash::MagnifierType type) {
+ MagnificationManager::Get()->SetMagnifier(enabled, type);
+}
+
+void SetFullScreenMagnifierScale(double scale) {
+ ash::Shell::GetInstance()->
+ magnification_controller()->SetScale(scale, false);
+}
+
+double GetFullScreenMagnifierScale() {
+ return ash::Shell::GetInstance()->magnification_controller()->GetScale();
+}
+
+void SetSavedFullScreenMagnifierScale(double scale) {
+ MagnificationManager::Get()->SaveScreenMagnifierScale(scale);
+}
+
+double GetSavedFullScreenMagnifierScale() {
+ return MagnificationManager::Get()->GetSavedScreenMagnifierScale();
+}
+
+ash::MagnifierType GetMagnifierType() {
+ return MagnificationManager::Get()->GetMagnifierType();
+}
+
+bool IsMagnifierEnabled() {
+ return MagnificationManager::Get()->IsMagnifierEnabled();
+}
+
+Profile* profile() {
+ Profile* profile = ProfileManager::GetDefaultProfileOrOffTheRecord();
+ DCHECK(profile);
+ return profile;
+}
+
+PrefServiceBase* prefs() {
+ return PrefServiceBase::FromBrowserContext(profile());
+}
+
+void EnableScreenManagnifierToPref(bool enabled) {
+ prefs()->SetBoolean(prefs::kScreenMagnifierEnabled, enabled);
+}
+
+void SetScreenManagnifierTypeToPref(ash::MagnifierType type) {
+ prefs()->SetInteger(prefs::kScreenMagnifierType, type);
+}
+
+} // anonymouse namespace
+
class MagnificationManagerTest : public CrosInProcessBrowserTest,
public content::NotificationObserver {
protected:
MagnificationManagerTest() : observed_(false),
- observed_type_(ash::MAGNIFIER_OFF) {}
+ observed_enabled_(false),
+ observed_type_(ash::MAGNIFIER_TYPE_UNCHANGE) {}
virtual ~MagnificationManagerTest() {}
virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
@@ -37,16 +89,6 @@ class MagnificationManagerTest : public CrosInProcessBrowserTest,
TestingProfile::kTestUserProfileDir);
}
- Profile* profile() {
- Profile* profile = ProfileManager::GetDefaultProfileOrOffTheRecord();
- DCHECK(profile);
- return profile;
- }
-
- PrefServiceBase* prefs() {
- return PrefServiceBase::FromBrowserContext(profile());
- }
-
virtual void SetUpOnMainThread() OVERRIDE {
registrar_.Add(
this,
@@ -54,37 +96,6 @@ class MagnificationManagerTest : public CrosInProcessBrowserTest,
content::NotificationService::AllSources());
}
- void SetScreenManagnifierType(ash::MagnifierType type) {
- MagnificationManager::Get()->SetMagnifier(type);
- }
-
- void SetScreenManagnifierTypeToPref(ash::MagnifierType type) {
- prefs()->SetBoolean(prefs::kScreenMagnifierEnabled,
- (type != ash::MAGNIFIER_OFF) ? true : false);
- }
-
- void SetFullScreenMagnifierScale(double scale) {
- ash::Shell::GetInstance()->
- magnification_controller()->SetScale(scale, false);
- }
-
- double GetFullScreenMagnifierScale() {
- return ash::Shell::GetInstance()->magnification_controller()->GetScale();
- }
-
- void SetSavedFullScreenMagnifierScale(double scale) {
- MagnificationManager::Get()->SaveScreenMagnifierScale(scale);
- }
-
- double GetSavedFullScreenMagnifierScale() {
- return MagnificationManager::Get()->GetSavedScreenMagnifierScale();
- }
-
- void CheckCurrentMagnifierType(
- ash::MagnifierType type) {
- EXPECT_EQ(MagnificationManager::Get()->GetMagnifierType(), type);
- }
-
// content::NotificationObserver implementation.
virtual void Observe(int type,
const content::NotificationSource& source,
@@ -96,14 +107,15 @@ class MagnificationManagerTest : public CrosInProcessBrowserTest,
details).ptr();
observed_ = true;
- observed_type_ = accessibility_status->enabled ? ash::MAGNIFIER_FULL :
- ash::MAGNIFIER_OFF;
+ observed_enabled_ = accessibility_status->enabled;
+ observed_type_ = accessibility_status->magnifier_type;
break;
}
}
}
bool observed_;
+ bool observed_enabled_;
ash::MagnifierType observed_type_;
content::NotificationRegistrar registrar_;
DISALLOW_COPY_AND_ASSIGN(MagnificationManagerTest);
@@ -111,121 +123,191 @@ class MagnificationManagerTest : public CrosInProcessBrowserTest,
IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginOffToOff) {
// Confirms that magnifier is disabled on the login screen.
- CheckCurrentMagnifierType(ash::MAGNIFIER_OFF);
+ EXPECT_FALSE(IsMagnifierEnabled());
// Logs in.
UserManager::Get()->UserLoggedIn("owner@invalid.domain", true);
// Confirms that magnifier is still disabled just after login.
- CheckCurrentMagnifierType(ash::MAGNIFIER_OFF);
+ EXPECT_FALSE(IsMagnifierEnabled());
UserManager::Get()->SessionStarted();
// Confirms that magnifier is still disabled just after login.
- CheckCurrentMagnifierType(ash::MAGNIFIER_OFF);
+ EXPECT_FALSE(IsMagnifierEnabled());
// Enables magnifier.
- SetScreenManagnifierType(ash::MAGNIFIER_FULL);
+ SetMagnifier(true, ash::MAGNIFIER_TYPE_UNCHANGE);
// Confirms that magnifier is enabled.
- CheckCurrentMagnifierType(ash::MAGNIFIER_FULL);
+ EXPECT_TRUE(IsMagnifierEnabled());
+ EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
}
IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginFullToOff) {
// Confirms that magnifier is disabled on the login screen.
- CheckCurrentMagnifierType(ash::MAGNIFIER_OFF);
+ EXPECT_FALSE(IsMagnifierEnabled());
// Enables magnifier on login scren.
- SetScreenManagnifierType(ash::MAGNIFIER_FULL);
+ SetMagnifier(true, ash::MAGNIFIER_TYPE_UNCHANGE);
// Logs in (but the session is not started yet).
UserManager::Get()->UserLoggedIn("owner@invalid.domain", true);
// Confirms that magnifier is keeping enabled.
- CheckCurrentMagnifierType(ash::MAGNIFIER_FULL);
+ EXPECT_TRUE(IsMagnifierEnabled());
+ EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
UserManager::Get()->SessionStarted();
// Confirms that magnifier is disabled just after login.
- CheckCurrentMagnifierType(ash::MAGNIFIER_OFF);
+ EXPECT_FALSE(IsMagnifierEnabled());
}
IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginOffToFull) {
// Changes to full screen magnifier again and confirms that.
- SetScreenManagnifierType(ash::MAGNIFIER_OFF);
- CheckCurrentMagnifierType(ash::MAGNIFIER_OFF);
+ SetMagnifier(false, ash::MAGNIFIER_TYPE_UNCHANGE);
+ EXPECT_FALSE(IsMagnifierEnabled());
// Logs in (but the session is not started yet).
UserManager::Get()->UserLoggedIn("owner@invalid.domain", true);
// Confirms that magnifier is keeping disabled.
- CheckCurrentMagnifierType(ash::MAGNIFIER_OFF);
+ EXPECT_FALSE(IsMagnifierEnabled());
// Enable magnifier on the pref.
+ EnableScreenManagnifierToPref(true);
SetScreenManagnifierTypeToPref(ash::MAGNIFIER_FULL);
SetSavedFullScreenMagnifierScale(2.5);
UserManager::Get()->SessionStarted();
// Confirms that the prefs are successfully loaded.
- CheckCurrentMagnifierType(ash::MAGNIFIER_FULL);
+ EXPECT_TRUE(IsMagnifierEnabled());
+ EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
EXPECT_EQ(2.5, GetFullScreenMagnifierScale());
}
+IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginOffToPartial) {
+ // Changes to full screen magnifier again and confirms that.
+ SetMagnifier(false, ash::MAGNIFIER_TYPE_UNCHANGE);
+ EXPECT_FALSE(IsMagnifierEnabled());
+
+ // Logs in (but the session is not started yet).
+ UserManager::Get()->UserLoggedIn("owner@invalid.domain", true);
+
+ // Confirms that magnifier is keeping disabled.
+ EXPECT_FALSE(IsMagnifierEnabled());
+ // Enable magnifier on the pref.
+ EnableScreenManagnifierToPref(true);
+ SetScreenManagnifierTypeToPref(ash::MAGNIFIER_PARTIAL);
+
+ UserManager::Get()->SessionStarted();
+
+ // Confirms that the prefs are successfully loaded.
+ EXPECT_TRUE(IsMagnifierEnabled());
+ EXPECT_EQ(ash::MAGNIFIER_PARTIAL, GetMagnifierType());
+
+ // Full screen magnifier scale is 1.0x since it's 'partial' magnifier.
+ EXPECT_EQ(1.0, GetFullScreenMagnifierScale());
+}
+
IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginFullToFull) {
// Changes to full screen magnifier again and confirms that.
- SetScreenManagnifierType(ash::MAGNIFIER_FULL);
- CheckCurrentMagnifierType(ash::MAGNIFIER_FULL);
+ SetMagnifier(true, ash::MAGNIFIER_FULL);
+ EXPECT_TRUE(IsMagnifierEnabled());
+ EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
// Logs in (but the session is not started yet).
UserManager::Get()->UserLoggedIn("owner@invalid.domain", true);
// Confirms that magnifier is keeping enabled.
- CheckCurrentMagnifierType(ash::MAGNIFIER_FULL);
+ EXPECT_TRUE(IsMagnifierEnabled());
+ EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
// Enable magnifier on the pref.
+ EnableScreenManagnifierToPref(true);
SetScreenManagnifierTypeToPref(ash::MAGNIFIER_FULL);
SetSavedFullScreenMagnifierScale(2.5);
UserManager::Get()->SessionStarted();
// Confirms that the prefs are successfully loaded.
- CheckCurrentMagnifierType(ash::MAGNIFIER_FULL);
+ EXPECT_TRUE(IsMagnifierEnabled());
+ EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
EXPECT_EQ(2.5, GetFullScreenMagnifierScale());
}
-IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, ChangeMagnifierType) {
- // Changes to full screen magnifier and confirms that.
- SetScreenManagnifierType(ash::MAGNIFIER_FULL);
- CheckCurrentMagnifierType(ash::MAGNIFIER_FULL);
-
- // Changes to partial screen magnifier and confirms that.
- SetScreenManagnifierType(ash::MAGNIFIER_PARTIAL);
- CheckCurrentMagnifierType(ash::MAGNIFIER_PARTIAL);
-
- // Disable magnifier and confirms that.
- SetScreenManagnifierType(ash::MAGNIFIER_OFF);
- CheckCurrentMagnifierType(ash::MAGNIFIER_OFF);
-
+IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, LoginFullToPartial) {
// Changes to full screen magnifier again and confirms that.
- SetScreenManagnifierType(ash::MAGNIFIER_FULL);
- CheckCurrentMagnifierType(ash::MAGNIFIER_FULL);
+ SetMagnifier(true, ash::MAGNIFIER_FULL);
+ EXPECT_TRUE(IsMagnifierEnabled());
+ EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
- // Logs in
+ // Logs in (but the session is not started yet).
UserManager::Get()->UserLoggedIn("owner@invalid.domain", true);
+
+ // Confirms that magnifier is keeping enabled.
+ EXPECT_TRUE(IsMagnifierEnabled());
+ EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
+ // Enable magnifier on the pref.
+ EnableScreenManagnifierToPref(true);
+ SetScreenManagnifierTypeToPref(ash::MAGNIFIER_PARTIAL);
+
UserManager::Get()->SessionStarted();
- // Changes to full screen magnifier and confirms that.
- SetScreenManagnifierType(ash::MAGNIFIER_FULL);
- CheckCurrentMagnifierType(ash::MAGNIFIER_FULL);
+ // Confirms that the prefs are successfully loaded.
+ EXPECT_TRUE(IsMagnifierEnabled());
+ EXPECT_EQ(ash::MAGNIFIER_PARTIAL, GetMagnifierType());
- // Changes to partial screen magnifier and confirms that.
- SetScreenManagnifierType(ash::MAGNIFIER_PARTIAL);
- CheckCurrentMagnifierType(ash::MAGNIFIER_PARTIAL);
+ // Full screen magnifier scale is 1.0x since it's 'partial' magnifier.
+ EXPECT_EQ(1.0, GetFullScreenMagnifierScale());
+}
- // Disable magnifier and confirms that.
- SetScreenManagnifierType(ash::MAGNIFIER_OFF);
- CheckCurrentMagnifierType(ash::MAGNIFIER_OFF);
+IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, ChangeMagnifierType) {
- // Changes to full screen magnifier again and confirms that.
- SetScreenManagnifierType(ash::MAGNIFIER_FULL);
- CheckCurrentMagnifierType(ash::MAGNIFIER_FULL);
+ // (Disable, PARTIAL) -> (Enable, FULL)
+ SetMagnifier(false, ash::MAGNIFIER_PARTIAL);
+ EXPECT_FALSE(IsMagnifierEnabled());
+ SetMagnifier(true, ash::MAGNIFIER_FULL);
+ EXPECT_TRUE(IsMagnifierEnabled());
+ EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
+
+ // (Disable, FULL) -> (Enable, PARTIAL)
+ SetMagnifier(false, ash::MAGNIFIER_FULL);
+ EXPECT_FALSE(IsMagnifierEnabled());
+ SetMagnifier(true, ash::MAGNIFIER_PARTIAL);
+ EXPECT_TRUE(IsMagnifierEnabled());
+ EXPECT_EQ(ash::MAGNIFIER_PARTIAL, GetMagnifierType());
+
+ // (Enable, PARTIAL) -> (Enable, UNCHANGE)
+ SetMagnifier(true, ash::MAGNIFIER_TYPE_UNCHANGE);
+ EXPECT_TRUE(IsMagnifierEnabled());
+ EXPECT_EQ(ash::MAGNIFIER_PARTIAL, GetMagnifierType());
+
+ // (Enable, PARTIAL) -> (Enable, FULL)
+ SetMagnifier(true, ash::MAGNIFIER_FULL);
+ EXPECT_TRUE(IsMagnifierEnabled());
+ EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
+
+ // (Enable, FULL) -> (Enable, UNCHANGE)
+ SetMagnifier(true, ash::MAGNIFIER_TYPE_UNCHANGE);
+ EXPECT_TRUE(IsMagnifierEnabled());
+ EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
+
+ // (Enable, FULL) -> (Enable, PARTIAL)
+ SetMagnifier(true, ash::MAGNIFIER_PARTIAL);
+ EXPECT_TRUE(IsMagnifierEnabled());
+ EXPECT_EQ(ash::MAGNIFIER_PARTIAL, GetMagnifierType());
+
+ // Confirms that the type can be saved even when magnifier is disabled.
+ SetMagnifier(false, ash::MAGNIFIER_FULL);
+ EXPECT_FALSE(IsMagnifierEnabled());
+ EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
+ SetMagnifier(false, ash::MAGNIFIER_PARTIAL);
+ EXPECT_FALSE(IsMagnifierEnabled());
+ EXPECT_EQ(ash::MAGNIFIER_PARTIAL, GetMagnifierType());
+
+ // Confirms that the saved type can be recovered.
+ SetMagnifier(true, ash::MAGNIFIER_TYPE_UNCHANGE);
+ EXPECT_TRUE(IsMagnifierEnabled());
+ EXPECT_EQ(ash::MAGNIFIER_PARTIAL, GetMagnifierType());
}
IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, TypePref) {
@@ -234,48 +316,74 @@ IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, TypePref) {
UserManager::Get()->SessionStarted();
// Confirms that magnifier is disabled just after login.
- CheckCurrentMagnifierType(ash::MAGNIFIER_OFF);
+ EXPECT_FALSE(IsMagnifierEnabled());
// Sets the pref as true to enable magnifier.
SetScreenManagnifierTypeToPref(ash::MAGNIFIER_FULL);
+ EnableScreenManagnifierToPref(true);
// Confirms that magnifier is enabled.
- CheckCurrentMagnifierType(ash::MAGNIFIER_FULL);
+ EXPECT_TRUE(IsMagnifierEnabled());
+ EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
+
+ SetScreenManagnifierTypeToPref(ash::MAGNIFIER_PARTIAL);
+ EXPECT_TRUE(IsMagnifierEnabled());
+ EXPECT_EQ(ash::MAGNIFIER_PARTIAL, GetMagnifierType());
// Sets the pref as false to disabled magnifier.
- SetScreenManagnifierTypeToPref(ash::MAGNIFIER_OFF);
+ EnableScreenManagnifierToPref(false);
// Confirms that magnifier is disabled.
- CheckCurrentMagnifierType(ash::MAGNIFIER_OFF);
+ EXPECT_FALSE(IsMagnifierEnabled());
// Sets the pref as true to enable magnifier again.
- SetScreenManagnifierTypeToPref(ash::MAGNIFIER_FULL);
+ EnableScreenManagnifierToPref(true);
// Confirms that magnifier is enabled.
- CheckCurrentMagnifierType(ash::MAGNIFIER_FULL);
+ EXPECT_TRUE(IsMagnifierEnabled());
+ EXPECT_EQ(ash::MAGNIFIER_PARTIAL, GetMagnifierType());
}
-IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, ResumeSavedTypePref) {
+IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, ResumeSavedTypeFullPref) {
// Loads the profile of the user.
UserManager::Get()->UserLoggedIn("owner@invalid.domain", true);
// Sets the pref as true to enable magnifier before login.
+ EnableScreenManagnifierToPref(true);
SetScreenManagnifierTypeToPref(ash::MAGNIFIER_FULL);
// Logs in.
UserManager::Get()->SessionStarted();
// Confirms that magnifier is enabled just after login.
- CheckCurrentMagnifierType(ash::MAGNIFIER_FULL);
+ EXPECT_TRUE(IsMagnifierEnabled());
+ EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
+}
+
+IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, ResumeSavedTypePartialPref) {
+ // Loads the profile of the user.
+ UserManager::Get()->UserLoggedIn("owner@invalid.domain", true);
+
+ // Sets the pref as true to enable magnifier before login.
+ EnableScreenManagnifierToPref(true);
+ SetScreenManagnifierTypeToPref(ash::MAGNIFIER_PARTIAL);
+
+ // Logs in.
+ UserManager::Get()->SessionStarted();
+
+ // Confirms that magnifier is enabled just after login.
+ EXPECT_TRUE(IsMagnifierEnabled());
+ EXPECT_EQ(ash::MAGNIFIER_PARTIAL, GetMagnifierType());
}
IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, ScalePref) {
- SetScreenManagnifierType(ash::MAGNIFIER_OFF);
- CheckCurrentMagnifierType(ash::MAGNIFIER_OFF);
+ SetMagnifier(false, ash::MAGNIFIER_TYPE_UNCHANGE);
+ EXPECT_FALSE(IsMagnifierEnabled());
// Sets 2.5x to the pref.
SetSavedFullScreenMagnifierScale(2.5);
// Enables full screen magnifier.
- SetScreenManagnifierType(ash::MAGNIFIER_FULL);
- CheckCurrentMagnifierType(ash::MAGNIFIER_FULL);
+ SetMagnifier(true, ash::MAGNIFIER_FULL);
+ EXPECT_TRUE(IsMagnifierEnabled());
+ EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
// Confirms that 2.5x is restored.
EXPECT_EQ(2.5, GetFullScreenMagnifierScale());
@@ -286,30 +394,32 @@ IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, ScalePref) {
}
IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, InvalidScalePref) {
- // TEST 1: too small scale
- SetScreenManagnifierType(ash::MAGNIFIER_OFF);
- CheckCurrentMagnifierType(ash::MAGNIFIER_OFF);
+ // TEST 1: Sets too small scale
+ SetMagnifier(false, ash::MAGNIFIER_TYPE_UNCHANGE);
+ EXPECT_FALSE(IsMagnifierEnabled());
// Sets too small value to the pref.
SetSavedFullScreenMagnifierScale(0.5);
// Enables full screen magnifier.
- SetScreenManagnifierType(ash::MAGNIFIER_FULL);
- CheckCurrentMagnifierType(ash::MAGNIFIER_FULL);
+ SetMagnifier(true, ash::MAGNIFIER_FULL);
+ EXPECT_TRUE(IsMagnifierEnabled());
+ EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
// Confirms that the actual scale is set to the minimum scale.
EXPECT_EQ(1.0, GetFullScreenMagnifierScale());
- // TEST 2: too large scale
- SetScreenManagnifierType(ash::MAGNIFIER_OFF);
- CheckCurrentMagnifierType(ash::MAGNIFIER_OFF);
+ // TEST 2: Sets too large scale
+ SetMagnifier(false, ash::MAGNIFIER_TYPE_UNCHANGE);
+ EXPECT_FALSE(IsMagnifierEnabled());
// Sets too large value to the pref.
SetSavedFullScreenMagnifierScale(50.0);
// Enables full screen magnifier.
- SetScreenManagnifierType(ash::MAGNIFIER_FULL);
- CheckCurrentMagnifierType(ash::MAGNIFIER_FULL);
+ SetMagnifier(true, ash::MAGNIFIER_FULL);
+ EXPECT_TRUE(IsMagnifierEnabled());
+ EXPECT_EQ(ash::MAGNIFIER_FULL, GetMagnifierType());
// Confirms that the actual scale is set to the maximum scale.
EXPECT_EQ(4.0, GetFullScreenMagnifierScale());
@@ -321,30 +431,39 @@ IN_PROC_BROWSER_TEST_F(MagnificationManagerTest,
UserManager::Get()->UserLoggedIn("owner@invalid.domain", true);
UserManager::Get()->SessionStarted();
- // Before the test, sets to full magnifier.
- SetScreenManagnifierTypeToPref(ash::MAGNIFIER_FULL);
- CheckCurrentMagnifierType(ash::MAGNIFIER_FULL);
+ // Enable magnifier (without type)
+ EnableScreenManagnifierToPref(true);
+ EXPECT_TRUE(observed_);
// Disables magnifier and confirms observer is invoked.
observed_ = false;
- SetScreenManagnifierTypeToPref(ash::MAGNIFIER_OFF);
+ SetMagnifier(false, ash::MAGNIFIER_TYPE_UNCHANGE);
+ EXPECT_TRUE(observed_);
+
+ observed_ = false;
+ SetMagnifier(true, ash::MAGNIFIER_FULL);
EXPECT_TRUE(observed_);
- EXPECT_EQ(observed_type_, ash::MAGNIFIER_OFF);
- CheckCurrentMagnifierType(ash::MAGNIFIER_OFF);
// Enables full screen magnifier and confirms observer is invoked.
observed_ = false;
- SetScreenManagnifierTypeToPref(ash::MAGNIFIER_FULL);
+ SetMagnifier(true, ash::MAGNIFIER_FULL);
+ EXPECT_TRUE(observed_);
+ EXPECT_TRUE(observed_enabled_);
+ EXPECT_EQ(ash::MAGNIFIER_FULL, observed_type_);
+
+ // Enables partial screen magnifier and confirms observer is invoked.
+ observed_ = false;
+ SetMagnifier(true, ash::MAGNIFIER_PARTIAL);
EXPECT_TRUE(observed_);
- EXPECT_EQ(observed_type_, ash::MAGNIFIER_FULL);
- CheckCurrentMagnifierType(ash::MAGNIFIER_FULL);
+ EXPECT_TRUE(observed_enabled_);
+ EXPECT_EQ(ash::MAGNIFIER_PARTIAL, observed_type_);
// Disables magnifier again and confirms observer is invoked.
observed_ = false;
- SetScreenManagnifierTypeToPref(ash::MAGNIFIER_OFF);
+ SetMagnifier(false, ash::MAGNIFIER_TYPE_UNCHANGE);
EXPECT_TRUE(observed_);
- EXPECT_EQ(observed_type_, ash::MAGNIFIER_OFF);
- CheckCurrentMagnifierType(ash::MAGNIFIER_OFF);
+ EXPECT_FALSE(observed_enabled_);
+ EXPECT_FALSE(IsMagnifierEnabled());
}
} // namespace chromeos

Powered by Google App Engine
This is Rietveld 408576698