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

Unified Diff: chrome/browser/extensions/extension_omnibox_apitest.cc

Issue 7307033: Fix a regression where the omnibox would re-enter extension keyword mode after (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: final comment Created 9 years, 5 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/extensions/extension_omnibox_apitest.cc
diff --git a/chrome/browser/extensions/extension_omnibox_apitest.cc b/chrome/browser/extensions/extension_omnibox_apitest.cc
index f66c48e0f7fab20c2752d3efc42be8402f4ce09e..ba762ca404659fef7bb6417c841c7b26e9acdf74 100644
--- a/chrome/browser/extensions/extension_omnibox_apitest.cc
+++ b/chrome/browser/extensions/extension_omnibox_apitest.cc
@@ -200,3 +200,49 @@ IN_PROC_BROWSER_TEST_F(OmniboxApiTest, MAYBE_Basic) {
EXPECT_TRUE(catcher.GetNextResult()) << catcher.message();
}
}
+
+// Tests that the autocomplete popup doesn't reopen after accepting input for
+// a given query.
+// http://crbug.com/88552
+IN_PROC_BROWSER_TEST_F(OmniboxApiTest, PopupStaysClosed) {
+#if defined(TOOLKIT_GTK)
+ // Disable the timer because, on Lucid at least, it triggers resize/move
+ // behavior in the browser window, which dismisses the autocomplete popup
+ // before the results can be read.
+ static_cast<BrowserWindowGtk*>(
+ browser()->window())->DisableDebounceTimerForTests(true);
+#endif
+
+ ASSERT_TRUE(test_server()->Start());
+ ASSERT_TRUE(RunExtensionTest("omnibox")) << message_;
+
+ // The results depend on the TemplateURLService being loaded. Make sure it is
+ // loaded so that the autocomplete results are consistent.
+ WaitForTemplateURLServiceToLoad();
+
+ LocationBar* location_bar = GetLocationBar();
+ AutocompleteController* autocomplete_controller = GetAutocompleteController();
+ AutocompletePopupModel* popup_model =
+ GetLocationBar()->location_entry()->model()->popup_model();
+
+ // Input a keyword query and wait for suggestions from the extension.
+ autocomplete_controller->Start(
+ ASCIIToUTF16("keyword comman"), string16(), true, false, true,
+ AutocompleteInput::ALL_MATCHES);
+ WaitForAutocompleteDone(autocomplete_controller);
+ EXPECT_TRUE(autocomplete_controller->done());
+ EXPECT_TRUE(popup_model->IsOpen());
+
+ // Quickly type another query and accept it before getting suggestions back
+ // for the query. The popup will close after accepting input - ensure that it
+ // does not reopen when the extension returns its suggestions.
+ ResultCatcher catcher;
+ autocomplete_controller->Start(
+ ASCIIToUTF16("keyword command"), string16(), true, false, true,
+ AutocompleteInput::ALL_MATCHES);
+ location_bar->AcceptInput();
+ WaitForAutocompleteDone(autocomplete_controller);
+ EXPECT_TRUE(autocomplete_controller->done());
+ EXPECT_TRUE(catcher.GetNextResult()) << catcher.message();
+ EXPECT_FALSE(popup_model->IsOpen());
+}
« no previous file with comments | « chrome/browser/autocomplete/keyword_provider.cc ('k') | chrome/test/data/extensions/api_test/omnibox/test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698