| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_input.h" | 9 #include "chrome/browser/autocomplete/autocomplete_input.h" |
| 10 #include "chrome/browser/autocomplete/autocomplete_match.h" | 10 #include "chrome/browser/autocomplete/autocomplete_match.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 void WaitForAutocompleteDone(AutocompleteController* controller) { | 60 void WaitForAutocompleteDone(AutocompleteController* controller) { |
| 61 while (!controller->done()) { | 61 while (!controller->done()) { |
| 62 content::WindowedNotificationObserver ready_observer( | 62 content::WindowedNotificationObserver ready_observer( |
| 63 chrome::NOTIFICATION_AUTOCOMPLETE_CONTROLLER_RESULT_READY, | 63 chrome::NOTIFICATION_AUTOCOMPLETE_CONTROLLER_RESULT_READY, |
| 64 content::Source<AutocompleteController>(controller)); | 64 content::Source<AutocompleteController>(controller)); |
| 65 ready_observer.Wait(); | 65 ready_observer.Wait(); |
| 66 } | 66 } |
| 67 } | 67 } |
| 68 }; | 68 }; |
| 69 | 69 |
| 70 IN_PROC_BROWSER_TEST_F(OmniboxApiTest, DISABLED_Basic) { | 70 IN_PROC_BROWSER_TEST_F(OmniboxApiTest, Basic) { |
| 71 ASSERT_TRUE(RunExtensionTest("omnibox")) << message_; | 71 ASSERT_TRUE(RunExtensionTest("omnibox")) << message_; |
| 72 | 72 |
| 73 // The results depend on the TemplateURLService being loaded. Make sure it is | 73 // The results depend on the TemplateURLService being loaded. Make sure it is |
| 74 // loaded so that the autocomplete results are consistent. | 74 // loaded so that the autocomplete results are consistent. |
| 75 ui_test_utils::WaitForTemplateURLServiceToLoad( | 75 ui_test_utils::WaitForTemplateURLServiceToLoad( |
| 76 TemplateURLServiceFactory::GetForProfile(browser()->profile())); | 76 TemplateURLServiceFactory::GetForProfile(browser()->profile())); |
| 77 | 77 |
| 78 LocationBar* location_bar = GetLocationBar(browser()); | 78 LocationBar* location_bar = GetLocationBar(browser()); |
| 79 AutocompleteController* autocomplete_controller = | 79 AutocompleteController* autocomplete_controller = |
| 80 GetAutocompleteController(browser()); | 80 GetAutocompleteController(browser()); |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 location_bar->AcceptInput(); | 175 location_bar->AcceptInput(); |
| 176 // This checks that the keyword provider (via javascript) | 176 // This checks that the keyword provider (via javascript) |
| 177 // gets told to navigate to the string "command". | 177 // gets told to navigate to the string "command". |
| 178 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 178 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 179 } | 179 } |
| 180 } | 180 } |
| 181 | 181 |
| 182 // Tests that the autocomplete popup doesn't reopen after accepting input for | 182 // Tests that the autocomplete popup doesn't reopen after accepting input for |
| 183 // a given query. | 183 // a given query. |
| 184 // http://crbug.com/88552 | 184 // http://crbug.com/88552 |
| 185 IN_PROC_BROWSER_TEST_F(OmniboxApiTest, DISABLED_PopupStaysClosed) { | 185 IN_PROC_BROWSER_TEST_F(OmniboxApiTest, PopupStaysClosed) { |
| 186 ASSERT_TRUE(RunExtensionTest("omnibox")) << message_; | 186 ASSERT_TRUE(RunExtensionTest("omnibox")) << message_; |
| 187 | 187 |
| 188 // The results depend on the TemplateURLService being loaded. Make sure it is | 188 // The results depend on the TemplateURLService being loaded. Make sure it is |
| 189 // loaded so that the autocomplete results are consistent. | 189 // loaded so that the autocomplete results are consistent. |
| 190 ui_test_utils::WaitForTemplateURLServiceToLoad( | 190 ui_test_utils::WaitForTemplateURLServiceToLoad( |
| 191 TemplateURLServiceFactory::GetForProfile(browser()->profile())); | 191 TemplateURLServiceFactory::GetForProfile(browser()->profile())); |
| 192 | 192 |
| 193 LocationBar* location_bar = GetLocationBar(browser()); | 193 LocationBar* location_bar = GetLocationBar(browser()); |
| 194 OmniboxView* omnibox_view = location_bar->GetLocationEntry(); | 194 OmniboxView* omnibox_view = location_bar->GetLocationEntry(); |
| 195 AutocompleteController* autocomplete_controller = | 195 AutocompleteController* autocomplete_controller = |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 // incognito context. | 272 // incognito context. |
| 273 { | 273 { |
| 274 ResultCatcher catcher; | 274 ResultCatcher catcher; |
| 275 autocomplete_controller->Start( | 275 autocomplete_controller->Start( |
| 276 ASCIIToUTF16("keyword command incognito"), string16(), | 276 ASCIIToUTF16("keyword command incognito"), string16(), |
| 277 true, false, true, AutocompleteInput::ALL_MATCHES); | 277 true, false, true, AutocompleteInput::ALL_MATCHES); |
| 278 location_bar->AcceptInput(); | 278 location_bar->AcceptInput(); |
| 279 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 279 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 280 } | 280 } |
| 281 } | 281 } |
| OLD | NEW |