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/path_service.h" | 6 #include "base/path_service.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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 #else | 107 #else |
108 #define MAYBE_Autocomplete Autocomplete | 108 #define MAYBE_Autocomplete Autocomplete |
109 #endif | 109 #endif |
110 | 110 |
111 IN_PROC_BROWSER_TEST_F(AutocompleteBrowserTest, MAYBE_Autocomplete) { | 111 IN_PROC_BROWSER_TEST_F(AutocompleteBrowserTest, MAYBE_Autocomplete) { |
112 WaitForTemplateURLServiceToLoad(); | 112 WaitForTemplateURLServiceToLoad(); |
113 // The results depend on the history backend being loaded. Make sure it is | 113 // The results depend on the history backend being loaded. Make sure it is |
114 // loaded so that the autocomplete results are consistent. | 114 // loaded so that the autocomplete results are consistent. |
115 ui_test_utils::WaitForHistoryToLoad( | 115 ui_test_utils::WaitForHistoryToLoad( |
116 HistoryServiceFactory::GetForProfile(browser()->profile(), | 116 HistoryServiceFactory::GetForProfile(browser()->profile(), |
117 Profile::EXPLICIT_ACCESS)); | 117 Profile::EXPLICIT_ACCESS).get()); |
118 | 118 |
119 LocationBar* location_bar = GetLocationBar(); | 119 LocationBar* location_bar = GetLocationBar(); |
120 AutocompleteController* autocomplete_controller = GetAutocompleteController(); | 120 AutocompleteController* autocomplete_controller = GetAutocompleteController(); |
121 | 121 |
122 { | 122 { |
123 autocomplete_controller->Start( | 123 autocomplete_controller->Start( |
124 ASCIIToUTF16("chrome"), string16(), true, false, true, | 124 ASCIIToUTF16("chrome"), string16(), true, false, true, |
125 AutocompleteInput::SYNCHRONOUS_MATCHES); | 125 AutocompleteInput::SYNCHRONOUS_MATCHES); |
126 | 126 |
127 OmniboxView* location_entry = location_bar->GetLocationEntry(); | 127 OmniboxView* location_entry = location_bar->GetLocationEntry(); |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 // Load a hosted app. | 274 // Load a hosted app. |
275 extensions::UnpackedInstaller::Create(service)->Load( | 275 extensions::UnpackedInstaller::Create(service)->Load( |
276 test_dir.AppendASCII("extensions").AppendASCII("app")); | 276 test_dir.AppendASCII("extensions").AppendASCII("app")); |
277 WaitForExtensionLoad(); | 277 WaitForExtensionLoad(); |
278 ASSERT_EQ(extension_count + 2U, service->extensions()->size()); | 278 ASSERT_EQ(extension_count + 2U, service->extensions()->size()); |
279 | 279 |
280 // The results depend on the history backend being loaded. Make sure it is | 280 // The results depend on the history backend being loaded. Make sure it is |
281 // loaded so that the autocomplete results are consistent. | 281 // loaded so that the autocomplete results are consistent. |
282 ui_test_utils::WaitForHistoryToLoad( | 282 ui_test_utils::WaitForHistoryToLoad( |
283 HistoryServiceFactory::GetForProfile(browser()->profile(), | 283 HistoryServiceFactory::GetForProfile(browser()->profile(), |
284 Profile::EXPLICIT_ACCESS)); | 284 Profile::EXPLICIT_ACCESS).get()); |
285 | 285 |
286 AutocompleteController* autocomplete_controller = GetAutocompleteController(); | 286 AutocompleteController* autocomplete_controller = GetAutocompleteController(); |
287 | 287 |
288 // Try out the packaged app. | 288 // Try out the packaged app. |
289 { | 289 { |
290 autocomplete_controller->Start( | 290 autocomplete_controller->Start( |
291 ASCIIToUTF16("Packaged App Test"), string16(), true, false, true, | 291 ASCIIToUTF16("Packaged App Test"), string16(), true, false, true, |
292 AutocompleteInput::SYNCHRONOUS_MATCHES); | 292 AutocompleteInput::SYNCHRONOUS_MATCHES); |
293 | 293 |
294 EXPECT_TRUE(autocomplete_controller->done()); | 294 EXPECT_TRUE(autocomplete_controller->done()); |
(...skipping 16 matching lines...) Expand all Loading... |
311 EXPECT_TRUE(autocomplete_controller->done()); | 311 EXPECT_TRUE(autocomplete_controller->done()); |
312 const AutocompleteResult& result = autocomplete_controller->result(); | 312 const AutocompleteResult& result = autocomplete_controller->result(); |
313 // 'App test' is also a substring of extension 'Packaged App Test'. | 313 // 'App test' is also a substring of extension 'Packaged App Test'. |
314 EXPECT_GT(result.size(), 2U) << AutocompleteResultAsString(result); | 314 EXPECT_GT(result.size(), 2U) << AutocompleteResultAsString(result); |
315 AutocompleteMatch match = result.match_at(0); | 315 AutocompleteMatch match = result.match_at(0); |
316 EXPECT_EQ(ASCIIToUTF16("App Test"), match.contents); | 316 EXPECT_EQ(ASCIIToUTF16("App Test"), match.contents); |
317 EXPECT_EQ(AutocompleteMatch::EXTENSION_APP, match.type); | 317 EXPECT_EQ(AutocompleteMatch::EXTENSION_APP, match.type); |
318 EXPECT_FALSE(match.deletable); | 318 EXPECT_FALSE(match.deletable); |
319 } | 319 } |
320 } | 320 } |
OLD | NEW |