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()); |
+} |