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

Side by Side Diff: chrome/browser/instant/instant_browsertest.cc

Issue 9968016: Move the URL string from TemplateURLRef onto the owning TemplateURL. This will make it easier to m… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 8 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
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/string_util.h" 6 #include "base/string_util.h"
7 #include "base/stringprintf.h" 7 #include "base/stringprintf.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/autocomplete/autocomplete_edit.h" 9 #include "chrome/browser/autocomplete/autocomplete_edit.h"
10 #include "chrome/browser/content_settings/host_content_settings_map.h" 10 #include "chrome/browser/content_settings/host_content_settings_map.h"
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 EXPECT_TRUE(instant()->is_displayable()); 275 EXPECT_TRUE(instant()->is_displayable());
276 EXPECT_TRUE(instant()->IsCurrent()); 276 EXPECT_TRUE(instant()->IsCurrent());
277 EXPECT_EQ("defghi", UTF16ToUTF8(omnibox()->GetText())); 277 EXPECT_EQ("defghi", UTF16ToUTF8(omnibox()->GetText()));
278 278
279 // Make sure the URL that will get committed when we press <Enter> matches 279 // Make sure the URL that will get committed when we press <Enter> matches
280 // that of the default search provider. 280 // that of the default search provider.
281 const TemplateURL* default_turl = 281 const TemplateURL* default_turl =
282 TemplateURLServiceFactory::GetForProfile(browser()->profile())-> 282 TemplateURLServiceFactory::GetForProfile(browser()->profile())->
283 GetDefaultSearchProvider(); 283 GetDefaultSearchProvider();
284 EXPECT_TRUE(default_turl); 284 EXPECT_TRUE(default_turl);
285 EXPECT_TRUE(default_turl->url()); 285 EXPECT_EQ(default_turl->url_ref().ReplaceSearchTerms(ASCIIToUTF16("defghi"),
286 EXPECT_EQ(default_turl->url()->ReplaceSearchTerms(ASCIIToUTF16("defghi"), 0, 286 0, string16()), loader()->url().spec());
287 string16()), loader()->url().spec());
288 287
289 // Check that the value is reflected and onchange is called. 288 // Check that the value is reflected and onchange is called.
290 EXPECT_EQ("true 0 0 1 true d false def false 3 3", 289 EXPECT_EQ("true 0 0 1 true d false def false 3 3",
291 GetSearchStateAsString(preview()->web_contents(), false)); 290 GetSearchStateAsString(preview()->web_contents(), false));
292 } 291 }
293 292
294 // Verify that the onsubmit event is dispatched upon pressing <Enter>. 293 // Verify that the onsubmit event is dispatched upon pressing <Enter>.
295 IN_PROC_BROWSER_TEST_F(InstantTest, MAYBE(OnSubmitEvent)) { 294 IN_PROC_BROWSER_TEST_F(InstantTest, MAYBE(OnSubmitEvent)) {
296 ASSERT_TRUE(test_server()->Start()); 295 ASSERT_TRUE(test_server()->Start());
297 EnableInstant(); 296 EnableInstant();
(...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after
1001 // Press <Enter> in the omnibox, causing the preview to be committed. 1000 // Press <Enter> in the omnibox, causing the preview to be committed.
1002 WebContents* preview_tab = preview()->web_contents(); 1001 WebContents* preview_tab = preview()->web_contents();
1003 ASSERT_TRUE(PressEnter()); 1002 ASSERT_TRUE(PressEnter());
1004 1003
1005 // The preview contents should now be the active tab contents. 1004 // The preview contents should now be the active tab contents.
1006 EXPECT_FALSE(preview()); 1005 EXPECT_FALSE(preview());
1007 EXPECT_FALSE(instant()->is_displayable()); 1006 EXPECT_FALSE(instant()->is_displayable());
1008 EXPECT_FALSE(instant()->IsCurrent()); 1007 EXPECT_FALSE(instant()->IsCurrent());
1009 EXPECT_EQ(preview_tab, browser()->GetSelectedWebContents()); 1008 EXPECT_EQ(preview_tab, browser()->GetSelectedWebContents());
1010 } 1009 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698