| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/ui/webui/chromeos/login/l10n_util.h" | 5 #include "chrome/browser/ui/webui/chromeos/login/l10n_util.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/at_exit.h" | 9 #include "base/at_exit.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
| 13 #include "base/memory/singleton.h" | 13 #include "base/memory/singleton.h" |
| 14 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
| 15 #include "base/run_loop.h" |
| 15 #include "base/single_thread_task_runner.h" | 16 #include "base/single_thread_task_runner.h" |
| 16 #include "base/values.h" | 17 #include "base/values.h" |
| 17 #include "chrome/browser/chromeos/customization/customization_document.h" | 18 #include "chrome/browser/chromeos/customization/customization_document.h" |
| 18 #include "chrome/browser/chromeos/input_method/input_method_configuration.h" | 19 #include "chrome/browser/chromeos/input_method/input_method_configuration.h" |
| 19 #include "chrome/browser/ui/webui/chromeos/login/l10n_util_test_util.h" | 20 #include "chrome/browser/ui/webui/chromeos/login/l10n_util_test_util.h" |
| 20 #include "chromeos/system/statistics_provider.h" | 21 #include "chromeos/system/statistics_provider.h" |
| 21 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
| 22 #include "ui/base/ime/chromeos/component_extension_ime_manager.h" | 23 #include "ui/base/ime/chromeos/component_extension_ime_manager.h" |
| 23 | 24 |
| 24 namespace chromeos { | 25 namespace chromeos { |
| 25 | 26 |
| 26 namespace { | 27 namespace { |
| 27 | 28 |
| 28 class MachineStatisticsInitializer { | 29 class MachineStatisticsInitializer { |
| 29 public: | 30 public: |
| 30 MachineStatisticsInitializer(); | 31 MachineStatisticsInitializer(); |
| 31 | 32 |
| 32 static MachineStatisticsInitializer* GetInstance(); | 33 static MachineStatisticsInitializer* GetInstance(); |
| 33 | 34 |
| 34 private: | 35 private: |
| 35 DISALLOW_COPY_AND_ASSIGN(MachineStatisticsInitializer); | 36 DISALLOW_COPY_AND_ASSIGN(MachineStatisticsInitializer); |
| 36 }; | 37 }; |
| 37 | 38 |
| 38 MachineStatisticsInitializer::MachineStatisticsInitializer() { | 39 MachineStatisticsInitializer::MachineStatisticsInitializer() { |
| 39 base::MessageLoop loop; | 40 base::MessageLoop loop; |
| 40 chromeos::system::StatisticsProvider::GetInstance() | 41 chromeos::system::StatisticsProvider::GetInstance() |
| 41 ->StartLoadingMachineStatistics(loop.task_runner(), false); | 42 ->StartLoadingMachineStatistics(loop.task_runner(), false); |
| 42 loop.RunUntilIdle(); | 43 base::RunLoop().RunUntilIdle(); |
| 43 } | 44 } |
| 44 | 45 |
| 45 // static | 46 // static |
| 46 MachineStatisticsInitializer* MachineStatisticsInitializer::GetInstance() { | 47 MachineStatisticsInitializer* MachineStatisticsInitializer::GetInstance() { |
| 47 return base::Singleton<MachineStatisticsInitializer>::get(); | 48 return base::Singleton<MachineStatisticsInitializer>::get(); |
| 48 } | 49 } |
| 49 | 50 |
| 50 void VerifyOnlyUILanguages(const base::ListValue& list) { | 51 void VerifyOnlyUILanguages(const base::ListValue& list) { |
| 51 for (size_t i = 0; i < list.GetSize(); ++i) { | 52 for (size_t i = 0; i < list.GetSize(); ++i) { |
| 52 const base::DictionaryValue* dict; | 53 const base::DictionaryValue* dict; |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 VerifyOnlyUILanguages(*list); | 219 VerifyOnlyUILanguages(*list); |
| 219 | 220 |
| 220 ASSERT_LE(3u, list->GetSize()); | 221 ASSERT_LE(3u, list->GetSize()); |
| 221 | 222 |
| 222 VerifyLanguageCode(*list, 0, "it"); | 223 VerifyLanguageCode(*list, 0, "it"); |
| 223 VerifyLanguageCode(*list, 1, "de"); | 224 VerifyLanguageCode(*list, 1, "de"); |
| 224 VerifyLanguageCode(*list, 2, kMostRelevantLanguagesDivider); | 225 VerifyLanguageCode(*list, 2, kMostRelevantLanguagesDivider); |
| 225 } | 226 } |
| 226 | 227 |
| 227 } // namespace chromeos | 228 } // namespace chromeos |
| OLD | NEW |