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

Side by Side Diff: chrome/browser/chromeos/accessibility/accessibility_manager_browsertest.cc

Issue 419293002: IME refactoring: ChromeOS introduce input methods State. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Unit test fixed. Re-sorted methods of StateImpl and IMM. Created 6 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h" 5 #include "chrome/browser/chromeos/accessibility/accessibility_manager.h"
6 6
7 #include "ash/magnifier/magnification_controller.h" 7 #include "ash/magnifier/magnification_controller.h"
8 #include "ash/shell.h" 8 #include "ash/shell.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
11 #include "chrome/browser/browser_process.h" 11 #include "chrome/browser/browser_process.h"
12 #include "chrome/browser/chrome_notification_types.h" 12 #include "chrome/browser/chrome_notification_types.h"
13 #include "chrome/browser/chromeos/accessibility/magnification_manager.h" 13 #include "chrome/browser/chromeos/accessibility/magnification_manager.h"
14 #include "chrome/browser/chromeos/login/helper.h" 14 #include "chrome/browser/chromeos/login/helper.h"
15 #include "chrome/browser/chromeos/login/login_utils.h" 15 #include "chrome/browser/chromeos/login/login_utils.h"
16 #include "chrome/browser/chromeos/login/session/user_session_manager.h"
16 #include "chrome/browser/chromeos/preferences.h" 17 #include "chrome/browser/chromeos/preferences.h"
17 #include "chrome/browser/chromeos/profiles/profile_helper.h" 18 #include "chrome/browser/chromeos/profiles/profile_helper.h"
18 #include "chrome/browser/extensions/api/braille_display_private/mock_braille_con troller.h" 19 #include "chrome/browser/extensions/api/braille_display_private/mock_braille_con troller.h"
19 #include "chrome/browser/prefs/pref_service_syncable.h" 20 #include "chrome/browser/prefs/pref_service_syncable.h"
20 #include "chrome/browser/profiles/profile.h" 21 #include "chrome/browser/profiles/profile.h"
21 #include "chrome/browser/profiles/profile_manager.h" 22 #include "chrome/browser/profiles/profile_manager.h"
22 #include "chrome/common/extensions/extension_constants.h" 23 #include "chrome/common/extensions/extension_constants.h"
23 #include "chrome/common/pref_names.h" 24 #include "chrome/common/pref_names.h"
24 #include "chrome/test/base/in_process_browser_test.h" 25 #include "chrome/test/base/in_process_browser_test.h"
25 #include "chrome/test/base/testing_profile.h" 26 #include "chrome/test/base/testing_profile.h"
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 return GetPrefs()->GetBoolean(prefs::kAccessibilityAutoclickEnabled); 197 return GetPrefs()->GetBoolean(prefs::kAccessibilityAutoclickEnabled);
197 } 198 }
198 199
199 int GetAutoclickDelayFromPref() { 200 int GetAutoclickDelayFromPref() {
200 return GetPrefs()->GetInteger(prefs::kAccessibilityAutoclickDelayMs); 201 return GetPrefs()->GetInteger(prefs::kAccessibilityAutoclickDelayMs);
201 } 202 }
202 203
203 bool IsBrailleImeActive() { 204 bool IsBrailleImeActive() {
204 InputMethodManager* imm = InputMethodManager::Get(); 205 InputMethodManager* imm = InputMethodManager::Get();
205 scoped_ptr<InputMethodDescriptors> descriptors = 206 scoped_ptr<InputMethodDescriptors> descriptors =
206 imm->GetActiveInputMethods(); 207 imm->GetActiveIMEState()->GetActiveInputMethods();
207 for (InputMethodDescriptors::const_iterator i = descriptors->begin(); 208 for (InputMethodDescriptors::const_iterator i = descriptors->begin();
208 i != descriptors->end(); 209 i != descriptors->end();
209 ++i) { 210 ++i) {
210 if (i->id() == extension_misc::kBrailleImeEngineId) 211 if (i->id() == extension_misc::kBrailleImeEngineId)
211 return true; 212 return true;
212 } 213 }
213 return false; 214 return false;
214 } 215 }
215 216
216 bool IsBrailleImeCurrent() { 217 bool IsBrailleImeCurrent() {
217 InputMethodManager* imm = InputMethodManager::Get(); 218 InputMethodManager* imm = InputMethodManager::Get();
218 return imm->GetCurrentInputMethod().id() == 219 return imm->GetActiveIMEState()->GetCurrentInputMethod().id() ==
219 extension_misc::kBrailleImeEngineId; 220 extension_misc::kBrailleImeEngineId;
220 } 221 }
221 } // anonymous namespace 222 } // anonymous namespace
222 223
223 class AccessibilityManagerTest : public InProcessBrowserTest { 224 class AccessibilityManagerTest : public InProcessBrowserTest {
224 protected: 225 protected:
225 AccessibilityManagerTest() : default_autoclick_delay_(0) {} 226 AccessibilityManagerTest() : default_autoclick_delay_(0) {}
226 virtual ~AccessibilityManagerTest() {} 227 virtual ~AccessibilityManagerTest() {}
227 228
228 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { 229 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 IN_PROC_BROWSER_TEST_P(AccessibilityManagerUserTypeTest, BrailleWhenLoggedIn) { 623 IN_PROC_BROWSER_TEST_P(AccessibilityManagerUserTypeTest, BrailleWhenLoggedIn) {
623 // Logs in. 624 // Logs in.
624 const char* user_name = GetParam(); 625 const char* user_name = GetParam();
625 user_manager::UserManager::Get()->UserLoggedIn(user_name, user_name, true); 626 user_manager::UserManager::Get()->UserLoggedIn(user_name, user_name, true);
626 user_manager::UserManager::Get()->SessionStarted(); 627 user_manager::UserManager::Get()->SessionStarted();
627 // This object watches for IME preference changes and reflects those in 628 // This object watches for IME preference changes and reflects those in
628 // the IME framework state. 629 // the IME framework state.
629 chromeos::Preferences prefs; 630 chromeos::Preferences prefs;
630 prefs.InitUserPrefsForTesting( 631 prefs.InitUserPrefsForTesting(
631 PrefServiceSyncable::FromProfile(GetProfile()), 632 PrefServiceSyncable::FromProfile(GetProfile()),
632 user_manager::UserManager::Get()->GetActiveUser()); 633 user_manager::UserManager::Get()->GetActiveUser(),
634 UserSessionManager::GetInstance()->GetDefaultIMEState(GetProfile()));
633 635
634 // Make sure we start in the expected state. 636 // Make sure we start in the expected state.
635 EXPECT_FALSE(IsBrailleImeActive()); 637 EXPECT_FALSE(IsBrailleImeActive());
636 EXPECT_FALSE(IsSpokenFeedbackEnabled()); 638 EXPECT_FALSE(IsSpokenFeedbackEnabled());
637 639
638 // Signal the accessibility manager that a braille display was connected. 640 // Signal the accessibility manager that a braille display was connected.
639 SetBrailleDisplayAvailability(true); 641 SetBrailleDisplayAvailability(true);
640 642
641 // Now, both spoken feedback and the Braille IME should be enabled. 643 // Now, both spoken feedback and the Braille IME should be enabled.
642 EXPECT_TRUE(IsSpokenFeedbackEnabled()); 644 EXPECT_TRUE(IsSpokenFeedbackEnabled());
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
703 EXPECT_FALSE(ShouldShowAccessibilityMenu()); 705 EXPECT_FALSE(ShouldShowAccessibilityMenu());
704 706
705 // Check on-screen keyboard. 707 // Check on-screen keyboard.
706 SetVirtualKeyboardEnabled(true); 708 SetVirtualKeyboardEnabled(true);
707 EXPECT_TRUE(ShouldShowAccessibilityMenu()); 709 EXPECT_TRUE(ShouldShowAccessibilityMenu());
708 SetVirtualKeyboardEnabled(false); 710 SetVirtualKeyboardEnabled(false);
709 EXPECT_FALSE(ShouldShowAccessibilityMenu()); 711 EXPECT_FALSE(ShouldShowAccessibilityMenu());
710 } 712 }
711 713
712 } // namespace chromeos 714 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/accessibility/accessibility_manager.cc ('k') | chrome/browser/chromeos/base/locale_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698