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

Side by Side Diff: chrome/browser/chromeos/input_method/browser_state_monitor_unittest.cc

Issue 11316163: Remove the last usages of PrefObserver outside of Prefs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address review comments. 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/input_method/browser_state_monitor.h" 5 #include "chrome/browser/chromeos/input_method/browser_state_monitor.h"
6 6
7 #include "chrome/browser/api/prefs/pref_member.h" 7 #include "chrome/browser/api/prefs/pref_member.h"
8 #include "chrome/browser/chromeos/input_method/mock_input_method_manager.h" 8 #include "chrome/browser/chromeos/input_method/mock_input_method_manager.h"
9 #include "chrome/common/chrome_notification_types.h" 9 #include "chrome/common/chrome_notification_types.h"
10 #include "chrome/common/pref_names.h" 10 #include "chrome/common/pref_names.h"
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 } 308 }
309 309
310 TEST(BrowserStateMonitorTest, TestUpdatePrefOnBrowserScreenDetails) { 310 TEST(BrowserStateMonitorTest, TestUpdatePrefOnBrowserScreenDetails) {
311 TestingPrefService prefs; 311 TestingPrefService prefs;
312 RegisterTestPrefs(&prefs); 312 RegisterTestPrefs(&prefs);
313 MockInputMethodManager mock_manager; 313 MockInputMethodManager mock_manager;
314 TestableBrowserStateMonitor monitor(&mock_manager); 314 TestableBrowserStateMonitor monitor(&mock_manager);
315 monitor.SetPrefServiceForTesting(&prefs); 315 monitor.SetPrefServiceForTesting(&prefs);
316 316
317 StringPrefMember previous; 317 StringPrefMember previous;
318 previous.Init(prefs::kLanguagePreviousInputMethod, &prefs, NULL); 318 previous.Init(prefs::kLanguagePreviousInputMethod, &prefs);
319 EXPECT_EQ("", previous.GetValue()); 319 EXPECT_EQ("", previous.GetValue());
320 StringPrefMember current; 320 StringPrefMember current;
321 current.Init(prefs::kLanguageCurrentInputMethod, &prefs, NULL); 321 current.Init(prefs::kLanguageCurrentInputMethod, &prefs);
322 EXPECT_EQ("", current.GetValue()); 322 EXPECT_EQ("", current.GetValue());
323 323
324 monitor.Observe(chrome::NOTIFICATION_LOGIN_USER_CHANGED, 324 monitor.Observe(chrome::NOTIFICATION_LOGIN_USER_CHANGED,
325 content::NotificationService::AllSources(), 325 content::NotificationService::AllSources(),
326 content::NotificationService::NoDetails()); 326 content::NotificationService::NoDetails());
327 EXPECT_EQ(InputMethodManager::STATE_BROWSER_SCREEN, monitor.state()); 327 EXPECT_EQ(InputMethodManager::STATE_BROWSER_SCREEN, monitor.state());
328 monitor.Observe(chrome::NOTIFICATION_SESSION_STARTED, 328 monitor.Observe(chrome::NOTIFICATION_SESSION_STARTED,
329 content::NotificationService::AllSources(), 329 content::NotificationService::AllSources(),
330 content::NotificationService::NoDetails()); 330 content::NotificationService::NoDetails());
331 EXPECT_EQ(InputMethodManager::STATE_BROWSER_SCREEN, monitor.state()); 331 EXPECT_EQ(InputMethodManager::STATE_BROWSER_SCREEN, monitor.state());
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 monitor.InputMethodChanged(&mock_manager, false); 367 monitor.InputMethodChanged(&mock_manager, false);
368 EXPECT_EQ(0, monitor.update_local_state_count()); 368 EXPECT_EQ(0, monitor.update_local_state_count());
369 EXPECT_EQ(5, monitor.update_user_pref_count()); 369 EXPECT_EQ(5, monitor.update_user_pref_count());
370 EXPECT_EQ(input_method_id_3, monitor.last_user_pref()); 370 EXPECT_EQ(input_method_id_3, monitor.last_user_pref());
371 EXPECT_EQ(input_method_id_2, previous.GetValue()); 371 EXPECT_EQ(input_method_id_2, previous.GetValue());
372 EXPECT_EQ(input_method_id_3, current.GetValue()); 372 EXPECT_EQ(input_method_id_3, current.GetValue());
373 } 373 }
374 374
375 } // namespace input_method 375 } // namespace input_method
376 } // namespace chromeos 376 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/autofill/autocomplete_history_manager.cc ('k') | chrome/browser/chromeos/login/login_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698