| 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 bc619fc9733fb7bf99dfdfc7b15646343203d4b9..868ed6bfd039c9bf581b393510f4ea78b5809898 100644
|
| --- a/chrome/browser/chromeos/accessibility/magnification_manager_browsertest.cc
|
| +++ b/chrome/browser/chromeos/accessibility/magnification_manager_browsertest.cc
|
| @@ -22,9 +22,11 @@
|
|
|
| namespace chromeos {
|
|
|
| -class MagnificationManagerTest : public CrosInProcessBrowserTest {
|
| +class MagnificationManagerTest : public CrosInProcessBrowserTest,
|
| + public MagnificationObserver {
|
| protected:
|
| - MagnificationManagerTest() {}
|
| + MagnificationManagerTest() : observed_(false),
|
| + observed_type_(ash::MAGNIFIER_OFF) {}
|
| virtual ~MagnificationManagerTest() {}
|
|
|
| virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
|
| @@ -33,6 +35,20 @@ class MagnificationManagerTest : public CrosInProcessBrowserTest {
|
| TestingProfile::kTestUserProfileDir);
|
| }
|
|
|
| + virtual void SetUp() OVERRIDE {
|
| + MagnificationManager::GetInstance()->AddObserver(this);
|
| + }
|
| +
|
| + virtual void TearDown() OVERRIDE {
|
| + MagnificationManager::GetInstance()->RemoveObserver(this);
|
| + }
|
| +
|
| + // Overridden from MagnificationObserever:
|
| + virtual void OnMagnifierTypeChanged(ash::MagnifierType new_type) OVERRIDE {
|
| + observed_ = true;
|
| + observed_type_ = new_type;
|
| + }
|
| +
|
| Profile* profile() {
|
| Profile* profile = ProfileManager::GetDefaultProfileOrOffTheRecord();
|
| DCHECK(profile);
|
| @@ -54,6 +70,8 @@ class MagnificationManagerTest : public CrosInProcessBrowserTest {
|
| type);
|
| }
|
|
|
| + bool observed_;
|
| + ash::MagnifierType observed_type_;
|
| DISALLOW_COPY_AND_ASSIGN(MagnificationManagerTest);
|
| };
|
|
|
| @@ -116,4 +134,38 @@ IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, ResumeSavedPref) {
|
| CheckCurrentMagnifierType(ash::MAGNIFIER_FULL);
|
| }
|
|
|
| +IN_PROC_BROWSER_TEST_F(MagnificationManagerTest, ChangingTypeInvokesObserver) {
|
| + // Before the test, sets to full magnifier.
|
| + SetScreenManagnifierTypeToPref(ash::MAGNIFIER_FULL);
|
| + CheckCurrentMagnifierType(ash::MAGNIFIER_FULL);
|
| +
|
| + // Disables magnifier and confirms observer is invoked.
|
| + observed_ = false;
|
| + SetScreenManagnifierTypeToPref(ash::MAGNIFIER_OFF);
|
| + 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);
|
| + EXPECT_TRUE(observed_);
|
| + EXPECT_EQ(observed_type_, ash::MAGNIFIER_FULL);
|
| + CheckCurrentMagnifierType(ash::MAGNIFIER_FULL);
|
| +
|
| + // Enables partial screen magnifier and confirms observer is invoked.
|
| + observed_ = false;
|
| + SetScreenManagnifierTypeToPref(ash::MAGNIFIER_PARTIAL);
|
| + EXPECT_TRUE(observed_);
|
| + EXPECT_EQ(observed_type_, ash::MAGNIFIER_PARTIAL);
|
| + CheckCurrentMagnifierType(ash::MAGNIFIER_PARTIAL);
|
| +
|
| + // Disables magnifier again and confirms observer is invoked.
|
| + observed_ = false;
|
| + SetScreenManagnifierTypeToPref(ash::MAGNIFIER_OFF);
|
| + EXPECT_TRUE(observed_);
|
| + EXPECT_EQ(observed_type_, ash::MAGNIFIER_OFF);
|
| + CheckCurrentMagnifierType(ash::MAGNIFIER_OFF);
|
| +}
|
| +
|
| } // namespace chromeos
|
|
|