| 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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() : result("", "", false), done(false) {} |
| 124 | 124 |
| 125 std::string requested_locale; | 125 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 const locale_util::LanguageSwitchResult& result) { |
| 133 const std::string& loaded_locale, | 131 self->result = result; |
| 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 locale_util::SwitchLanguageCallback callback( |
| 146 new locale_util::SwitchLanguageCallback( | 140 base::Bind(&OnLocaleSwitched, base::Unretained(&data))); |
| 147 base::Bind(&OnLocaleSwitched, base::Unretained(&data)))); | 141 locale_util::SwitchLanguage(locale, true, false, callback); |
| 148 locale_util::SwitchLanguage(locale, true, false, callback.Pass()); | |
| 149 | 142 |
| 150 // Token writing moves control to BlockingPool and back. | 143 // Token writing moves control to BlockingPool and back. |
| 151 content::RunAllBlockingPoolTasksUntilIdle(); | 144 content::RunAllBlockingPoolTasksUntilIdle(); |
| 152 | 145 |
| 153 EXPECT_EQ(data.done, true); | 146 EXPECT_EQ(data.done, true); |
| 154 EXPECT_EQ(data.requested_locale, locale); | 147 EXPECT_EQ(data.result.requested_locale, locale); |
| 155 EXPECT_EQ(data.loaded_locale, expected_locale); | 148 EXPECT_EQ(data.result.loaded_locale, expected_locale); |
| 156 EXPECT_EQ(data.success, expect_success); | 149 EXPECT_EQ(data.result.success, expect_success); |
| 157 } | 150 } |
| 158 | 151 |
| 159 void SetUpCrasAndEnableChromeVox(int volume_percent, bool mute_on) { | 152 void SetUpCrasAndEnableChromeVox(int volume_percent, bool mute_on) { |
| 160 AccessibilityManager* a11y = AccessibilityManager::Get(); | 153 AccessibilityManager* a11y = AccessibilityManager::Get(); |
| 161 CrasAudioHandler* cras = CrasAudioHandler::Get(); | 154 CrasAudioHandler* cras = CrasAudioHandler::Get(); |
| 162 | 155 |
| 163 // Audio output is at |volume_percent| and |mute_on|. Spoken feedback | 156 // Audio output is at |volume_percent| and |mute_on|. Spoken feedback |
| 164 // is disabled. | 157 // is disabled. |
| 165 cras->SetOutputVolumePercent(volume_percent); | 158 cras->SetOutputVolumePercent(volume_percent); |
| 166 cras->SetOutputMute(mute_on); | 159 cras->SetOutputMute(mute_on); |
| (...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1065 // TODO(merkulova): Add tests for bluetooth HID detection screen variations when | 1058 // TODO(merkulova): Add tests for bluetooth HID detection screen variations when |
| 1066 // UI and logic is ready. http://crbug.com/127016 | 1059 // UI and logic is ready. http://crbug.com/127016 |
| 1067 | 1060 |
| 1068 // TODO(dzhioev): Add tests for controller/host pairing flow. | 1061 // TODO(dzhioev): Add tests for controller/host pairing flow. |
| 1069 // http://crbug.com/375191 | 1062 // http://crbug.com/375191 |
| 1070 | 1063 |
| 1071 COMPILE_ASSERT(ScreenObserver::EXIT_CODES_COUNT == 23, | 1064 COMPILE_ASSERT(ScreenObserver::EXIT_CODES_COUNT == 23, |
| 1072 add_tests_for_new_control_flow_you_just_introduced); | 1065 add_tests_for_new_control_flow_you_just_introduced); |
| 1073 | 1066 |
| 1074 } // namespace chromeos | 1067 } // namespace chromeos |
| OLD | NEW |