OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/l10n_util.h" | 5 #include "app/l10n_util.h" |
| 6 #include "base/utf_string_conversions.h" |
6 #include "chrome/browser/browser_process.h" | 7 #include "chrome/browser/browser_process.h" |
7 #include "chrome/browser/chromeos/login/account_screen.h" | 8 #include "chrome/browser/chromeos/login/account_screen.h" |
8 #include "chrome/browser/chromeos/login/eula_view.h" | 9 #include "chrome/browser/chromeos/login/eula_view.h" |
9 #include "chrome/browser/chromeos/login/language_switch_menu.h" | 10 #include "chrome/browser/chromeos/login/language_switch_menu.h" |
10 #include "chrome/browser/chromeos/login/login_screen.h" | 11 #include "chrome/browser/chromeos/login/login_screen.h" |
11 #include "chrome/browser/chromeos/login/mock_update_screen.h" | 12 #include "chrome/browser/chromeos/login/mock_update_screen.h" |
12 #include "chrome/browser/chromeos/login/network_screen.h" | 13 #include "chrome/browser/chromeos/login/network_screen.h" |
13 #include "chrome/browser/chromeos/login/network_selection_view.h" | 14 #include "chrome/browser/chromeos/login/network_selection_view.h" |
14 #include "chrome/browser/chromeos/login/user_image_screen.h" | 15 #include "chrome/browser/chromeos/login/user_image_screen.h" |
15 #include "chrome/browser/chromeos/login/wizard_controller.h" | 16 #include "chrome/browser/chromeos/login/wizard_controller.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 WizardController* const wizard = controller(); | 74 WizardController* const wizard = controller(); |
74 ASSERT_TRUE(wizard != NULL); | 75 ASSERT_TRUE(wizard != NULL); |
75 wizard->ShowFirstScreen(WizardController::kNetworkScreenName); | 76 wizard->ShowFirstScreen(WizardController::kNetworkScreenName); |
76 views::View* current_screen = wizard->contents(); | 77 views::View* current_screen = wizard->contents(); |
77 ASSERT_TRUE(current_screen != NULL); | 78 ASSERT_TRUE(current_screen != NULL); |
78 | 79 |
79 // Checking the default locale. Provided that the profile is cleared in SetUp. | 80 // Checking the default locale. Provided that the profile is cleared in SetUp. |
80 EXPECT_EQ("en-US", g_browser_process->GetApplicationLocale()); | 81 EXPECT_EQ("en-US", g_browser_process->GetApplicationLocale()); |
81 EXPECT_STREQ("en", icu::Locale::getDefault().getLanguage()); | 82 EXPECT_STREQ("en", icu::Locale::getDefault().getLanguage()); |
82 EXPECT_FALSE(base::i18n::IsRTL()); | 83 EXPECT_FALSE(base::i18n::IsRTL()); |
83 const std::wstring en_str = l10n_util::GetString(IDS_NETWORK_SELECTION_TITLE); | 84 const std::wstring en_str = |
| 85 UTF16ToWide(l10n_util::GetStringUTF16(IDS_NETWORK_SELECTION_TITLE)); |
84 | 86 |
85 chromeos::LanguageSwitchMenu::SwitchLanguage("fr"); | 87 chromeos::LanguageSwitchMenu::SwitchLanguage("fr"); |
86 EXPECT_EQ("fr", g_browser_process->GetApplicationLocale()); | 88 EXPECT_EQ("fr", g_browser_process->GetApplicationLocale()); |
87 EXPECT_STREQ("fr", icu::Locale::getDefault().getLanguage()); | 89 EXPECT_STREQ("fr", icu::Locale::getDefault().getLanguage()); |
88 EXPECT_FALSE(base::i18n::IsRTL()); | 90 EXPECT_FALSE(base::i18n::IsRTL()); |
89 const std::wstring fr_str = l10n_util::GetString(IDS_NETWORK_SELECTION_TITLE); | 91 const std::wstring fr_str = |
| 92 UTF16ToWide(l10n_util::GetStringUTF16(IDS_NETWORK_SELECTION_TITLE)); |
90 | 93 |
91 EXPECT_NE(en_str, fr_str); | 94 EXPECT_NE(en_str, fr_str); |
92 | 95 |
93 chromeos::LanguageSwitchMenu::SwitchLanguage("ar"); | 96 chromeos::LanguageSwitchMenu::SwitchLanguage("ar"); |
94 EXPECT_EQ("ar", g_browser_process->GetApplicationLocale()); | 97 EXPECT_EQ("ar", g_browser_process->GetApplicationLocale()); |
95 EXPECT_STREQ("ar", icu::Locale::getDefault().getLanguage()); | 98 EXPECT_STREQ("ar", icu::Locale::getDefault().getLanguage()); |
96 EXPECT_TRUE(base::i18n::IsRTL()); | 99 EXPECT_TRUE(base::i18n::IsRTL()); |
97 const std::wstring ar_str = l10n_util::GetString(IDS_NETWORK_SELECTION_TITLE); | 100 const std::wstring ar_str = |
| 101 UTF16ToWide(l10n_util::GetStringUTF16(IDS_NETWORK_SELECTION_TITLE)); |
98 | 102 |
99 EXPECT_NE(fr_str, ar_str); | 103 EXPECT_NE(fr_str, ar_str); |
100 } | 104 } |
101 | 105 |
102 class WizardControllerFlowTest : public WizardControllerTest { | 106 class WizardControllerFlowTest : public WizardControllerTest { |
103 protected: | 107 protected: |
104 WizardControllerFlowTest() {} | 108 WizardControllerFlowTest() {} |
105 // Overriden from InProcessBrowserTest: | 109 // Overriden from InProcessBrowserTest: |
106 virtual Browser* CreateBrowser(Profile* profile) { | 110 virtual Browser* CreateBrowser(Profile* profile) { |
107 Browser* ret = WizardControllerTest::CreateBrowser(profile); | 111 Browser* ret = WizardControllerTest::CreateBrowser(profile); |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 EXPECT_EQ(controller()->GetUserImageScreen(), controller()->current_screen()); | 267 EXPECT_EQ(controller()->GetUserImageScreen(), controller()->current_screen()); |
264 | 268 |
265 focus_manager = controller()->contents()->GetFocusManager(); | 269 focus_manager = controller()->contents()->GetFocusManager(); |
266 EXPECT_CALL(*mock_eula_screen_, Show()).Times(1); | 270 EXPECT_CALL(*mock_eula_screen_, Show()).Times(1); |
267 EXPECT_TRUE(focus_manager->ProcessAccelerator(accel_eula_screen)); | 271 EXPECT_TRUE(focus_manager->ProcessAccelerator(accel_eula_screen)); |
268 EXPECT_EQ(controller()->GetEulaScreen(), controller()->current_screen()); | 272 EXPECT_EQ(controller()->GetEulaScreen(), controller()->current_screen()); |
269 } | 273 } |
270 | 274 |
271 COMPILE_ASSERT(chromeos::ScreenObserver::EXIT_CODES_COUNT == 18, | 275 COMPILE_ASSERT(chromeos::ScreenObserver::EXIT_CODES_COUNT == 18, |
272 add_tests_for_new_control_flow_you_just_introduced); | 276 add_tests_for_new_control_flow_you_just_introduced); |
OLD | NEW |