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

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

Issue 223823004: Improving the user transition to add special cases for maximized windows and make the transition "m… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed preferences browser test [disabling animations] Created 6 years, 8 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <sys/types.h> 5 #include <sys/types.h>
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/macros.h" 9 #include "base/macros.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/chromeos/input_method/input_method_manager_impl.h" 12 #include "chrome/browser/chromeos/input_method/input_method_manager_impl.h"
13 #include "chrome/browser/chromeos/login/login_manager_test.h" 13 #include "chrome/browser/chromeos/login/login_manager_test.h"
14 #include "chrome/browser/chromeos/login/startup_utils.h" 14 #include "chrome/browser/chromeos/login/startup_utils.h"
15 #include "chrome/browser/chromeos/login/user_adding_screen.h" 15 #include "chrome/browser/chromeos/login/user_adding_screen.h"
16 #include "chrome/browser/chromeos/preferences.h" 16 #include "chrome/browser/chromeos/preferences.h"
17 #include "chrome/browser/chromeos/settings/cros_settings.h" 17 #include "chrome/browser/chromeos/settings/cros_settings.h"
18 #include "chrome/browser/chromeos/settings/stub_cros_settings_provider.h" 18 #include "chrome/browser/chromeos/settings/stub_cros_settings_provider.h"
19 #include "chrome/browser/chromeos/system/fake_input_device_settings.h" 19 #include "chrome/browser/chromeos/system/fake_input_device_settings.h"
20 #include "chrome/browser/feedback/tracing_manager.h" 20 #include "chrome/browser/feedback/tracing_manager.h"
21 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h"
21 #include "chrome/common/chrome_switches.h" 22 #include "chrome/common/chrome_switches.h"
22 #include "chrome/common/pref_names.h" 23 #include "chrome/common/pref_names.h"
23 #include "chromeos/chromeos_switches.h" 24 #include "chromeos/chromeos_switches.h"
24 #include "chromeos/ime/fake_xkeyboard.h" 25 #include "chromeos/ime/fake_xkeyboard.h"
25 #include "content/public/test/test_utils.h" 26 #include "content/public/test/test_utils.h"
26 #include "testing/gtest/include/gtest/gtest.h" 27 #include "testing/gtest/include/gtest/gtest.h"
27 #include "ui/events/event_utils.h" 28 #include "ui/events/event_utils.h"
28 29
29 namespace chromeos { 30 namespace chromeos {
30 31
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 } 109 }
109 110
110 void CheckLocalStateCorrespondsToPrefs(PrefService* prefs) { 111 void CheckLocalStateCorrespondsToPrefs(PrefService* prefs) {
111 PrefService* local_state = g_browser_process->local_state(); 112 PrefService* local_state = g_browser_process->local_state();
112 EXPECT_EQ(local_state->GetBoolean(prefs::kOwnerTapToClickEnabled), 113 EXPECT_EQ(local_state->GetBoolean(prefs::kOwnerTapToClickEnabled),
113 prefs->GetBoolean(prefs::kTapToClickEnabled)); 114 prefs->GetBoolean(prefs::kTapToClickEnabled));
114 EXPECT_EQ(local_state->GetBoolean(prefs::kOwnerPrimaryMouseButtonRight), 115 EXPECT_EQ(local_state->GetBoolean(prefs::kOwnerPrimaryMouseButtonRight),
115 prefs->GetBoolean(prefs::kPrimaryMouseButtonRight)); 116 prefs->GetBoolean(prefs::kPrimaryMouseButtonRight));
116 } 117 }
117 118
119 void DisableAnimations() {
120 // Disable animations for user transitions.
121 chrome::MultiUserWindowManagerChromeOS* manager =
122 static_cast<chrome::MultiUserWindowManagerChromeOS*>(
123 chrome::MultiUserWindowManager::GetInstance());
124 manager->SetAnimationsForTest(true);
125 }
126
118 private: 127 private:
119 system::FakeInputDeviceSettings* input_settings_; 128 system::FakeInputDeviceSettings* input_settings_;
120 input_method::FakeXKeyboard* xkeyboard_; 129 input_method::FakeXKeyboard* xkeyboard_;
121 130
122 DISALLOW_COPY_AND_ASSIGN(PreferencesTest); 131 DISALLOW_COPY_AND_ASSIGN(PreferencesTest);
123 }; 132 };
124 133
125 IN_PROC_BROWSER_TEST_F(PreferencesTest, PRE_MultiProfiles) { 134 IN_PROC_BROWSER_TEST_F(PreferencesTest, PRE_MultiProfiles) {
126 RegisterUser(kTestUsers[0]); 135 RegisterUser(kTestUsers[0]);
127 RegisterUser(kTestUsers[1]); 136 RegisterUser(kTestUsers[1]);
(...skipping 19 matching lines...) Expand all
147 EXPECT_TRUE(user1->is_active()); 156 EXPECT_TRUE(user1->is_active());
148 const User* user2 = user_manager->FindUser(kTestUsers[1]); 157 const User* user2 = user_manager->FindUser(kTestUsers[1]);
149 PrefService* prefs2 = user_manager->GetProfileByUser(user2)->GetPrefs(); 158 PrefService* prefs2 = user_manager->GetProfileByUser(user2)->GetPrefs();
150 SetPrefs(prefs2, true); 159 SetPrefs(prefs2, true);
151 160
152 // First user is still active, so settings was not changed. 161 // First user is still active, so settings was not changed.
153 EXPECT_TRUE(user1->is_active()); 162 EXPECT_TRUE(user1->is_active());
154 CheckSettingsCorrespondToPrefs(prefs1); 163 CheckSettingsCorrespondToPrefs(prefs1);
155 164
156 // Switch user and check that settings was changed accordingly. 165 // Switch user and check that settings was changed accordingly.
166 DisableAnimations();
157 user_manager->SwitchActiveUser(kTestUsers[1]); 167 user_manager->SwitchActiveUser(kTestUsers[1]);
158 EXPECT_TRUE(user2->is_active()); 168 EXPECT_TRUE(user2->is_active());
159 CheckSettingsCorrespondToPrefs(prefs2); 169 CheckSettingsCorrespondToPrefs(prefs2);
160 170
161 // Check that changing prefs of the active user doesn't affect prefs of the 171 // Check that changing prefs of the active user doesn't affect prefs of the
162 // inactive user. 172 // inactive user.
163 scoped_ptr<base::DictionaryValue> prefs_backup = 173 scoped_ptr<base::DictionaryValue> prefs_backup =
164 prefs1->GetPreferenceValues(); 174 prefs1->GetPreferenceValues();
165 SetPrefs(prefs2, false); 175 SetPrefs(prefs2, false);
166 CheckSettingsCorrespondToPrefs(prefs2); 176 CheckSettingsCorrespondToPrefs(prefs2);
(...skipping 23 matching lines...) Expand all
190 !prefs1->GetBoolean(prefs::kTapToClickEnabled)); 200 !prefs1->GetBoolean(prefs::kTapToClickEnabled));
191 CheckLocalStateCorrespondsToPrefs(prefs1); 201 CheckLocalStateCorrespondsToPrefs(prefs1);
192 202
193 // Switch user back. 203 // Switch user back.
194 user_manager->SwitchActiveUser(kTestUsers[0]); 204 user_manager->SwitchActiveUser(kTestUsers[0]);
195 CheckSettingsCorrespondToPrefs(prefs1); 205 CheckSettingsCorrespondToPrefs(prefs1);
196 CheckLocalStateCorrespondsToPrefs(prefs1); 206 CheckLocalStateCorrespondsToPrefs(prefs1);
197 } 207 }
198 208
199 } // namespace chromeos 209 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698