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

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: 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 suggestions are not accepted when unexpected.
1434 IN_PROC_BROWSER_TEST_F(InstantExtendedTest, DeniesUnexpectedSuggestions) {
1435 ASSERT_NO_FATAL_FAILURE(SetupInstant(browser()));
1436 FocusOmniboxAndWaitForInstantExtendedSupport();
1437 SetOmniboxTextAndWaitForOverlayToShow("chip");
1438 SendDownArrow();
1439
1440 EXPECT_EQ("result 1", GetOmniboxText());
1441 EXPECT_EQ(ASCIIToUTF16(""), GetGrayText());
1442
1443 // Make the page send an unexpected suggestion.
1444 EXPECT_TRUE(ExecuteScript("suggestion = 'chippies';"
1445 "handleOnChange();"));
1446
1447 // Verify that the suggestion is ignored.
1448 EXPECT_EQ("result 1", GetOmniboxText());
1449 EXPECT_EQ(ASCIIToUTF16(""), GetGrayText());
1450 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698