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 1630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1641 // lose focus. Close the popup explicitly, to workaround test/toolkit issues. | 1641 // lose focus. Close the popup explicitly, to workaround test/toolkit issues. |
1642 ui_test_utils::ClickOnView(browser(), VIEW_ID_TOOLBAR); | 1642 ui_test_utils::ClickOnView(browser(), VIEW_ID_TOOLBAR); |
1643 omnibox()->CloseOmniboxPopup(); | 1643 omnibox()->CloseOmniboxPopup(); |
1644 EXPECT_FALSE(HasTemporaryText()); | 1644 EXPECT_FALSE(HasTemporaryText()); |
1645 | 1645 |
1646 EXPECT_EQ(overlay, instant()->GetOverlayContents()); | 1646 EXPECT_EQ(overlay, instant()->GetOverlayContents()); |
1647 EXPECT_TRUE(UpdateSearchState(overlay)); | 1647 EXPECT_TRUE(UpdateSearchState(overlay)); |
1648 EXPECT_EQ(0, on_change_calls_); | 1648 EXPECT_EQ(0, on_change_calls_); |
1649 EXPECT_EQ(0, on_native_suggestions_calls_); | 1649 EXPECT_EQ(0, on_native_suggestions_calls_); |
1650 } | 1650 } |
| 1651 |
| 1652 // Test that suggestions are not accepted when unexpected. |
| 1653 IN_PROC_BROWSER_TEST_F(InstantExtendedTest, DeniesUnexpectedSuggestions) { |
| 1654 ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); |
| 1655 FocusOmniboxAndWaitForInstantExtendedSupport(); |
| 1656 SetOmniboxTextAndWaitForOverlayToShow("chip"); |
| 1657 SendDownArrow(); |
| 1658 |
| 1659 EXPECT_EQ("result 1", GetOmniboxText()); |
| 1660 EXPECT_EQ(ASCIIToUTF16(""), GetGrayText()); |
| 1661 |
| 1662 // Make the page send an unexpected suggestion. |
| 1663 EXPECT_TRUE(ExecuteScript("suggestion = 'chippies';" |
| 1664 "handleOnChange();")); |
| 1665 |
| 1666 // Verify that the suggestion is ignored. |
| 1667 EXPECT_EQ("result 1", GetOmniboxText()); |
| 1668 EXPECT_EQ(ASCIIToUTF16(""), GetGrayText()); |
| 1669 } |
OLD | NEW |