| 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/strings/string16.h" | 5 #include "base/strings/string16.h" |
| 6 #include "base/strings/utf_string_conversions.h" | 6 #include "base/strings/utf_string_conversions.h" |
| 7 #include "chrome/browser/autocomplete/autocomplete_controller.h" | 7 #include "chrome/browser/autocomplete/autocomplete_controller.h" |
| 8 #include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h" | 8 #include "chrome/browser/autocomplete/chrome_autocomplete_scheme_classifier.h" |
| 9 #include "chrome/browser/extensions/api/omnibox/omnibox_api_testbase.h" | 9 #include "chrome/browser/extensions/api/omnibox/omnibox_api_testbase.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| 11 #include "chrome/browser/search_engines/template_url_service_factory.h" | 11 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 12 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
| 13 #include "chrome/browser/ui/location_bar/location_bar.h" | 13 #include "chrome/browser/ui/location_bar/location_bar.h" |
| 14 #include "chrome/browser/ui/omnibox/omnibox_view.h" | 14 #include "chrome/browser/ui/omnibox/omnibox_view.h" |
| 15 #include "chrome/test/base/ui_test_utils.h" | 15 #include "chrome/test/base/ui_test_utils.h" |
| 16 #include "components/metrics/proto/omnibox_event.pb.h" | 16 #include "components/metrics/proto/omnibox_event.pb.h" |
| 17 #include "components/omnibox/autocomplete_input.h" | 17 #include "components/omnibox/autocomplete_input.h" |
| 18 #include "components/omnibox/autocomplete_match.h" | 18 #include "components/omnibox/autocomplete_match.h" |
| 19 #include "components/omnibox/autocomplete_result.h" | 19 #include "components/omnibox/autocomplete_result.h" |
| 20 #include "extensions/test/result_catcher.h" |
| 20 #include "ui/base/window_open_disposition.h" | 21 #include "ui/base/window_open_disposition.h" |
| 21 | 22 |
| 22 using base::ASCIIToUTF16; | 23 using base::ASCIIToUTF16; |
| 24 using extensions::ResultCatcher; |
| 23 using metrics::OmniboxEventProto; | 25 using metrics::OmniboxEventProto; |
| 24 | 26 |
| 25 // http://crbug.com/167158 | 27 // http://crbug.com/167158 |
| 26 IN_PROC_BROWSER_TEST_F(OmniboxApiTest, DISABLED_Basic) { | 28 IN_PROC_BROWSER_TEST_F(OmniboxApiTest, DISABLED_Basic) { |
| 27 ASSERT_TRUE(RunExtensionTest("omnibox")) << message_; | 29 ASSERT_TRUE(RunExtensionTest("omnibox")) << message_; |
| 28 | 30 |
| 29 // The results depend on the TemplateURLService being loaded. Make sure it is | 31 // The results depend on the TemplateURLService being loaded. Make sure it is |
| 30 // loaded so that the autocomplete results are consistent. | 32 // loaded so that the autocomplete results are consistent. |
| 31 Profile* profile = browser()->profile(); | 33 Profile* profile = browser()->profile(); |
| 32 ui_test_utils::WaitForTemplateURLServiceToLoad( | 34 ui_test_utils::WaitForTemplateURLServiceToLoad( |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 198 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 197 } | 199 } |
| 198 | 200 |
| 199 // Tests that we get suggestions from and send input to the incognito context | 201 // Tests that we get suggestions from and send input to the incognito context |
| 200 // of an incognito split mode extension. | 202 // of an incognito split mode extension. |
| 201 // http://crbug.com/100927 | 203 // http://crbug.com/100927 |
| 202 // Test is flaky: http://crbug.com/101219 | 204 // Test is flaky: http://crbug.com/101219 |
| 203 IN_PROC_BROWSER_TEST_F(OmniboxApiTest, DISABLED_IncognitoSplitMode) { | 205 IN_PROC_BROWSER_TEST_F(OmniboxApiTest, DISABLED_IncognitoSplitMode) { |
| 204 Profile* profile = browser()->profile(); | 206 Profile* profile = browser()->profile(); |
| 205 ResultCatcher catcher_incognito; | 207 ResultCatcher catcher_incognito; |
| 206 catcher_incognito.RestrictToProfile(profile->GetOffTheRecordProfile()); | 208 catcher_incognito.RestrictToBrowserContext(profile->GetOffTheRecordProfile()); |
| 207 | 209 |
| 208 ASSERT_TRUE(RunExtensionTestIncognito("omnibox")) << message_; | 210 ASSERT_TRUE(RunExtensionTestIncognito("omnibox")) << message_; |
| 209 | 211 |
| 210 // Open an incognito window and wait for the incognito extension process to | 212 // Open an incognito window and wait for the incognito extension process to |
| 211 // respond. | 213 // respond. |
| 212 Browser* incognito_browser = CreateIncognitoBrowser(); | 214 Browser* incognito_browser = CreateIncognitoBrowser(); |
| 213 ASSERT_TRUE(catcher_incognito.GetNextResult()) << catcher_incognito.message(); | 215 ASSERT_TRUE(catcher_incognito.GetNextResult()) << catcher_incognito.message(); |
| 214 | 216 |
| 215 // The results depend on the TemplateURLService being loaded. Make sure it is | 217 // The results depend on the TemplateURLService being loaded. Make sure it is |
| 216 // loaded so that the autocomplete results are consistent. | 218 // loaded so that the autocomplete results are consistent. |
| (...skipping 29 matching lines...) Expand all Loading... |
| 246 { | 248 { |
| 247 ResultCatcher catcher; | 249 ResultCatcher catcher; |
| 248 autocomplete_controller->Start(AutocompleteInput( | 250 autocomplete_controller->Start(AutocompleteInput( |
| 249 ASCIIToUTF16("keyword command incognito"), base::string16::npos, | 251 ASCIIToUTF16("keyword command incognito"), base::string16::npos, |
| 250 base::string16(), GURL(), OmniboxEventProto::NTP, true, false, true, | 252 base::string16(), GURL(), OmniboxEventProto::NTP, true, false, true, |
| 251 true, ChromeAutocompleteSchemeClassifier(profile))); | 253 true, ChromeAutocompleteSchemeClassifier(profile))); |
| 252 location_bar->AcceptInput(); | 254 location_bar->AcceptInput(); |
| 253 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 255 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 254 } | 256 } |
| 255 } | 257 } |
| OLD | NEW |