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

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

Issue 166273014: Remove dependency on NotificationService for cros a11y settings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge ToT. Created 6 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/accessibility/magnification_manager_unittest.cc
diff --git a/chrome/browser/chromeos/accessibility/magnification_manager_unittest.cc b/chrome/browser/chromeos/accessibility/magnification_manager_unittest.cc
index 864af45231d9db2893d614aebb7d93e3f7d7da07..02f07e39890593396a94a21538d02b2a466e30c5 100644
--- a/chrome/browser/chromeos/accessibility/magnification_manager_unittest.cc
+++ b/chrome/browser/chromeos/accessibility/magnification_manager_unittest.cc
@@ -7,55 +7,13 @@
#include "ash/magnifier/magnifier_constants.h"
#include "ash/test/ash_test_base.h"
#include "base/prefs/pref_service.h"
-#include "chrome/browser/chrome_notification_types.h"
#include "chrome/common/pref_names.h"
#include "chrome/test/base/testing_profile.h"
-#include "content/public/browser/notification_service.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace chromeos {
namespace {
-class MockMagnificationObserver : public content::NotificationObserver {
- public:
- MockMagnificationObserver() : observed_(false),
- observed_enabled_(false),
- observed_type_(ash::kDefaultMagnifierType) {
- registrar_.Add(
- this,
- chrome::NOTIFICATION_CROS_ACCESSIBILITY_TOGGLE_SCREEN_MAGNIFIER,
- content::NotificationService::AllSources());
- }
-
- bool observed() const { return observed_; }
- bool observed_enabled() const { return observed_enabled_; }
- ash::MagnifierType observed_type() const { return observed_type_; }
-
- void reset() { observed_ = false; }
-
- private:
- // content::NotificationObserver implimentation:
- virtual void Observe(int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) OVERRIDE {
- switch (type) {
- case chrome::NOTIFICATION_CROS_ACCESSIBILITY_TOGGLE_SCREEN_MAGNIFIER:
- AccessibilityStatusEventDetails* accessibility_status =
- content::Details<AccessibilityStatusEventDetails>(details).ptr();
-
- observed_ = true;
- observed_enabled_ = accessibility_status->enabled;
- observed_type_ = accessibility_status->magnifier_type;
- }
- }
-
- bool observed_;
- bool observed_enabled_;
- ash::MagnifierType observed_type_;
-
- content::NotificationRegistrar registrar_;
-};
-
void EnableMagnifier() {
return MagnificationManager::Get()->SetMagnifierEnabled(true);
}
@@ -98,27 +56,6 @@ class MagnificationManagerTest : public ash::test::AshTestBase {
TestingProfile profile_;
};
-TEST_F(MagnificationManagerTest, MagnificationObserver) {
- MockMagnificationObserver observer;
-
- EXPECT_FALSE(observer.observed());
-
- // Set full screen magnifier, and confirm the observer is called.
- EnableMagnifier();
- SetMagnifierType(ash::MAGNIFIER_FULL);
- EXPECT_TRUE(observer.observed());
- EXPECT_TRUE(observer.observed_enabled());
- EXPECT_EQ(observer.observed_type(), ash::MAGNIFIER_FULL);
- EXPECT_EQ(GetMagnifierType(), ash::MAGNIFIER_FULL);
- observer.reset();
-
- // Set full screen magnifier again, and confirm the observer is not called.
- SetMagnifierType(ash::MAGNIFIER_FULL);
- EXPECT_FALSE(observer.observed());
- EXPECT_EQ(GetMagnifierType(), ash::MAGNIFIER_FULL);
- observer.reset();
-}
-
TEST_F(MagnificationManagerTest, ChangeType) {
// Set full screen magnifier, and confirm the status is set successfully.
EnableMagnifier();

Powered by Google App Engine
This is Rietveld 408576698