| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/prefs/pref_service.h" | 5 #include "base/prefs/pref_service.h" |
| 6 #include "base/strings/utf_string_conversions.h" | 6 #include "base/strings/utf_string_conversions.h" |
| 7 #include "chrome/browser/browser_process.h" | 7 #include "chrome/browser/browser_process.h" |
| 8 #include "chrome/browser/search/search.h" | 8 #include "chrome/browser/search/search.h" |
| 9 #include "chrome/browser/ui/search/instant_test_utils.h" | 9 #include "chrome/browser/ui/search/instant_test_utils.h" |
| 10 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 10 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 ASSERT_TRUE(https_test_server().Start()); | 25 ASSERT_TRUE(https_test_server().Start()); |
| 26 GURL instant_url = https_test_server().GetURL( | 26 GURL instant_url = https_test_server().GetURL( |
| 27 "files/local_ntp_browsertest.html?strk=1&"); | 27 "files/local_ntp_browsertest.html?strk=1&"); |
| 28 InstantTestBase::Init(instant_url, false); | 28 InstantTestBase::Init(instant_url, false); |
| 29 } | 29 } |
| 30 }; | 30 }; |
| 31 | 31 |
| 32 // Flaky: crbug.com/267117 | 32 // Flaky: crbug.com/267117 |
| 33 IN_PROC_BROWSER_TEST_F(LocalNTPTest, DISABLED_LocalNTPJavascriptTest) { | 33 IN_PROC_BROWSER_TEST_F(LocalNTPTest, DISABLED_LocalNTPJavascriptTest) { |
| 34 ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); | 34 ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); |
| 35 FocusOmniboxAndWaitForInstantNTPSupport(); | 35 FocusOmnibox(); |
| 36 | 36 |
| 37 ui_test_utils::NavigateToURLWithDisposition( | 37 ui_test_utils::NavigateToURLWithDisposition( |
| 38 browser(), | 38 browser(), |
| 39 instant_url(), | 39 instant_url(), |
| 40 NEW_FOREGROUND_TAB, | 40 NEW_FOREGROUND_TAB, |
| 41 ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB | | 41 ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB | |
| 42 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 42 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
| 43 content::WebContents* active_tab = | 43 content::WebContents* active_tab = |
| 44 browser()->tab_strip_model()->GetActiveWebContents(); | 44 browser()->tab_strip_model()->GetActiveWebContents(); |
| 45 ASSERT_TRUE(chrome::IsInstantNTP(active_tab)); | 45 ASSERT_TRUE(chrome::IsInstantNTP(active_tab)); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 58 // Switch browser language to French. | 58 // Switch browser language to French. |
| 59 std::string loaded_locale = | 59 std::string loaded_locale = |
| 60 ui::ResourceBundle::GetSharedInstance().ReloadLocaleResources("fr"); | 60 ui::ResourceBundle::GetSharedInstance().ReloadLocaleResources("fr"); |
| 61 EXPECT_EQ("fr", loaded_locale); | 61 EXPECT_EQ("fr", loaded_locale); |
| 62 g_browser_process->SetApplicationLocale(loaded_locale); | 62 g_browser_process->SetApplicationLocale(loaded_locale); |
| 63 PrefService* prefs = g_browser_process->local_state(); | 63 PrefService* prefs = g_browser_process->local_state(); |
| 64 prefs->SetString(prefs::kApplicationLocale, loaded_locale); | 64 prefs->SetString(prefs::kApplicationLocale, loaded_locale); |
| 65 | 65 |
| 66 // Setup Instant. | 66 // Setup Instant. |
| 67 ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); | 67 ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); |
| 68 FocusOmniboxAndWaitForInstantNTPSupport(); | 68 FocusOmnibox(); |
| 69 | 69 |
| 70 // Open a new tab. | 70 // Open a new tab. |
| 71 ui_test_utils::NavigateToURLWithDisposition( | 71 ui_test_utils::NavigateToURLWithDisposition( |
| 72 browser(), | 72 browser(), |
| 73 GURL(chrome::kChromeUINewTabURL), | 73 GURL(chrome::kChromeUINewTabURL), |
| 74 NEW_FOREGROUND_TAB, | 74 NEW_FOREGROUND_TAB, |
| 75 ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB | | 75 ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB | |
| 76 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 76 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
| 77 | 77 |
| 78 // Verify that the NTP is in French. | 78 // Verify that the NTP is in French. |
| 79 content::WebContents* active_tab = | 79 content::WebContents* active_tab = |
| 80 browser()->tab_strip_model()->GetActiveWebContents(); | 80 browser()->tab_strip_model()->GetActiveWebContents(); |
| 81 EXPECT_EQ(base::ASCIIToUTF16("Nouvel onglet"), active_tab->GetTitle()); | 81 EXPECT_EQ(base::ASCIIToUTF16("Nouvel onglet"), active_tab->GetTitle()); |
| 82 } | 82 } |
| OLD | NEW |