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

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

Issue 13813006: Instant: Don't allow the page to set suggestions inappropriately. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase 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
« no previous file with comments | « chrome/browser/ui/search/instant_controller.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1630 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/search/instant_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698