| 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 <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 1418 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1429   ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); |  1429   ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); | 
|  1430  |  1430  | 
|  1431   EXPECT_EQ(instant_url(), instant()->ntp_->contents()->GetURL()); |  1431   EXPECT_EQ(instant_url(), instant()->ntp_->contents()->GetURL()); | 
|  1432  |  1432  | 
|  1433   // The second argument says to use only the local overlay. |  1433   // The second argument says to use only the local overlay. | 
|  1434   instant()->SetInstantEnabled(false, true); |  1434   instant()->SetInstantEnabled(false, true); | 
|  1435  |  1435  | 
|  1436   EXPECT_EQ(GURL(chrome::kChromeSearchLocalNtpUrl), |  1436   EXPECT_EQ(GURL(chrome::kChromeSearchLocalNtpUrl), | 
|  1437             instant()->ntp_->contents()->GetURL()); |  1437             instant()->ntp_->contents()->GetURL()); | 
|  1438 } |  1438 } | 
 |  1439  | 
 |  1440 // Test that if Instant alters the input from URL to search, it's respected. | 
 |  1441 IN_PROC_BROWSER_TEST_F(InstantExtendedTest, InputChangedFromURLToSearch) { | 
 |  1442   ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); | 
 |  1443   FocusOmniboxAndWaitForInstantExtendedSupport(); | 
 |  1444  | 
 |  1445   content::WebContents* overlay = instant()->GetOverlayContents(); | 
 |  1446   EXPECT_TRUE(ExecuteScript("suggestions = ['mcqueen.com'];")); | 
 |  1447  | 
 |  1448   SetOmniboxTextAndWaitForOverlayToShow("lightning"); | 
 |  1449   EXPECT_EQ("lightning", GetOmniboxText()); | 
 |  1450  | 
 |  1451   SendDownArrow(); | 
 |  1452   EXPECT_EQ("mcqueen.com", GetOmniboxText()); | 
 |  1453  | 
 |  1454   // Press Enter. | 
 |  1455   browser()->window()->GetLocationBar()->AcceptInput(); | 
 |  1456  | 
 |  1457   // Confirm that the Instant overlay was committed. | 
 |  1458   EXPECT_EQ(overlay, browser()->tab_strip_model()->GetActiveWebContents()); | 
 |  1459 } | 
 |  1460  | 
 |  1461 // Test that if Instant alters the input from search to URL, it's respected. | 
 |  1462 IN_PROC_BROWSER_TEST_F(InstantExtendedTest, InputChangedFromSearchToURL) { | 
 |  1463   ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); | 
 |  1464   FocusOmniboxAndWaitForInstantExtendedSupport(); | 
 |  1465  | 
 |  1466   content::WebContents* overlay = instant()->GetOverlayContents(); | 
 |  1467   EXPECT_TRUE(ExecuteScript("suggestionType = 1;"));  // INSTANT_SUGGESTION_URL | 
 |  1468  | 
 |  1469   SetOmniboxTextAndWaitForOverlayToShow("mack.com"); | 
 |  1470   EXPECT_EQ("mack.com", GetOmniboxText()); | 
 |  1471  | 
 |  1472   SendDownArrow(); | 
 |  1473   EXPECT_EQ("result 1", GetOmniboxText()); | 
 |  1474  | 
 |  1475   // Press Enter. | 
 |  1476   browser()->window()->GetLocationBar()->AcceptInput(); | 
 |  1477  | 
 |  1478   // Confirm that the Instant overlay was NOT committed. | 
 |  1479   EXPECT_NE(overlay, browser()->tab_strip_model()->GetActiveWebContents()); | 
 |  1480 } | 
| OLD | NEW |