Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(300)

Side by Side Diff: chrome/browser/ui/search/local_ntp_browsertest.cc

Issue 24733003: Update defaults for InstantExtended. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove unused. Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
11 #include "chrome/common/pref_names.h" 11 #include "chrome/common/pref_names.h"
12 #include "chrome/common/url_constants.h" 12 #include "chrome/common/url_constants.h"
13 #include "chrome/test/base/in_process_browser_test.h" 13 #include "chrome/test/base/in_process_browser_test.h"
14 #include "chrome/test/base/ui_test_utils.h" 14 #include "chrome/test/base/ui_test_utils.h"
15 #include "content/public/browser/web_contents.h" 15 #include "content/public/browser/web_contents.h"
16 #include "ui/base/resource/resource_bundle.h" 16 #include "ui/base/resource/resource_bundle.h"
17 17
18 class LocalNTPTest : public InProcessBrowserTest, 18 class LocalNTPTest : public InProcessBrowserTest,
19 public InstantTestBase { 19 public InstantTestBase {
20 public: 20 public:
21 LocalNTPTest() {} 21 LocalNTPTest() {}
22 22
23 protected: 23 protected:
24 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { 24 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE {
25 chrome::EnableInstantExtendedAPIForTesting();
26 ASSERT_TRUE(https_test_server().Start()); 25 ASSERT_TRUE(https_test_server().Start());
27 GURL instant_url = https_test_server().GetURL( 26 GURL instant_url = https_test_server().GetURL(
28 "files/local_ntp_browsertest.html?strk=1&"); 27 "files/local_ntp_browsertest.html?strk=1&");
29 InstantTestBase::Init(instant_url, false); 28 InstantTestBase::Init(instant_url, false);
30 } 29 }
31 }; 30 };
32 31
33 // Flaky: crbug.com/267117 32 // Flaky: crbug.com/267117
34 IN_PROC_BROWSER_TEST_F(LocalNTPTest, DISABLED_LocalNTPJavascriptTest) { 33 IN_PROC_BROWSER_TEST_F(LocalNTPTest, DISABLED_LocalNTPJavascriptTest) {
35 ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); 34 ASSERT_NO_FATAL_FAILURE(SetupInstant(browser()));
36 FocusOmniboxAndWaitForInstantNTPSupport(); 35 FocusOmniboxAndWaitForInstantNTPSupport();
37 36
38 ui_test_utils::NavigateToURLWithDisposition( 37 ui_test_utils::NavigateToURLWithDisposition(
39 browser(), 38 browser(),
40 instant_url(), 39 instant_url(),
41 NEW_FOREGROUND_TAB, 40 NEW_FOREGROUND_TAB,
42 ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB | 41 ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB |
43 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); 42 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
44 content::WebContents* active_tab = 43 content::WebContents* active_tab =
45 browser()->tab_strip_model()->GetActiveWebContents(); 44 browser()->tab_strip_model()->GetActiveWebContents();
46 ASSERT_TRUE(chrome::IsInstantNTP(active_tab)); 45 ASSERT_TRUE(chrome::IsInstantNTP(active_tab));
47 bool success = false; 46 bool success = false;
48 ASSERT_TRUE(GetBoolFromJS(active_tab, "!!runTests()", &success)); 47 ASSERT_TRUE(GetBoolFromJS(active_tab, "!!runTests()", &success));
49 EXPECT_TRUE(success); 48 EXPECT_TRUE(success);
50 } 49 }
51 50
52 // Flaky on Linux Tests bot. 51 // Flaky.
53 #if defined(OS_LINUX) 52 IN_PROC_BROWSER_TEST_F(LocalNTPTest,
54 #define MAYBE_NTPRespectsBrowserLanguageSetting DISABLED_NTPRespectsBrowserLangu ageSetting 53 DISABLED_NTPRespectsBrowserLanguageSetting) {
55 #else
56 #define MAYBE_NTPRespectsBrowserLanguageSetting NTPRespectsBrowserLanguageSettin g
57 #endif
58 IN_PROC_BROWSER_TEST_F(LocalNTPTest, MAYBE_NTPRespectsBrowserLanguageSetting) {
59 // Make sure the default language is not French. 54 // Make sure the default language is not French.
60 std::string default_locale = g_browser_process->GetApplicationLocale(); 55 std::string default_locale = g_browser_process->GetApplicationLocale();
61 EXPECT_NE("fr", default_locale); 56 EXPECT_NE("fr", default_locale);
62 57
63 // Switch browser language to French. 58 // Switch browser language to French.
64 std::string loaded_locale = 59 std::string loaded_locale =
65 ui::ResourceBundle::GetSharedInstance().ReloadLocaleResources("fr"); 60 ui::ResourceBundle::GetSharedInstance().ReloadLocaleResources("fr");
66 EXPECT_EQ("fr", loaded_locale); 61 EXPECT_EQ("fr", loaded_locale);
67 g_browser_process->SetApplicationLocale(loaded_locale); 62 g_browser_process->SetApplicationLocale(loaded_locale);
68 PrefService* prefs = g_browser_process->local_state(); 63 PrefService* prefs = g_browser_process->local_state();
69 prefs->SetString(prefs::kApplicationLocale, loaded_locale); 64 prefs->SetString(prefs::kApplicationLocale, loaded_locale);
70 65
71 // Setup Instant. 66 // Setup Instant.
72 ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); 67 ASSERT_NO_FATAL_FAILURE(SetupInstant(browser()));
73 FocusOmniboxAndWaitForInstantNTPSupport(); 68 FocusOmniboxAndWaitForInstantNTPSupport();
74 69
75 // Open a new tab. 70 // Open a new tab.
76 ui_test_utils::NavigateToURLWithDisposition( 71 ui_test_utils::NavigateToURLWithDisposition(
77 browser(), 72 browser(),
78 GURL(chrome::kChromeUINewTabURL), 73 GURL(chrome::kChromeUINewTabURL),
79 NEW_FOREGROUND_TAB, 74 NEW_FOREGROUND_TAB,
80 ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB | 75 ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB |
81 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); 76 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
82 77
83 // Verify that the NTP is in French. 78 // Verify that the NTP is in French.
84 content::WebContents* active_tab = 79 content::WebContents* active_tab =
85 browser()->tab_strip_model()->GetActiveWebContents(); 80 browser()->tab_strip_model()->GetActiveWebContents();
86 EXPECT_EQ(ASCIIToUTF16("Nouvel onglet"), active_tab->GetTitle()); 81 EXPECT_EQ(ASCIIToUTF16("Nouvel onglet"), active_tab->GetTitle());
87 } 82 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/search/instant_test_utils.cc ('k') | chrome/browser/ui/search/search_delegate_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698