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

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

Issue 13141002: Use Instant suggested match type for Instant temporary text. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: const string16& Created 7 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 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 <sstream> 5 #include <sstream>
6 6
7 #include "base/prefs/pref_service.h" 7 #include "base/prefs/pref_service.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/stringprintf.h" 9 #include "base/stringprintf.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 1411 matching lines...) Expand 10 before | Expand all | Expand 10 after
1422 ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); 1422 ASSERT_NO_FATAL_FAILURE(SetupInstant(browser()));
1423 1423
1424 EXPECT_EQ(instant_url(), instant()->ntp_->contents()->GetURL()); 1424 EXPECT_EQ(instant_url(), instant()->ntp_->contents()->GetURL());
1425 1425
1426 // The second argument says to use only the local overlay. 1426 // The second argument says to use only the local overlay.
1427 instant()->SetInstantEnabled(false, true); 1427 instant()->SetInstantEnabled(false, true);
1428 1428
1429 EXPECT_EQ(GURL(chrome::kChromeSearchLocalNtpUrl), 1429 EXPECT_EQ(GURL(chrome::kChromeSearchLocalNtpUrl),
1430 instant()->ntp_->contents()->GetURL()); 1430 instant()->ntp_->contents()->GetURL());
1431 } 1431 }
1432
1433 // Test that if Instant alters the input from URL to search, it's respected.
1434 IN_PROC_BROWSER_TEST_F(InstantExtendedTest, InputChangedFromURLToSearch) {
1435 ASSERT_NO_FATAL_FAILURE(SetupInstant(browser()));
1436 FocusOmniboxAndWaitForInstantExtendedSupport();
1437
1438 content::WebContents* overlay = instant()->GetOverlayContents();
1439 EXPECT_TRUE(ExecuteScript("suggestions = ['mcqueen.com'];"));
1440
1441 SetOmniboxTextAndWaitForOverlayToShow("lightning");
1442 EXPECT_EQ("lightning", GetOmniboxText());
1443
1444 SendDownArrow();
1445 EXPECT_EQ("mcqueen.com", GetOmniboxText());
1446
1447 // Press Enter.
1448 browser()->window()->GetLocationBar()->AcceptInput();
1449
1450 // Confirm that the Instant overlay was committed.
1451 EXPECT_EQ(overlay, browser()->tab_strip_model()->GetActiveWebContents());
1452 }
1453
1454 // Test that if Instant alters the input from search to URL, it's respected.
1455 IN_PROC_BROWSER_TEST_F(InstantExtendedTest, InputChangedFromSearchToURL) {
1456 ASSERT_NO_FATAL_FAILURE(SetupInstant(browser()));
1457 FocusOmniboxAndWaitForInstantExtendedSupport();
1458
1459 content::WebContents* overlay = instant()->GetOverlayContents();
1460 EXPECT_TRUE(ExecuteScript("suggestionType = 1;")); // INSTANT_SUGGESTION_URL
1461
1462 SetOmniboxTextAndWaitForOverlayToShow("mack.com");
1463 EXPECT_EQ("mack.com", GetOmniboxText());
1464
1465 SendDownArrow();
1466 EXPECT_EQ("result 1", GetOmniboxText());
1467
1468 // Press Enter.
1469 browser()->window()->GetLocationBar()->AcceptInput();
1470
1471 // Confirm that the Instant overlay was NOT committed.
1472 EXPECT_NE(overlay, browser()->tab_strip_model()->GetActiveWebContents());
1473 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698