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