diff options
-rw-r--r-- | chrome/browser/chromeos/login/wizard_controller.h | 1 | ||||
-rw-r--r-- | chrome/browser/chromeos/login/wizard_controller_browsertest.cc | 59 | ||||
-rw-r--r-- | chrome/chrome_tests.gypi | 1 |
3 files changed, 61 insertions, 0 deletions
diff --git a/chrome/browser/chromeos/login/wizard_controller.h b/chrome/browser/chromeos/login/wizard_controller.h index f0dfcbd..2c443d3 100644 --- a/chrome/browser/chromeos/login/wizard_controller.h +++ b/chrome/browser/chromeos/login/wizard_controller.h @@ -131,6 +131,7 @@ class WizardController : public chromeos::ScreenObserver, // Default WizardController. static WizardController* default_controller_; + FRIEND_TEST(WizardControllerTest, SwitchLanguage); DISALLOW_COPY_AND_ASSIGN(WizardController); }; diff --git a/chrome/browser/chromeos/login/wizard_controller_browsertest.cc b/chrome/browser/chromeos/login/wizard_controller_browsertest.cc new file mode 100644 index 0000000..8593a14 --- /dev/null +++ b/chrome/browser/chromeos/login/wizard_controller_browsertest.cc @@ -0,0 +1,59 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "app/l10n_util.h" +#include "chrome/browser/browser_process.h" +#include "chrome/browser/chromeos/login/wizard_controller.h" +#include "chrome/common/chrome_switches.h" +#include "chrome/test/in_process_browser_test.h" +#include "grit/generated_resources.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "unicode/locid.h" + +class WizardControllerTest : public InProcessBrowserTest { + protected: + WizardControllerTest() {} + virtual Browser* CreateBrowser(Profile* profile) { return NULL; } + virtual void SetUpCommandLine(CommandLine* command_line) { + command_line->AppendSwitch(switches::kLoginManager); + } + + private: + DISALLOW_COPY_AND_ASSIGN(WizardControllerTest); +}; + +IN_PROC_BROWSER_TEST_F(WizardControllerTest, SwitchLanguage) { + WizardController* const wizard = WizardController::default_controller(); + ASSERT_TRUE(wizard); + views::View *current_screen = wizard->contents(); + ASSERT_TRUE(current_screen); + + // Checking the default locale. Provided that the profile is cleared in SetUp. + EXPECT_EQ("en-US", g_browser_process->GetApplicationLocale()); + EXPECT_STREQ("en", icu::Locale::getDefault().getLanguage()); + EXPECT_FALSE(current_screen->UILayoutIsRightToLeft()); + const std::wstring en_str = l10n_util::GetString(IDS_NETWORK_SELECTION_TITLE); + + wizard->OnSwitchLanguage("fr"); + EXPECT_EQ("fr", g_browser_process->GetApplicationLocale()); + EXPECT_STREQ("fr", icu::Locale::getDefault().getLanguage()); + EXPECT_FALSE(current_screen->UILayoutIsRightToLeft()); + const std::wstring fr_str = l10n_util::GetString(IDS_NETWORK_SELECTION_TITLE); + + EXPECT_NE(en_str, fr_str); + + wizard->OnSwitchLanguage("ar"); + EXPECT_EQ("ar", g_browser_process->GetApplicationLocale()); + EXPECT_STREQ("ar", icu::Locale::getDefault().getLanguage()); + EXPECT_TRUE(current_screen->UILayoutIsRightToLeft()); + const std::wstring ar_str = l10n_util::GetString(IDS_NETWORK_SELECTION_TITLE); + + EXPECT_NE(fr_str, ar_str); + + // Close login manager windows. It does not delete itself if wizard + // not completed. + MessageLoop::current()->DeleteSoon(FROM_HERE, wizard); + // End the message loop to quit the test. + MessageLoop::current()->Quit(); +} diff --git a/chrome/chrome_tests.gypi b/chrome/chrome_tests.gypi index 686b6b2..a61559f 100644 --- a/chrome/chrome_tests.gypi +++ b/chrome/chrome_tests.gypi @@ -1215,6 +1215,7 @@ 'browser/chromeos/compact_navigation_bar_browsertest.cc', 'browser/chromeos/login/account_screen_browsertest.cc', 'browser/chromeos/notifications/notification_browsertest.cc', + 'browser/chromeos/login/wizard_controller_browsertest.cc', 'browser/crash_recovery_browsertest.cc', 'browser/dom_ui/mediaplayer_browsertest.cc', 'browser/download/save_page_browsertest.cc', |