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

Side by Side Diff: chrome/browser/chromeos/login/wizard_controller_browsertest.cc

Issue 620563002: ChromeOS NetworkScreenHandler should not call CheckAndResolveLocale on UI thread. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup. Created 6 years, 2 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
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/login/wizard_controller.h" 5 #include "chrome/browser/chromeos/login/wizard_controller.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 113
114 virtual bool IsInitializationComplete() const OVERRIDE { 114 virtual bool IsInitializationComplete() const OVERRIDE {
115 return true; 115 return true;
116 } 116 }
117 117
118 private: 118 private:
119 virtual ~PrefStoreStub() {} 119 virtual ~PrefStoreStub() {}
120 }; 120 };
121 121
122 struct SwitchLanguageTestData { 122 struct SwitchLanguageTestData {
123 SwitchLanguageTestData() : success(false), done(false) {} 123 SwitchLanguageTestData() : done(false) {}
124 124
125 std::string requested_locale; 125 scoped_ptr<locale_util::LanguageSwitchResult> result;
126 std::string loaded_locale;
127 bool success;
128 bool done; 126 bool done;
129 }; 127 };
130 128
131 void OnLocaleSwitched(SwitchLanguageTestData* self, 129 void OnLocaleSwitched(SwitchLanguageTestData* self,
132 const std::string& locale, 130 scoped_ptr<locale_util::LanguageSwitchResult> result) {
133 const std::string& loaded_locale, 131 self->result.reset(result.release());
134 const bool success) {
135 self->requested_locale = locale;
136 self->loaded_locale = loaded_locale;
137 self->success = success;
138 self->done = true; 132 self->done = true;
139 } 133 }
140 134
141 void RunSwitchLanguageTest(const std::string& locale, 135 void RunSwitchLanguageTest(const std::string& locale,
142 const std::string& expected_locale, 136 const std::string& expected_locale,
143 const bool expect_success) { 137 const bool expect_success) {
144 SwitchLanguageTestData data; 138 SwitchLanguageTestData data;
145 scoped_ptr<locale_util::SwitchLanguageCallback> callback( 139 scoped_ptr<locale_util::SwitchLanguageCallback> callback(
146 new locale_util::SwitchLanguageCallback( 140 new locale_util::SwitchLanguageCallback(
147 base::Bind(&OnLocaleSwitched, base::Unretained(&data)))); 141 base::Bind(&OnLocaleSwitched, base::Unretained(&data))));
148 locale_util::SwitchLanguage(locale, true, false, callback.Pass()); 142 locale_util::SwitchLanguage(locale, true, false, callback.Pass());
149 143
150 // Token writing moves control to BlockingPool and back. 144 // Token writing moves control to BlockingPool and back.
151 content::RunAllBlockingPoolTasksUntilIdle(); 145 content::RunAllBlockingPoolTasksUntilIdle();
152 146
153 EXPECT_EQ(data.done, true); 147 EXPECT_EQ(data.done, true);
154 EXPECT_EQ(data.requested_locale, locale); 148 ASSERT_TRUE(data.result.get());
155 EXPECT_EQ(data.loaded_locale, expected_locale); 149 EXPECT_EQ(data.result->requested_locale, locale);
156 EXPECT_EQ(data.success, expect_success); 150 EXPECT_EQ(data.result->loaded_locale, expected_locale);
151 EXPECT_EQ(data.result->success, expect_success);
157 } 152 }
158 153
159 void SetUpCrasAndEnableChromeVox(int volume_percent, bool mute_on) { 154 void SetUpCrasAndEnableChromeVox(int volume_percent, bool mute_on) {
160 AccessibilityManager* a11y = AccessibilityManager::Get(); 155 AccessibilityManager* a11y = AccessibilityManager::Get();
161 CrasAudioHandler* cras = CrasAudioHandler::Get(); 156 CrasAudioHandler* cras = CrasAudioHandler::Get();
162 157
163 // Audio output is at |volume_percent| and |mute_on|. Spoken feedback 158 // Audio output is at |volume_percent| and |mute_on|. Spoken feedback
164 // is disabled. 159 // is disabled.
165 cras->SetOutputVolumePercent(volume_percent); 160 cras->SetOutputVolumePercent(volume_percent);
166 cras->SetOutputMute(mute_on); 161 cras->SetOutputMute(mute_on);
(...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after
1065 // TODO(merkulova): Add tests for bluetooth HID detection screen variations when 1060 // TODO(merkulova): Add tests for bluetooth HID detection screen variations when
1066 // UI and logic is ready. http://crbug.com/127016 1061 // UI and logic is ready. http://crbug.com/127016
1067 1062
1068 // TODO(dzhioev): Add tests for controller/host pairing flow. 1063 // TODO(dzhioev): Add tests for controller/host pairing flow.
1069 // http://crbug.com/375191 1064 // http://crbug.com/375191
1070 1065
1071 COMPILE_ASSERT(ScreenObserver::EXIT_CODES_COUNT == 23, 1066 COMPILE_ASSERT(ScreenObserver::EXIT_CODES_COUNT == 23,
1072 add_tests_for_new_control_flow_you_just_introduced); 1067 add_tests_for_new_control_flow_you_just_introduced);
1073 1068
1074 } // namespace chromeos 1069 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698