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

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

Issue 10880061: UMA stats to track drive as default download destination. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix crash in unit test Created 8 years, 3 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
« no previous file with comments | « chrome/browser/chromeos/preferences.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "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/browser/download/download_prefs.h"
9 #include "chrome/common/pref_names.h" 10 #include "chrome/common/pref_names.h"
10 #include "chrome/test/base/testing_pref_service.h" 11 #include "chrome/test/base/testing_pref_service.h"
11 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
12 13
13 namespace chromeos { 14 namespace chromeos {
14 namespace { 15 namespace {
15 16
16 class MyMockInputMethodManager : public input_method::MockInputMethodManager { 17 class MyMockInputMethodManager : public input_method::MockInputMethodManager {
17 public: 18 public:
18 MyMockInputMethodManager(StringPrefMember* previous, 19 MyMockInputMethodManager(StringPrefMember* previous,
(...skipping 29 matching lines...) Expand all
48 private: 49 private:
49 StringPrefMember* previous_; 50 StringPrefMember* previous_;
50 StringPrefMember* current_; 51 StringPrefMember* current_;
51 }; 52 };
52 53
53 } // anonymous namespace 54 } // anonymous namespace
54 55
55 TEST(PreferencesTest, TestUpdatePrefOnBrowserScreenDetails) { 56 TEST(PreferencesTest, TestUpdatePrefOnBrowserScreenDetails) {
56 TestingPrefService prefs; 57 TestingPrefService prefs;
57 Preferences::RegisterUserPrefs(&prefs); 58 Preferences::RegisterUserPrefs(&prefs);
59 DownloadPrefs::RegisterUserPrefs(&prefs);
58 60
59 StringPrefMember previous; 61 StringPrefMember previous;
60 previous.Init(prefs::kLanguagePreviousInputMethod, &prefs, NULL); 62 previous.Init(prefs::kLanguagePreviousInputMethod, &prefs, NULL);
61 previous.SetValue("KeyboardA"); 63 previous.SetValue("KeyboardA");
62 StringPrefMember current; 64 StringPrefMember current;
63 current.Init(prefs::kLanguageCurrentInputMethod, &prefs, NULL); 65 current.Init(prefs::kLanguageCurrentInputMethod, &prefs, NULL);
64 current.SetValue("KeyboardB"); 66 current.SetValue("KeyboardB");
65 67
66 MyMockInputMethodManager mock_manager(&previous, &current); 68 MyMockInputMethodManager mock_manager(&previous, &current);
67 Preferences testee(&mock_manager); 69 Preferences testee(&mock_manager);
68 testee.InitUserPrefsForTesting(&prefs); 70 testee.InitUserPrefsForTesting(&prefs);
69 testee.SetInputMethodListForTesting(); 71 testee.SetInputMethodListForTesting();
70 72
71 // Confirm they're unchanged. 73 // Confirm they're unchanged.
72 EXPECT_EQ("KeyboardA", previous.GetValue()); 74 EXPECT_EQ("KeyboardA", previous.GetValue());
73 EXPECT_EQ("KeyboardB", current.GetValue()); 75 EXPECT_EQ("KeyboardB", current.GetValue());
74 EXPECT_EQ("KeyboardB", mock_manager.last_input_method_id_); 76 EXPECT_EQ("KeyboardB", mock_manager.last_input_method_id_);
75 } 77 }
76 78
77 } // namespace chromeos 79 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/preferences.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698