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

Side by Side Diff: chrome/browser/chromeos/preferences_unittest.cc

Issue 12662032: Merge SavePackageFilePicker{,ChromeOS} (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: @r197032 Created 7 years, 7 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 | 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/preferences.h" 5 #include "chrome/browser/chromeos/preferences.h"
6 6
7 #include "base/prefs/pref_member.h" 7 #include "base/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/browser/download/chrome_download_manager_delegate.h"
10 #include "chrome/browser/download/download_prefs.h" 9 #include "chrome/browser/download/download_prefs.h"
11 #include "chrome/common/pref_names.h" 10 #include "chrome/common/pref_names.h"
12 #include "chrome/test/base/testing_pref_service_syncable.h" 11 #include "chrome/test/base/testing_pref_service_syncable.h"
13 #include "components/user_prefs/pref_registry_syncable.h" 12 #include "components/user_prefs/pref_registry_syncable.h"
14 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
15 14
16 namespace chromeos { 15 namespace chromeos {
17 namespace { 16 namespace {
18 17
19 class MyMockInputMethodManager : public input_method::MockInputMethodManager { 18 class MyMockInputMethodManager : public input_method::MockInputMethodManager {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 StringPrefMember* previous_; 51 StringPrefMember* previous_;
53 StringPrefMember* current_; 52 StringPrefMember* current_;
54 }; 53 };
55 54
56 } // anonymous namespace 55 } // anonymous namespace
57 56
58 TEST(PreferencesTest, TestUpdatePrefOnBrowserScreenDetails) { 57 TEST(PreferencesTest, TestUpdatePrefOnBrowserScreenDetails) {
59 TestingPrefServiceSyncable prefs; 58 TestingPrefServiceSyncable prefs;
60 Preferences::RegisterUserPrefs(prefs.registry()); 59 Preferences::RegisterUserPrefs(prefs.registry());
61 DownloadPrefs::RegisterUserPrefs(prefs.registry()); 60 DownloadPrefs::RegisterUserPrefs(prefs.registry());
62 ChromeDownloadManagerDelegate::RegisterUserPrefs(prefs.registry());
63 // kSelectFileLastDirectory is registered for Profile. Here we register it for 61 // kSelectFileLastDirectory is registered for Profile. Here we register it for
64 // testing. 62 // testing.
65 prefs.registry()->RegisterStringPref(prefs::kSelectFileLastDirectory, 63 prefs.registry()->RegisterStringPref(prefs::kSelectFileLastDirectory,
66 std::string(), 64 std::string(),
67 PrefRegistrySyncable::UNSYNCABLE_PREF); 65 PrefRegistrySyncable::UNSYNCABLE_PREF);
68 66
69 StringPrefMember previous; 67 StringPrefMember previous;
70 previous.Init(prefs::kLanguagePreviousInputMethod, &prefs); 68 previous.Init(prefs::kLanguagePreviousInputMethod, &prefs);
71 previous.SetValue("KeyboardA"); 69 previous.SetValue("KeyboardA");
72 StringPrefMember current; 70 StringPrefMember current;
73 current.Init(prefs::kLanguageCurrentInputMethod, &prefs); 71 current.Init(prefs::kLanguageCurrentInputMethod, &prefs);
74 current.SetValue("KeyboardB"); 72 current.SetValue("KeyboardB");
75 73
76 MyMockInputMethodManager mock_manager(&previous, &current); 74 MyMockInputMethodManager mock_manager(&previous, &current);
77 Preferences testee(&mock_manager); 75 Preferences testee(&mock_manager);
78 testee.InitUserPrefsForTesting(&prefs); 76 testee.InitUserPrefsForTesting(&prefs);
79 testee.SetInputMethodListForTesting(); 77 testee.SetInputMethodListForTesting();
80 78
81 // Confirm they're unchanged. 79 // Confirm they're unchanged.
82 EXPECT_EQ("KeyboardA", previous.GetValue()); 80 EXPECT_EQ("KeyboardA", previous.GetValue());
83 EXPECT_EQ("KeyboardB", current.GetValue()); 81 EXPECT_EQ("KeyboardB", current.GetValue());
84 EXPECT_EQ("KeyboardB", mock_manager.last_input_method_id_); 82 EXPECT_EQ("KeyboardB", mock_manager.last_input_method_id_);
85 } 83 }
86 84
87 } // namespace chromeos 85 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698