Index: chrome/browser/ui/search/local_ntp_browsertest.cc |
diff --git a/chrome/browser/ui/search/local_ntp_browsertest.cc b/chrome/browser/ui/search/local_ntp_browsertest.cc |
index ccbc8c42467728f445ef9e4225c7f436d4bd7578..5201abc658c2c00f52d66f7382359e0000d398e8 100644 |
--- a/chrome/browser/ui/search/local_ntp_browsertest.cc |
+++ b/chrome/browser/ui/search/local_ntp_browsertest.cc |
@@ -2,12 +2,18 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
+#include "base/prefs/pref_service.h" |
+#include "base/strings/utf_string_conversions.h" |
+#include "chrome/browser/browser_process.h" |
#include "chrome/browser/search/search.h" |
#include "chrome/browser/ui/search/instant_test_utils.h" |
#include "chrome/browser/ui/tabs/tab_strip_model.h" |
+#include "chrome/common/pref_names.h" |
+#include "chrome/common/url_constants.h" |
#include "chrome/test/base/in_process_browser_test.h" |
#include "chrome/test/base/ui_test_utils.h" |
#include "content/public/browser/web_contents.h" |
+#include "ui/base/resource/resource_bundle.h" |
class LocalNTPTest : public InProcessBrowserTest, |
public InstantTestBase { |
@@ -41,3 +47,42 @@ IN_PROC_BROWSER_TEST_F(LocalNTPTest, LocalNTPJavascriptTest) { |
ASSERT_TRUE(GetBoolFromJS(active_tab, "!!runTests()", &success)); |
EXPECT_TRUE(success); |
} |
+ |
+// Flaky on Linux Tests bot. |
+#if defined(OS_LINUX) |
+#define MAYBE_NTPRespectsBrowserLanguageSetting DISABLED_NTPRespectsBrowserLanguageSetting |
+#else |
+#define MAYBE_NTPRespectsBrowserLanguageSetting NTPRespectsBrowserLanguageSetting |
+#endif |
+IN_PROC_BROWSER_TEST_F(LocalNTPTest, MAYBE_NTPRespectsBrowserLanguageSetting) { |
+ // Make sure the default language is not French. |
+ std::string default_locale = g_browser_process->GetApplicationLocale(); |
+ EXPECT_NE("fr", default_locale); |
+ |
+ // Switch browser language to French. |
+ std::string loaded_locale = |
+ ui::ResourceBundle::GetSharedInstance().ReloadLocaleResources("fr"); |
+ EXPECT_EQ("fr", loaded_locale); |
+ g_browser_process->SetApplicationLocale(loaded_locale); |
+ PrefService* prefs = g_browser_process->local_state(); |
+ prefs->SetString(prefs::kApplicationLocale, loaded_locale); |
+ |
+ // Setup Instant. |
+ ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); |
+ |
+ // The second argument says to use only the local overlay and NTP. |
+ instant()->SetInstantEnabled(false, true); |
+ FocusOmniboxAndWaitForInstantNTPSupport(); |
+ |
+ // Open a new tab. |
+ ui_test_utils::NavigateToURLWithDisposition( |
+ browser(), |
+ GURL(chrome::kChromeUINewTabURL), |
+ NEW_FOREGROUND_TAB, |
+ ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB); |
+ |
+ // Verify that the NTP is in French. |
+ content::WebContents* active_tab = |
+ browser()->tab_strip_model()->GetActiveWebContents(); |
+ EXPECT_EQ(ASCIIToUTF16("Nouvel onglet"), active_tab->GetTitle()); |
+} |