| OLD | NEW |
| 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 | 122 |
| 123 virtual bool IsInitializationComplete() const override { | 123 virtual bool IsInitializationComplete() const override { |
| 124 return true; | 124 return true; |
| 125 } | 125 } |
| 126 | 126 |
| 127 private: | 127 private: |
| 128 virtual ~PrefStoreStub() {} | 128 virtual ~PrefStoreStub() {} |
| 129 }; | 129 }; |
| 130 | 130 |
| 131 struct SwitchLanguageTestData { | 131 struct SwitchLanguageTestData { |
| 132 SwitchLanguageTestData() : success(false), done(false) {} | 132 SwitchLanguageTestData() : result("", "", false), done(false) {} |
| 133 | 133 |
| 134 std::string requested_locale; | 134 locale_util::LanguageSwitchResult result; |
| 135 std::string loaded_locale; | |
| 136 bool success; | |
| 137 bool done; | 135 bool done; |
| 138 }; | 136 }; |
| 139 | 137 |
| 140 void OnLocaleSwitched(SwitchLanguageTestData* self, | 138 void OnLocaleSwitched(SwitchLanguageTestData* self, |
| 141 const std::string& locale, | 139 const locale_util::LanguageSwitchResult& result) { |
| 142 const std::string& loaded_locale, | 140 self->result = result; |
| 143 const bool success) { | |
| 144 self->requested_locale = locale; | |
| 145 self->loaded_locale = loaded_locale; | |
| 146 self->success = success; | |
| 147 self->done = true; | 141 self->done = true; |
| 148 } | 142 } |
| 149 | 143 |
| 150 void RunSwitchLanguageTest(const std::string& locale, | 144 void RunSwitchLanguageTest(const std::string& locale, |
| 151 const std::string& expected_locale, | 145 const std::string& expected_locale, |
| 152 const bool expect_success) { | 146 const bool expect_success) { |
| 153 SwitchLanguageTestData data; | 147 SwitchLanguageTestData data; |
| 154 scoped_ptr<locale_util::SwitchLanguageCallback> callback( | 148 locale_util::SwitchLanguageCallback callback( |
| 155 new locale_util::SwitchLanguageCallback( | 149 base::Bind(&OnLocaleSwitched, base::Unretained(&data))); |
| 156 base::Bind(&OnLocaleSwitched, base::Unretained(&data)))); | 150 locale_util::SwitchLanguage(locale, true, false, callback); |
| 157 locale_util::SwitchLanguage(locale, true, false, callback.Pass()); | |
| 158 | 151 |
| 159 // Token writing moves control to BlockingPool and back. | 152 // Token writing moves control to BlockingPool and back. |
| 160 content::RunAllBlockingPoolTasksUntilIdle(); | 153 content::RunAllBlockingPoolTasksUntilIdle(); |
| 161 | 154 |
| 162 EXPECT_EQ(data.done, true); | 155 EXPECT_EQ(data.done, true); |
| 163 EXPECT_EQ(data.requested_locale, locale); | 156 EXPECT_EQ(data.result.requested_locale, locale); |
| 164 EXPECT_EQ(data.loaded_locale, expected_locale); | 157 EXPECT_EQ(data.result.loaded_locale, expected_locale); |
| 165 EXPECT_EQ(data.success, expect_success); | 158 EXPECT_EQ(data.result.success, expect_success); |
| 166 } | 159 } |
| 167 | 160 |
| 168 void SetUpCrasAndEnableChromeVox(int volume_percent, bool mute_on) { | 161 void SetUpCrasAndEnableChromeVox(int volume_percent, bool mute_on) { |
| 169 AccessibilityManager* a11y = AccessibilityManager::Get(); | 162 AccessibilityManager* a11y = AccessibilityManager::Get(); |
| 170 CrasAudioHandler* cras = CrasAudioHandler::Get(); | 163 CrasAudioHandler* cras = CrasAudioHandler::Get(); |
| 171 | 164 |
| 172 // Audio output is at |volume_percent| and |mute_on|. Spoken feedback | 165 // Audio output is at |volume_percent| and |mute_on|. Spoken feedback |
| 173 // is disabled. | 166 // is disabled. |
| 174 cras->SetOutputVolumePercent(volume_percent); | 167 cras->SetOutputVolumePercent(volume_percent); |
| 175 cras->SetOutputMute(mute_on); | 168 cras->SetOutputMute(mute_on); |
| (...skipping 1013 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1189 // TODO(merkulova): Add tests for bluetooth HID detection screen variations when | 1182 // TODO(merkulova): Add tests for bluetooth HID detection screen variations when |
| 1190 // UI and logic is ready. http://crbug.com/127016 | 1183 // UI and logic is ready. http://crbug.com/127016 |
| 1191 | 1184 |
| 1192 // TODO(dzhioev): Add tests for controller/host pairing flow. | 1185 // TODO(dzhioev): Add tests for controller/host pairing flow. |
| 1193 // http://crbug.com/375191 | 1186 // http://crbug.com/375191 |
| 1194 | 1187 |
| 1195 COMPILE_ASSERT(BaseScreenDelegate::EXIT_CODES_COUNT == 24, | 1188 COMPILE_ASSERT(BaseScreenDelegate::EXIT_CODES_COUNT == 24, |
| 1196 add_tests_for_new_control_flow_you_just_introduced); | 1189 add_tests_for_new_control_flow_you_just_introduced); |
| 1197 | 1190 |
| 1198 } // namespace chromeos | 1191 } // namespace chromeos |
| OLD | NEW |