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

Unified Diff: chrome/browser/instant/instant_browsertest.cc

Issue 6685002: Wires up ability for page to specify instant auto complete (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix unit test and stray char Created 9 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/instant/instant_browsertest.cc
diff --git a/chrome/browser/instant/instant_browsertest.cc b/chrome/browser/instant/instant_browsertest.cc
index c175eb6fd75e0debde3706854331e45169bad81d..1ecce317b1d7151bb5e1e9a8af818511ecbe64e1 100644
--- a/chrome/browser/instant/instant_browsertest.cc
+++ b/chrome/browser/instant/instant_browsertest.cc
@@ -5,6 +5,7 @@
#include "base/command_line.h"
#include "base/stringprintf.h"
#include "base/utf_string_conversions.h"
+#include "chrome/browser/autocomplete/autocomplete_edit.h"
#include "chrome/browser/autocomplete/autocomplete_edit_view.h"
#include "chrome/browser/browser_list.h"
#include "chrome/browser/browser_window.h"
@@ -690,3 +691,37 @@ IN_PROC_BROWSER_TEST_F(InstantTest, ShowAboutCrash) {
// If we get here it means the preview was shown. If we time out, it means the
// preview was never shown.
}
+
+IN_PROC_BROWSER_TEST_F(InstantTest, InstantCompleteNever) {
Peter Kasting 2011/03/29 00:10:27 Is testing INSTANT_COMPLETE_NOW what all the rest
sky 2011/03/29 00:11:20 Yes, since that's the default.
+ ASSERT_TRUE(test_server()->Start());
+ EnableInstant();
+ ASSERT_NO_FATAL_FAILURE(SetupInstantProvider("search.html"));
+ ASSERT_NO_FATAL_FAILURE(SetupLocationBar());
+ ASSERT_NO_FATAL_FAILURE(SetupPreview());
+
+ SetSuggestionsJavascriptArgument(
+ preview_,
+ "{suggestions:[{value:'defghij'}],complete_behavior:'never'}");
+ ASSERT_NO_FATAL_FAILURE(SetLocationBarText("def"));
+ EXPECT_STR_EQ("defghij", GetSuggestion());
+ AutocompleteEditModel* edit_model = location_bar_->location_entry()->model();
+ EXPECT_EQ(INSTANT_COMPLETE_NEVER, edit_model->instant_complete_behavior());
+ ASSERT_EQ(ASCIIToUTF16("def"), location_bar_->location_entry()->GetText());
+}
+
+IN_PROC_BROWSER_TEST_F(InstantTest, InstantCompleteDelayed) {
+ ASSERT_TRUE(test_server()->Start());
+ EnableInstant();
+ ASSERT_NO_FATAL_FAILURE(SetupInstantProvider("search.html"));
+ ASSERT_NO_FATAL_FAILURE(SetupLocationBar());
+ ASSERT_NO_FATAL_FAILURE(SetupPreview());
+
+ SetSuggestionsJavascriptArgument(
+ preview_,
+ "{suggestions:[{value:'defghij'}],complete_behavior:'delayed'}");
+ ASSERT_NO_FATAL_FAILURE(SetLocationBarText("def"));
+ EXPECT_STR_EQ("defghij", GetSuggestion());
+ AutocompleteEditModel* edit_model = location_bar_->location_entry()->model();
+ EXPECT_EQ(INSTANT_COMPLETE_DELAYED, edit_model->instant_complete_behavior());
+ ASSERT_EQ(ASCIIToUTF16("def"), location_bar_->location_entry()->GetText());
+}

Powered by Google App Engine
This is Rietveld 408576698