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

Side by Side Diff: chrome/browser/extensions/api/omnibox/omnibox_api_interactive_test.cc

Issue 555633003: Use extensions::ResultCatcher; delete ExtensionApiTest::ResultCatcher. (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Created 6 years, 3 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h" 5 #include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h"
6 #include "chrome/browser/extensions/api/omnibox/omnibox_api_testbase.h" 6 #include "chrome/browser/extensions/api/omnibox/omnibox_api_testbase.h"
7 #include "chrome/browser/search_engines/template_url_service_factory.h" 7 #include "chrome/browser/search_engines/template_url_service_factory.h"
8 #include "chrome/test/base/ui_test_utils.h" 8 #include "chrome/test/base/ui_test_utils.h"
9 #include "components/metrics/proto/omnibox_event.pb.h" 9 #include "components/metrics/proto/omnibox_event.pb.h"
10 10 #include "extensions/test/result_catcher.h"
11 11
12 // Tests that the autocomplete popup doesn't reopen after accepting input for 12 // Tests that the autocomplete popup doesn't reopen after accepting input for
13 // a given query. 13 // a given query.
14 // http://crbug.com/88552 14 // http://crbug.com/88552
15 IN_PROC_BROWSER_TEST_F(OmniboxApiTest, PopupStaysClosed) { 15 IN_PROC_BROWSER_TEST_F(OmniboxApiTest, PopupStaysClosed) {
16 ASSERT_TRUE(RunExtensionTest("omnibox")) << message_; 16 ASSERT_TRUE(RunExtensionTest("omnibox")) << message_;
17 17
18 // The results depend on the TemplateURLService being loaded. Make sure it is 18 // The results depend on the TemplateURLService being loaded. Make sure it is
19 // loaded so that the autocomplete results are consistent. 19 // loaded so that the autocomplete results are consistent.
20 Profile* profile = browser()->profile(); 20 Profile* profile = browser()->profile();
(...skipping 10 matching lines...) Expand all
31 omnibox_view->OnBeforePossibleChange(); 31 omnibox_view->OnBeforePossibleChange();
32 omnibox_view->SetUserText(base::ASCIIToUTF16("keyword comman")); 32 omnibox_view->SetUserText(base::ASCIIToUTF16("keyword comman"));
33 omnibox_view->OnAfterPossibleChange(); 33 omnibox_view->OnAfterPossibleChange();
34 WaitForAutocompleteDone(autocomplete_controller); 34 WaitForAutocompleteDone(autocomplete_controller);
35 EXPECT_TRUE(autocomplete_controller->done()); 35 EXPECT_TRUE(autocomplete_controller->done());
36 EXPECT_TRUE(popup_model->IsOpen()); 36 EXPECT_TRUE(popup_model->IsOpen());
37 37
38 // Quickly type another query and accept it before getting suggestions back 38 // Quickly type another query and accept it before getting suggestions back
39 // for the query. The popup will close after accepting input - ensure that it 39 // for the query. The popup will close after accepting input - ensure that it
40 // does not reopen when the extension returns its suggestions. 40 // does not reopen when the extension returns its suggestions.
41 ResultCatcher catcher; 41 extensions::ResultCatcher catcher;
42 42
43 // TODO: Rather than send this second request by talking to the controller 43 // TODO: Rather than send this second request by talking to the controller
44 // directly, figure out how to send it via the proper calls to 44 // directly, figure out how to send it via the proper calls to
45 // location_bar or location_bar->(). 45 // location_bar or location_bar->().
46 autocomplete_controller->Start(AutocompleteInput( 46 autocomplete_controller->Start(AutocompleteInput(
47 base::ASCIIToUTF16("keyword command"), base::string16::npos, 47 base::ASCIIToUTF16("keyword command"), base::string16::npos,
48 base::string16(), GURL(), metrics::OmniboxEventProto::NTP, true, false, 48 base::string16(), GURL(), metrics::OmniboxEventProto::NTP, true, false,
49 true, true, ChromeAutocompleteSchemeClassifier(profile))); 49 true, true, ChromeAutocompleteSchemeClassifier(profile)));
50 location_bar->AcceptInput(); 50 location_bar->AcceptInput();
51 WaitForAutocompleteDone(autocomplete_controller); 51 WaitForAutocompleteDone(autocomplete_controller);
52 EXPECT_TRUE(autocomplete_controller->done()); 52 EXPECT_TRUE(autocomplete_controller->done());
53 // This checks that the keyword provider (via javascript) 53 // This checks that the keyword provider (via javascript)
54 // gets told to navigate to the string "command". 54 // gets told to navigate to the string "command".
55 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); 55 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message();
56 EXPECT_FALSE(popup_model->IsOpen()); 56 EXPECT_FALSE(popup_model->IsOpen());
57 } 57 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698