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

Side by Side Diff: chrome/browser/chrome_content_browser_client_browsertest.cc

Issue 23455047: InstantExtended: Send search URLs to renderers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More browsertest fixes Created 7 years, 2 months 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
« no previous file with comments | « no previous file | chrome/browser/search/instant_service.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/command_line.h" 5 #include "base/command_line.h"
6 #include "base/metrics/field_trial.h" 6 #include "base/metrics/field_trial.h"
7 #include "chrome/browser/search/search.h" 7 #include "chrome/browser/search/search.h"
8 #include "chrome/browser/search_engines/template_url_service.h" 8 #include "chrome/browser/search_engines/template_url_service.h"
9 #include "chrome/browser/search_engines/template_url_service_factory.h" 9 #include "chrome/browser/search_engines/template_url_service_factory.h"
10 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 const GURL url("chrome://chrome//foo"); 87 const GURL url("chrome://chrome//foo");
88 88
89 ui_test_utils::NavigateToURL(browser(), url); 89 ui_test_utils::NavigateToURL(browser(), url);
90 NavigationEntry* entry = GetLastCommittedEntry(); 90 NavigationEntry* entry = GetLastCommittedEntry();
91 91
92 ASSERT_TRUE(entry != NULL); 92 ASSERT_TRUE(entry != NULL);
93 EXPECT_TRUE(entry->GetVirtualURL().is_valid()); 93 EXPECT_TRUE(entry->GetVirtualURL().is_valid());
94 EXPECT_EQ(url, entry->GetVirtualURL()); 94 EXPECT_EQ(url, entry->GetVirtualURL());
95 } 95 }
96 96
97 IN_PROC_BROWSER_TEST_F(ChromeContentBrowserClientBrowserTest, 97 class InstantNTPURLRewriteTest : public ChromeContentBrowserClientBrowserTest {
98 public:
99 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
100 // browsertest initially spins up a non-Instant renderer for about:blank.
101 // In a real browser, navigating this renderer to the Instant new tab page
102 // forks a new privileged Instant render process, but that warps
103 // browsertest's fragile little mind; it just never navigates. We aren't
104 // trying to test the process model here, so turn it off.
105 CommandLine::ForCurrentProcess()->AppendSwitch(switches::kSingleProcess);
106 }
107 };
108
109 IN_PROC_BROWSER_TEST_F(InstantNTPURLRewriteTest,
98 UberURLHandler_InstantExtendedNewTabPage) { 110 UberURLHandler_InstantExtendedNewTabPage) {
99 const GURL url_original("chrome://newtab"); 111 const GURL url_original("chrome://newtab");
100 const GURL url_rewritten("http://example.com/newtab"); 112 const GURL url_rewritten("http://example.com/newtab");
101 InstallTemplateURLWithNewTabPage(url_rewritten); 113 InstallTemplateURLWithNewTabPage(url_rewritten);
102 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial("InstantExtended", 114 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial("InstantExtended",
103 "Group1 use_cacheable_ntp:1")); 115 "Group1 use_cacheable_ntp:1"));
104 chrome::EnableInstantExtendedAPIForTesting(); 116 chrome::EnableInstantExtendedAPIForTesting();
105 117
106 ui_test_utils::NavigateToURL(browser(), url_original); 118 ui_test_utils::NavigateToURL(browser(), url_original);
107 NavigationEntry* entry = GetLastCommittedEntry(); 119 NavigationEntry* entry = GetLastCommittedEntry();
108 120
109 ASSERT_TRUE(entry != NULL); 121 ASSERT_TRUE(entry != NULL);
110 EXPECT_EQ(url_rewritten, entry->GetURL()); 122 EXPECT_EQ(url_rewritten, entry->GetURL());
111 EXPECT_EQ(url_original, entry->GetVirtualURL()); 123 EXPECT_EQ(url_original, entry->GetVirtualURL());
112 } 124 }
113 125
114 IN_PROC_BROWSER_TEST_F(ChromeContentBrowserClientBrowserTest, 126 IN_PROC_BROWSER_TEST_F(ChromeContentBrowserClientBrowserTest,
115 UberURLHandler_InstantExtendedNewTabPageDisabled) { 127 UberURLHandler_InstantExtendedNewTabPageDisabled) {
128 // Don't do the kSingleProcess shenanigans here (see the dual test) because
129 // otherwise RenderViewImpl crashes in a paranoid fit on startup.
116 const GURL url_original("chrome://newtab"); 130 const GURL url_original("chrome://newtab");
117 const GURL url_rewritten("http://example.com/newtab"); 131 const GURL url_rewritten("http://example.com/newtab");
118 InstallTemplateURLWithNewTabPage(url_rewritten); 132 InstallTemplateURLWithNewTabPage(url_rewritten);
119 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial("InstantExtended", 133 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial("InstantExtended",
120 "Group1 use_cacheable_ntp:1")); 134 "Group1 use_cacheable_ntp:1"));
121 chrome::DisableInstantExtendedAPIForTesting(); 135 chrome::DisableInstantExtendedAPIForTesting();
122 136
123 ui_test_utils::NavigateToURL(browser(), url_original); 137 ui_test_utils::NavigateToURL(browser(), url_original);
124 NavigationEntry* entry = GetLastCommittedEntry(); 138 NavigationEntry* entry = GetLastCommittedEntry();
125 139
(...skipping 14 matching lines...) Expand all
140 154
141 ui_test_utils::NavigateToURL(browser(), url); 155 ui_test_utils::NavigateToURL(browser(), url);
142 NavigationEntry* entry = GetLastCommittedEntry(); 156 NavigationEntry* entry = GetLastCommittedEntry();
143 157
144 ASSERT_TRUE(entry != NULL); 158 ASSERT_TRUE(entry != NULL);
145 EXPECT_EQ(url, entry->GetURL()); 159 EXPECT_EQ(url, entry->GetURL());
146 EXPECT_EQ(url, entry->GetVirtualURL()); 160 EXPECT_EQ(url, entry->GetVirtualURL());
147 } 161 }
148 162
149 } // namespace content 163 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/search/instant_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698