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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
12 #include "base/run_loop.h" | 12 #include "base/run_loop.h" |
13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
14 #include "chrome/browser/search_engines/search_provider_install_data.h" | 14 #include "chrome/browser/search_engines/search_provider_install_data.h" |
15 #include "chrome/browser/search_engines/template_url_service_test_util.h" | 15 #include "chrome/browser/search_engines/template_url_service_test_util.h" |
16 #include "chrome/test/base/testing_pref_service_syncable.h" | 16 #include "chrome/test/base/testing_pref_service_syncable.h" |
17 #include "chrome/test/base/testing_profile.h" | 17 #include "chrome/test/base/testing_profile.h" |
18 #include "components/search_engines/search_terms_data.h" | 18 #include "components/search_engines/search_terms_data.h" |
19 #include "components/search_engines/template_url.h" | 19 #include "components/search_engines/template_url.h" |
20 #include "components/search_engines/template_url_prepopulate_data.h" | 20 #include "components/search_engines/template_url_prepopulate_data.h" |
Peter Kasting
2014/10/06 20:28:27
This #include can probably be removed.
Yaron
2014/10/08 00:08:54
Done.
| |
21 #include "components/search_engines/template_url_service.h" | 21 #include "components/search_engines/template_url_service.h" |
22 #include "content/public/browser/browser_thread.h" | 22 #include "content/public/browser/browser_thread.h" |
23 #include "content/public/test/mock_render_process_host.h" | 23 #include "content/public/test/mock_render_process_host.h" |
24 #include "content/public/test/test_browser_thread_bundle.h" | 24 #include "content/public/test/test_browser_thread_bundle.h" |
25 #include "testing/gtest/include/gtest/gtest.h" | 25 #include "testing/gtest/include/gtest/gtest.h" |
26 | 26 |
27 using content::BrowserThread; | 27 using content::BrowserThread; |
28 | 28 |
29 namespace { | 29 namespace { |
30 | 30 |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
147 | 147 |
148 DISALLOW_COPY_AND_ASSIGN(SearchProviderInstallDataTest); | 148 DISALLOW_COPY_AND_ASSIGN(SearchProviderInstallDataTest); |
149 }; | 149 }; |
150 | 150 |
151 SearchProviderInstallDataTest::SearchProviderInstallDataTest() | 151 SearchProviderInstallDataTest::SearchProviderInstallDataTest() |
152 : install_data_(NULL) { | 152 : install_data_(NULL) { |
153 } | 153 } |
154 | 154 |
155 void SearchProviderInstallDataTest::SetUp() { | 155 void SearchProviderInstallDataTest::SetUp() { |
156 testing::Test::SetUp(); | 156 testing::Test::SetUp(); |
157 #if defined(OS_ANDROID) | |
158 TemplateURLPrepopulateData::InitCountryCode( | |
159 std::string() /* unknown country code */); | |
160 #endif | |
161 process_.reset(new content::MockRenderProcessHost(util_.profile())); | 157 process_.reset(new content::MockRenderProcessHost(util_.profile())); |
162 install_data_ = new SearchProviderInstallData( | 158 install_data_ = new SearchProviderInstallData( |
163 util_.model(), SearchTermsData().GoogleBaseURLValue(), NULL, | 159 util_.model(), SearchTermsData().GoogleBaseURLValue(), NULL, |
164 process_.get()); | 160 process_.get()); |
165 } | 161 } |
166 | 162 |
167 void SearchProviderInstallDataTest::TearDown() { | 163 void SearchProviderInstallDataTest::TearDown() { |
168 BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, install_data_); | 164 BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, install_data_); |
169 install_data_ = NULL; | 165 install_data_ = NULL; |
170 | 166 |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
275 // Verify the search providers install state (with no default set). | 271 // Verify the search providers install state (with no default set). |
276 test_get_install_state.RunTests(google_host, std::string()); | 272 test_get_install_state.RunTests(google_host, std::string()); |
277 | 273 |
278 // Change the Google base url. | 274 // Change the Google base url. |
279 google_host = "foo.com"; | 275 google_host = "foo.com"; |
280 SetGoogleBaseURLAndProcessOnIOThread(GURL("http://" + google_host + "/")); | 276 SetGoogleBaseURLAndProcessOnIOThread(GURL("http://" + google_host + "/")); |
281 | 277 |
282 // Verify that the change got picked up. | 278 // Verify that the change got picked up. |
283 test_get_install_state.RunTests(google_host, std::string()); | 279 test_get_install_state.RunTests(google_host, std::string()); |
284 } | 280 } |
OLD | NEW |