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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "base/format_macros.h" 5 #include "base/format_macros.h"
6 #include "base/string_util.h" 6 #include "base/string_util.h"
7 #include "base/stringprintf.h" 7 #include "base/stringprintf.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/autocomplete/autocomplete.h" 9 #include "chrome/browser/autocomplete/autocomplete.h"
10 #include "chrome/browser/autocomplete/autocomplete_edit.h" 10 #include "chrome/browser/autocomplete/autocomplete_edit.h"
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 193
194 { 194 {
195 ResultCatcher catcher; 195 ResultCatcher catcher;
196 autocomplete_controller->Start( 196 autocomplete_controller->Start(
197 ASCIIToUTF16("keyword command"), string16(), true, false, true, 197 ASCIIToUTF16("keyword command"), string16(), true, false, true,
198 AutocompleteInput::ALL_MATCHES); 198 AutocompleteInput::ALL_MATCHES);
199 location_bar->AcceptInput(); 199 location_bar->AcceptInput();
200 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); 200 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message();
201 } 201 }
202 } 202 }
203
204 // Tests that the autocomplete popup doesn't reopen after accepting input for
205 // a given query.
206 // http://crbug.com/88552
207 IN_PROC_BROWSER_TEST_F(OmniboxApiTest, PopupStaysClosed) {
208 #if defined(TOOLKIT_GTK)
209 // Disable the timer because, on Lucid at least, it triggers resize/move
210 // behavior in the browser window, which dismisses the autocomplete popup
211 // before the results can be read.
212 static_cast<BrowserWindowGtk*>(
213 browser()->window())->DisableDebounceTimerForTests(true);
214 #endif
215
216 ASSERT_TRUE(test_server()->Start());
217 ASSERT_TRUE(RunExtensionTest("omnibox")) << message_;
218
219 // The results depend on the TemplateURLService being loaded. Make sure it is
220 // loaded so that the autocomplete results are consistent.
221 WaitForTemplateURLServiceToLoad();
222
223 LocationBar* location_bar = GetLocationBar();
224 AutocompleteController* autocomplete_controller = GetAutocompleteController();
225 AutocompletePopupModel* popup_model =
226 GetLocationBar()->location_entry()->model()->popup_model();
227
228 // Input a keyword query and wait for suggestions from the extension.
229 autocomplete_controller->Start(
230 ASCIIToUTF16("keyword comman"), string16(), true, false, true,
231 AutocompleteInput::ALL_MATCHES);
232 WaitForAutocompleteDone(autocomplete_controller);
233 EXPECT_TRUE(autocomplete_controller->done());
234 EXPECT_TRUE(popup_model->IsOpen());
235
236 // Quickly type another query and accept it before getting suggestions back
237 // for the query. The popup will close after accepting input - ensure that it
238 // does not reopen when the extension returns its suggestions.
239 ResultCatcher catcher;
240 autocomplete_controller->Start(
241 ASCIIToUTF16("keyword command"), string16(), true, false, true,
242 AutocompleteInput::ALL_MATCHES);
243 location_bar->AcceptInput();
244 WaitForAutocompleteDone(autocomplete_controller);
245 EXPECT_TRUE(autocomplete_controller->done());
246 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message();
247 EXPECT_FALSE(popup_model->IsOpen());
248 }
OLDNEW
« 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