OLD | NEW |
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/extensions/api/omnibox/omnibox_api_testbase.h" | 5 #include "chrome/browser/extensions/api/omnibox/omnibox_api_testbase.h" |
6 #include "chrome/browser/search_engines/template_url_service_factory.h" | 6 #include "chrome/browser/search_engines/template_url_service_factory.h" |
7 #include "chrome/test/base/ui_test_utils.h" | 7 #include "chrome/test/base/ui_test_utils.h" |
| 8 #include "components/metrics/proto/omnibox_event.pb.h" |
8 | 9 |
9 | 10 |
10 // Tests that the autocomplete popup doesn't reopen after accepting input for | 11 // Tests that the autocomplete popup doesn't reopen after accepting input for |
11 // a given query. | 12 // a given query. |
12 // http://crbug.com/88552 | 13 // http://crbug.com/88552 |
13 IN_PROC_BROWSER_TEST_F(OmniboxApiTest, PopupStaysClosed) { | 14 IN_PROC_BROWSER_TEST_F(OmniboxApiTest, PopupStaysClosed) { |
14 ASSERT_TRUE(RunExtensionTest("omnibox")) << message_; | 15 ASSERT_TRUE(RunExtensionTest("omnibox")) << message_; |
15 | 16 |
16 // The results depend on the TemplateURLService being loaded. Make sure it is | 17 // The results depend on the TemplateURLService being loaded. Make sure it is |
17 // loaded so that the autocomplete results are consistent. | 18 // loaded so that the autocomplete results are consistent. |
(...skipping 18 matching lines...) Expand all Loading... |
36 // for the query. The popup will close after accepting input - ensure that it | 37 // for the query. The popup will close after accepting input - ensure that it |
37 // does not reopen when the extension returns its suggestions. | 38 // does not reopen when the extension returns its suggestions. |
38 ResultCatcher catcher; | 39 ResultCatcher catcher; |
39 | 40 |
40 // TODO: Rather than send this second request by talking to the controller | 41 // TODO: Rather than send this second request by talking to the controller |
41 // directly, figure out how to send it via the proper calls to | 42 // directly, figure out how to send it via the proper calls to |
42 // location_bar or location_bar->(). | 43 // location_bar or location_bar->(). |
43 autocomplete_controller->Start( | 44 autocomplete_controller->Start( |
44 AutocompleteInput(base::ASCIIToUTF16("keyword command"), | 45 AutocompleteInput(base::ASCIIToUTF16("keyword command"), |
45 base::string16::npos, base::string16(), GURL(), | 46 base::string16::npos, base::string16(), GURL(), |
46 AutocompleteInput::NTP, true, false, true, true)); | 47 metrics::OmniboxEventProto::NTP, true, false, true, |
| 48 true)); |
47 location_bar->AcceptInput(); | 49 location_bar->AcceptInput(); |
48 WaitForAutocompleteDone(autocomplete_controller); | 50 WaitForAutocompleteDone(autocomplete_controller); |
49 EXPECT_TRUE(autocomplete_controller->done()); | 51 EXPECT_TRUE(autocomplete_controller->done()); |
50 // This checks that the keyword provider (via javascript) | 52 // This checks that the keyword provider (via javascript) |
51 // gets told to navigate to the string "command". | 53 // gets told to navigate to the string "command". |
52 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 54 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
53 EXPECT_FALSE(popup_model->IsOpen()); | 55 EXPECT_FALSE(popup_model->IsOpen()); |
54 } | 56 } |
OLD | NEW |