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

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

Issue 23967015: Use multi-profile mount point by default after browser crash and in Guest session. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix ProfileManagerTest,InputMethodPersistenceTest Created 7 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
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/input_method_persistence.h" 5 #include "chrome/browser/chromeos/input_method/input_method_persistence.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "chrome/browser/chromeos/input_method/mock_input_method_manager.h" 9 #include "chrome/browser/chromeos/input_method/mock_input_method_manager.h"
10 #include "chrome/browser/chromeos/language_preferences.h" 10 #include "chrome/browser/chromeos/language_preferences.h"
11 #include "chrome/browser/profiles/profile_manager.h" 11 #include "chrome/browser/profiles/profile_manager.h"
12 #include "chrome/common/chrome_constants.h"
12 #include "chrome/common/chrome_switches.h" 13 #include "chrome/common/chrome_switches.h"
13 #include "chrome/common/pref_names.h" 14 #include "chrome/common/pref_names.h"
14 #include "chrome/test/base/testing_browser_process.h" 15 #include "chrome/test/base/testing_browser_process.h"
15 #include "chrome/test/base/testing_pref_service_syncable.h" 16 #include "chrome/test/base/testing_pref_service_syncable.h"
16 #include "chrome/test/base/testing_profile.h" 17 #include "chrome/test/base/testing_profile.h"
17 #include "chrome/test/base/testing_profile_manager.h" 18 #include "chrome/test/base/testing_profile_manager.h"
18 #include "chromeos/chromeos_switches.h" 19 #include "chromeos/chromeos_switches.h"
19 20
20 #include "testing/gtest/include/gtest/gtest.h" 21 #include "testing/gtest/include/gtest/gtest.h"
21 22
22 namespace chromeos { 23 namespace chromeos {
23 namespace input_method { 24 namespace input_method {
24 25
25 namespace { 26 namespace {
26 const char kInputId1[] = "xkb:us:dvorak:eng"; 27 const char kInputId1[] = "xkb:us:dvorak:eng";
27 const char kInputId2[] = "xkb:us:colemak:eng"; 28 const char kInputId2[] = "xkb:us:colemak:eng";
28 const char kProfileName[] = "input_method_test";
29 } 29 }
30 30
31 class InputMethodPersistenceTest : public testing::Test { 31 class InputMethodPersistenceTest : public testing::Test {
32 protected: 32 protected:
33 InputMethodPersistenceTest() 33 InputMethodPersistenceTest()
34 : mock_profile_manager_(TestingBrowserProcess::GetGlobal()) {} 34 : mock_profile_manager_(TestingBrowserProcess::GetGlobal()) {}
35 35
36 virtual void SetUp() OVERRIDE { 36 virtual void SetUp() OVERRIDE {
37 // Set up a profile that will be returned by 37 // Set up a profile that will be returned by
38 // ProfileManager::GetDefaultProfile(). 38 // ProfileManager::GetDefaultProfile().
39 ASSERT_TRUE(mock_profile_manager_.SetUp()); 39 ASSERT_TRUE(mock_profile_manager_.SetUp());
40 TestingProfile* mock_profile = 40 TestingProfile* mock_profile =
41 mock_profile_manager_.CreateTestingProfile(kProfileName); 41 mock_profile_manager_.CreateTestingProfile(chrome::kTestUserProfileDir);
42 CommandLine *cl = CommandLine::ForCurrentProcess(); 42 CommandLine *cl = CommandLine::ForCurrentProcess();
43 cl->AppendSwitchASCII(switches::kLoginProfile, kProfileName); 43 cl->AppendSwitchASCII(switches::kLoginProfile, chrome::kTestUserProfileDir);
44 mock_profile_manager_.SetLoggedIn(true); 44 mock_profile_manager_.SetLoggedIn(true);
45 ProfileManager::AllowGetDefaultProfile(); 45 ProfileManager::AllowGetDefaultProfile();
46 EXPECT_TRUE(ProfileManager::GetDefaultProfile() != NULL); 46 EXPECT_TRUE(ProfileManager::GetDefaultProfile() != NULL);
47 mock_user_prefs_ = mock_profile->GetTestingPrefService(); 47 mock_user_prefs_ = mock_profile->GetTestingPrefService();
48 } 48 }
49 49
50 // Verifies that the user and system prefs contain the expected values. 50 // Verifies that the user and system prefs contain the expected values.
51 void VerifyPrefs(const std::string& current_input_method, 51 void VerifyPrefs(const std::string& current_input_method,
52 const std::string& previous_input_method, 52 const std::string& previous_input_method,
53 const std::string& preferred_keyboard_layout) { 53 const std::string& preferred_keyboard_layout) {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 VerifyPrefs(kInputId2, "", kInputId2); 102 VerifyPrefs(kInputId2, "", kInputId2);
103 103
104 persistence.OnSessionStateChange(InputMethodManager::STATE_BROWSER_SCREEN); 104 persistence.OnSessionStateChange(InputMethodManager::STATE_BROWSER_SCREEN);
105 mock_manager_.SetCurrentInputMethodId(kInputId1); 105 mock_manager_.SetCurrentInputMethodId(kInputId1);
106 persistence.InputMethodChanged(&mock_manager_, false); 106 persistence.InputMethodChanged(&mock_manager_, false);
107 VerifyPrefs(kInputId1, kInputId2, kInputId2); 107 VerifyPrefs(kInputId1, kInputId2, kInputId2);
108 } 108 }
109 109
110 } // namespace input_method 110 } // namespace input_method
111 } // namespace chromeos 111 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/chrome_browser_main_chromeos.cc ('k') | chrome/browser/chromeos/login/user_manager_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698