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

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

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

Powered by Google App Engine
This is Rietveld 408576698