From 810ffba3ed8a53fa627aa746285ec63a9d192f60 Mon Sep 17 00:00:00 2001
From: "pkasting@chromium.org"
 <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>
Date: Tue, 12 Jun 2012 01:07:48 +0000
Subject: Make AutocompleteClassifier a ProfileKeyedService.

This also cleans up some usage of TemplateURLServiceFactory, especially in order to remove knowledge of TemplateURLService[Factory] from TestingProfile.  The changes for this parallel some implementation details for the AutocompleteClassifierFactory.

BUG=112557
TEST=none
Review URL: https://chromiumcodereview.appspot.com/10532096

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@141580 0039d316-1c4b-4281-b951-d872f2087c98
---
 .../extensions/api/omnibox/omnibox_apitest.cc        | 20 ++++++--------------
 1 file changed, 6 insertions(+), 14 deletions(-)

(limited to 'chrome/browser/extensions/api/omnibox/omnibox_apitest.cc')

diff --git a/chrome/browser/extensions/api/omnibox/omnibox_apitest.cc b/chrome/browser/extensions/api/omnibox/omnibox_apitest.cc
index 774fdec..f136a4d 100644
--- a/chrome/browser/extensions/api/omnibox/omnibox_apitest.cc
+++ b/chrome/browser/extensions/api/omnibox/omnibox_apitest.cc
@@ -56,17 +56,6 @@ class OmniboxApiTest : public ExtensionApiTest {
         autocomplete_controller();
   }
 
-  void WaitForTemplateURLServiceToLoad() {
-    ui_test_utils::WindowedNotificationObserver loaded_observer(
-        chrome::NOTIFICATION_TEMPLATE_URL_SERVICE_LOADED,
-        content::NotificationService::AllSources());
-    TemplateURLService* model =
-        TemplateURLServiceFactory::GetForProfile(browser()->profile());
-    model->Load();
-    if (!model->loaded())
-      loaded_observer.Wait();
-  }
-
   // TODO(phajdan.jr): Get rid of this wait-in-a-loop pattern.
   void WaitForAutocompleteDone(AutocompleteController* controller) {
     while (!controller->done()) {
@@ -83,7 +72,8 @@ IN_PROC_BROWSER_TEST_F(OmniboxApiTest, DISABLED_Basic) {
 
   // The results depend on the TemplateURLService being loaded. Make sure it is
   // loaded so that the autocomplete results are consistent.
-  WaitForTemplateURLServiceToLoad();
+  ui_test_utils::WaitForTemplateURLServiceToLoad(
+      TemplateURLServiceFactory::GetForProfile(browser()->profile()));
 
   LocationBar* location_bar = GetLocationBar(browser());
   AutocompleteController* autocomplete_controller =
@@ -197,7 +187,8 @@ IN_PROC_BROWSER_TEST_F(OmniboxApiTest, DISABLED_PopupStaysClosed) {
 
   // The results depend on the TemplateURLService being loaded. Make sure it is
   // loaded so that the autocomplete results are consistent.
-  WaitForTemplateURLServiceToLoad();
+  ui_test_utils::WaitForTemplateURLServiceToLoad(
+      TemplateURLServiceFactory::GetForProfile(browser()->profile()));
 
   LocationBar* location_bar = GetLocationBar(browser());
   OmniboxView* omnibox_view = location_bar->GetLocationEntry();
@@ -251,7 +242,8 @@ IN_PROC_BROWSER_TEST_F(OmniboxApiTest, DISABLED_IncognitoSplitMode) {
 
   // The results depend on the TemplateURLService being loaded. Make sure it is
   // loaded so that the autocomplete results are consistent.
-  WaitForTemplateURLServiceToLoad();
+  ui_test_utils::WaitForTemplateURLServiceToLoad(
+      TemplateURLServiceFactory::GetForProfile(browser()->profile()));
 
   LocationBar* location_bar = GetLocationBar(incognito_browser);
   AutocompleteController* autocomplete_controller =
-- 
cgit v1.1