This source file includes following definitions.
- EnableMagnifier
- DisableMagnifier
- IsMagnifierEnabled
- GetMagnifierType
- SetMagnifierType
- SetUp
- TearDown
- TEST_F
#include "chrome/browser/chromeos/accessibility/magnification_manager.h"
#include "ash/magnifier/magnifier_constants.h"
#include "ash/test/ash_test_base.h"
#include "base/prefs/pref_service.h"
#include "chrome/common/pref_names.h"
#include "chrome/test/base/testing_profile.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace chromeos {
namespace {
void EnableMagnifier() {
return MagnificationManager::Get()->SetMagnifierEnabled(true);
}
void DisableMagnifier() {
return MagnificationManager::Get()->SetMagnifierEnabled(false);
}
bool IsMagnifierEnabled() {
return MagnificationManager::Get()->IsMagnifierEnabled();
}
ash::MagnifierType GetMagnifierType() {
return MagnificationManager::Get()->GetMagnifierType();
}
void SetMagnifierType(ash::MagnifierType type) {
return MagnificationManager::Get()->SetMagnifierType(type);
}
}
class MagnificationManagerTest : public ash::test::AshTestBase {
public:
MagnificationManagerTest() {
}
virtual void SetUp() OVERRIDE {
ash::test::AshTestBase::SetUp();
MagnificationManager::Initialize();
ASSERT_TRUE(MagnificationManager::Get());
MagnificationManager::Get()->SetProfileForTest(&profile_);
}
virtual void TearDown() OVERRIDE {
MagnificationManager::Shutdown();
ash::test::AshTestBase::TearDown();
}
TestingProfile profile_;
};
TEST_F(MagnificationManagerTest, ChangeType) {
EnableMagnifier();
SetMagnifierType(ash::MAGNIFIER_FULL);
EXPECT_TRUE(IsMagnifierEnabled());
EXPECT_EQ(GetMagnifierType(), ash::MAGNIFIER_FULL);
SetMagnifierType(ash::MAGNIFIER_PARTIAL);
EXPECT_TRUE(IsMagnifierEnabled());
EXPECT_EQ(GetMagnifierType(), ash::MAGNIFIER_FULL);
DisableMagnifier();
EXPECT_FALSE(IsMagnifierEnabled());
EXPECT_EQ(GetMagnifierType(), ash::MAGNIFIER_FULL);
}
}