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

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

Issue 664503003: Revert of Revert of Revert of ChromeOS NetworkScreenHandler should not call CheckAndResolveLocale on UI thread. (patchs… (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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 115
116 virtual bool IsInitializationComplete() const override { 116 virtual bool IsInitializationComplete() const override {
117 return true; 117 return true;
118 } 118 }
119 119
120 private: 120 private:
121 virtual ~PrefStoreStub() {} 121 virtual ~PrefStoreStub() {}
122 }; 122 };
123 123
124 struct SwitchLanguageTestData { 124 struct SwitchLanguageTestData {
125 SwitchLanguageTestData() : result("", "", false), done(false) {} 125 SwitchLanguageTestData() : success(false), done(false) {}
126 126
127 locale_util::LanguageSwitchResult result; 127 std::string requested_locale;
128 std::string loaded_locale;
129 bool success;
128 bool done; 130 bool done;
129 }; 131 };
130 132
131 void OnLocaleSwitched(SwitchLanguageTestData* self, 133 void OnLocaleSwitched(SwitchLanguageTestData* self,
132 const locale_util::LanguageSwitchResult& result) { 134 const std::string& locale,
133 self->result = result; 135 const std::string& loaded_locale,
136 const bool success) {
137 self->requested_locale = locale;
138 self->loaded_locale = loaded_locale;
139 self->success = success;
134 self->done = true; 140 self->done = true;
135 } 141 }
136 142
137 void RunSwitchLanguageTest(const std::string& locale, 143 void RunSwitchLanguageTest(const std::string& locale,
138 const std::string& expected_locale, 144 const std::string& expected_locale,
139 const bool expect_success) { 145 const bool expect_success) {
140 SwitchLanguageTestData data; 146 SwitchLanguageTestData data;
141 locale_util::SwitchLanguageCallback callback( 147 scoped_ptr<locale_util::SwitchLanguageCallback> callback(
142 base::Bind(&OnLocaleSwitched, base::Unretained(&data))); 148 new locale_util::SwitchLanguageCallback(
143 locale_util::SwitchLanguage(locale, true, false, callback); 149 base::Bind(&OnLocaleSwitched, base::Unretained(&data))));
150 locale_util::SwitchLanguage(locale, true, false, callback.Pass());
144 151
145 // Token writing moves control to BlockingPool and back. 152 // Token writing moves control to BlockingPool and back.
146 content::RunAllBlockingPoolTasksUntilIdle(); 153 content::RunAllBlockingPoolTasksUntilIdle();
147 154
148 EXPECT_EQ(data.done, true); 155 EXPECT_EQ(data.done, true);
149 EXPECT_EQ(data.result.requested_locale, locale); 156 EXPECT_EQ(data.requested_locale, locale);
150 EXPECT_EQ(data.result.loaded_locale, expected_locale); 157 EXPECT_EQ(data.loaded_locale, expected_locale);
151 EXPECT_EQ(data.result.success, expect_success); 158 EXPECT_EQ(data.success, expect_success);
152 } 159 }
153 160
154 void SetUpCrasAndEnableChromeVox(int volume_percent, bool mute_on) { 161 void SetUpCrasAndEnableChromeVox(int volume_percent, bool mute_on) {
155 AccessibilityManager* a11y = AccessibilityManager::Get(); 162 AccessibilityManager* a11y = AccessibilityManager::Get();
156 CrasAudioHandler* cras = CrasAudioHandler::Get(); 163 CrasAudioHandler* cras = CrasAudioHandler::Get();
157 164
158 // Audio output is at |volume_percent| and |mute_on|. Spoken feedback 165 // Audio output is at |volume_percent| and |mute_on|. Spoken feedback
159 // is disabled. 166 // is disabled.
160 cras->SetOutputVolumePercent(volume_percent); 167 cras->SetOutputVolumePercent(volume_percent);
161 cras->SetOutputMute(mute_on); 168 cras->SetOutputMute(mute_on);
(...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after
1103 // TODO(merkulova): Add tests for bluetooth HID detection screen variations when 1110 // TODO(merkulova): Add tests for bluetooth HID detection screen variations when
1104 // UI and logic is ready. http://crbug.com/127016 1111 // UI and logic is ready. http://crbug.com/127016
1105 1112
1106 // TODO(dzhioev): Add tests for controller/host pairing flow. 1113 // TODO(dzhioev): Add tests for controller/host pairing flow.
1107 // http://crbug.com/375191 1114 // http://crbug.com/375191
1108 1115
1109 COMPILE_ASSERT(ScreenObserver::EXIT_CODES_COUNT == 23, 1116 COMPILE_ASSERT(ScreenObserver::EXIT_CODES_COUNT == 23,
1110 add_tests_for_new_control_flow_you_just_introduced); 1117 add_tests_for_new_control_flow_you_just_introduced);
1111 1118
1112 } // namespace chromeos 1119 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698