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

Side by Side Diff: chrome/browser/autocomplete/autocomplete_browsertest.cc

Issue 8417012: Refactor loading out of ExtensionService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: finally Created 9 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/automation/automation_provider.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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.h" 9 #include "chrome/browser/autocomplete/autocomplete.h"
10 #include "chrome/browser/autocomplete/autocomplete_edit.h" 10 #include "chrome/browser/autocomplete/autocomplete_edit.h"
11 #include "chrome/browser/autocomplete/autocomplete_match.h" 11 #include "chrome/browser/autocomplete/autocomplete_match.h"
12 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" 12 #include "chrome/browser/autocomplete/autocomplete_popup_model.h"
13 #include "chrome/browser/extensions/extension_browsertest.h" 13 #include "chrome/browser/extensions/extension_browsertest.h"
14 #include "chrome/browser/extensions/extension_service.h" 14 #include "chrome/browser/extensions/extension_service.h"
15 #include "chrome/browser/extensions/unpacked_installer.h"
15 #include "chrome/browser/history/history.h" 16 #include "chrome/browser/history/history.h"
16 #include "chrome/browser/profiles/profile.h" 17 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/browser/tabs/tab_strip_model.h" 18 #include "chrome/browser/tabs/tab_strip_model.h"
18 #include "chrome/browser/ui/browser.h" 19 #include "chrome/browser/ui/browser.h"
19 #include "chrome/browser/ui/browser_window.h" 20 #include "chrome/browser/ui/browser_window.h"
20 #include "chrome/browser/ui/omnibox/location_bar.h" 21 #include "chrome/browser/ui/omnibox/location_bar.h"
21 #include "chrome/browser/ui/omnibox/omnibox_view.h" 22 #include "chrome/browser/ui/omnibox/omnibox_view.h"
22 #include "chrome/common/chrome_paths.h" 23 #include "chrome/common/chrome_paths.h"
23 #include "chrome/common/url_constants.h" 24 #include "chrome/common/url_constants.h"
24 #include "chrome/test/base/in_process_browser_test.h" 25 #include "chrome/test/base/in_process_browser_test.h"
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 } 258 }
258 } 259 }
259 260
260 IN_PROC_BROWSER_TEST_F(AutocompleteBrowserTest, ExtensionAppProvider) { 261 IN_PROC_BROWSER_TEST_F(AutocompleteBrowserTest, ExtensionAppProvider) {
261 ExtensionService* service = browser()->profile()->GetExtensionService(); 262 ExtensionService* service = browser()->profile()->GetExtensionService();
262 size_t extension_count = service->extensions()->size(); 263 size_t extension_count = service->extensions()->size();
263 264
264 FilePath test_dir; 265 FilePath test_dir;
265 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_dir)); 266 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_dir));
266 // Load a packaged app. 267 // Load a packaged app.
267 service->LoadExtension(test_dir.AppendASCII("extensions") 268 extensions::UnpackedInstaller::Create(service)->Load(
268 .AppendASCII("packaged_app")); 269 test_dir.AppendASCII("extensions").AppendASCII("packaged_app"));
269 WaitForExtensionLoad(); 270 WaitForExtensionLoad();
270 // Load a hosted app. 271 // Load a hosted app.
271 service->LoadExtension(test_dir.AppendASCII("extensions") 272 extensions::UnpackedInstaller::Create(service)->Load(
272 .AppendASCII("app")); 273 test_dir.AppendASCII("extensions").AppendASCII("app"));
273 WaitForExtensionLoad(); 274 WaitForExtensionLoad();
274 ASSERT_EQ(extension_count + 2U, service->extensions()->size()); 275 ASSERT_EQ(extension_count + 2U, service->extensions()->size());
275 276
276 // The results depend on the history backend being loaded. Make sure it is 277 // The results depend on the history backend being loaded. Make sure it is
277 // loaded so that the autocomplete results are consistent. 278 // loaded so that the autocomplete results are consistent.
278 ui_test_utils::WaitForHistoryToLoad(browser()); 279 ui_test_utils::WaitForHistoryToLoad(browser());
279 280
280 LocationBar* location_bar = GetLocationBar(); 281 LocationBar* location_bar = GetLocationBar();
281 AutocompleteController* autocomplete_controller = GetAutocompleteController(); 282 AutocompleteController* autocomplete_controller = GetAutocompleteController();
282 283
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 const AutocompleteResult& result = autocomplete_controller->result(); 315 const AutocompleteResult& result = autocomplete_controller->result();
315 // 'App test' is also a substring of extension 'Packaged App Test'. 316 // 'App test' is also a substring of extension 'Packaged App Test'.
316 EXPECT_GT(result.size(), 2U) << AutocompleteResultAsString(result); 317 EXPECT_GT(result.size(), 2U) << AutocompleteResultAsString(result);
317 AutocompleteMatch match = result.match_at(0); 318 AutocompleteMatch match = result.match_at(0);
318 EXPECT_EQ(ASCIIToUTF16("App Test"), match.contents); 319 EXPECT_EQ(ASCIIToUTF16("App Test"), match.contents);
319 EXPECT_EQ(AutocompleteMatch::EXTENSION_APP, match.type); 320 EXPECT_EQ(AutocompleteMatch::EXTENSION_APP, match.type);
320 EXPECT_FALSE(match.deletable); 321 EXPECT_FALSE(match.deletable);
321 location_bar->AcceptInput(); 322 location_bar->AcceptInput();
322 } 323 }
323 } 324 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/automation/automation_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698