OLD | NEW |
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 "chrome/browser/profiles/profile.h" | 5 #include "chrome/browser/profiles/profile.h" |
6 #include "chrome/browser/search_engines/template_url_service.h" | 6 #include "chrome/browser/search_engines/template_url_service.h" |
7 #include "chrome/browser/search_engines/template_url_service_factory.h" | 7 #include "chrome/browser/search_engines/template_url_service_factory.h" |
8 #include "chrome/browser/search_engines/template_url_prepopulate_data.h" | 8 #include "chrome/browser/search_engines/template_url_prepopulate_data.h" |
9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
| 10 #include "chrome/common/chrome_notification_types.h" |
10 #include "chrome/test/in_process_browser_test.h" | 11 #include "chrome/test/in_process_browser_test.h" |
11 #include "chrome/test/ui_test_utils.h" | 12 #include "chrome/test/ui_test_utils.h" |
12 #include "content/common/notification_registrar.h" | 13 #include "content/common/notification_registrar.h" |
13 #include "content/common/notification_source.h" | 14 #include "content/common/notification_source.h" |
14 #include "content/common/notification_type.h" | |
15 #include "net/base/mock_host_resolver.h" | 15 #include "net/base/mock_host_resolver.h" |
16 #include "net/base/net_util.h" | 16 #include "net/base/net_util.h" |
17 | 17 |
18 namespace { | 18 namespace { |
19 class TemplateURLScraperTest : public InProcessBrowserTest { | 19 class TemplateURLScraperTest : public InProcessBrowserTest { |
20 public: | 20 public: |
21 TemplateURLScraperTest() { | 21 TemplateURLScraperTest() { |
22 } | 22 } |
23 | 23 |
24 private: | 24 private: |
25 DISALLOW_COPY_AND_ASSIGN(TemplateURLScraperTest); | 25 DISALLOW_COPY_AND_ASSIGN(TemplateURLScraperTest); |
26 }; | 26 }; |
27 | 27 |
28 class TemplateURLServiceLoader : public NotificationObserver { | 28 class TemplateURLServiceLoader : public NotificationObserver { |
29 public: | 29 public: |
30 explicit TemplateURLServiceLoader(TemplateURLService* model) : model_(model) { | 30 explicit TemplateURLServiceLoader(TemplateURLService* model) : model_(model) { |
31 registrar_.Add(this, NotificationType::TEMPLATE_URL_SERVICE_LOADED, | 31 registrar_.Add(this, chrome::NOTIFICATION_TEMPLATE_URL_SERVICE_LOADED, |
32 Source<TemplateURLService>(model)); | 32 Source<TemplateURLService>(model)); |
33 model_->Load(); | 33 model_->Load(); |
34 ui_test_utils::RunMessageLoop(); | 34 ui_test_utils::RunMessageLoop(); |
35 } | 35 } |
36 | 36 |
37 virtual void Observe(NotificationType type, | 37 virtual void Observe(int type, |
38 const NotificationSource& source, | 38 const NotificationSource& source, |
39 const NotificationDetails& details) { | 39 const NotificationDetails& details) { |
40 if (type == NotificationType::TEMPLATE_URL_SERVICE_LOADED && | 40 if (type == chrome::NOTIFICATION_TEMPLATE_URL_SERVICE_LOADED && |
41 Source<TemplateURLService>(source).ptr() == model_) { | 41 Source<TemplateURLService>(source).ptr() == model_) { |
42 MessageLoop::current()->Quit(); | 42 MessageLoop::current()->Quit(); |
43 } | 43 } |
44 } | 44 } |
45 | 45 |
46 private: | 46 private: |
47 NotificationRegistrar registrar_; | 47 NotificationRegistrar registrar_; |
48 | 48 |
49 TemplateURLService* model_; | 49 TemplateURLService* model_; |
50 | 50 |
(...skipping 27 matching lines...) Expand all Loading... |
78 HTTPTestServer::CreateServerWithFileRootURL( | 78 HTTPTestServer::CreateServerWithFileRootURL( |
79 L"chrome/test/data/template_url_scraper/submit_handler", L"/", | 79 L"chrome/test/data/template_url_scraper/submit_handler", L"/", |
80 g_browser_process->io_thread()->message_loop())); | 80 g_browser_process->io_thread()->message_loop())); |
81 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete( | 81 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete( |
82 browser(), GURL("http://www.foo.com:1337/"), 2); | 82 browser(), GURL("http://www.foo.com:1337/"), 2); |
83 | 83 |
84 all_urls = template_urls->GetTemplateURLs(); | 84 all_urls = template_urls->GetTemplateURLs(); |
85 EXPECT_EQ(1, all_urls.size() - prepopulate_urls.size()); | 85 EXPECT_EQ(1, all_urls.size() - prepopulate_urls.size()); |
86 } | 86 } |
87 */ | 87 */ |
OLD | NEW |