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