| 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" | |
| 21 #include "components/search_engines/template_url_service.h" | 20 #include "components/search_engines/template_url_service.h" |
| 22 #include "content/public/browser/browser_thread.h" | 21 #include "content/public/browser/browser_thread.h" |
| 23 #include "content/public/test/mock_render_process_host.h" | 22 #include "content/public/test/mock_render_process_host.h" |
| 24 #include "content/public/test/test_browser_thread_bundle.h" | 23 #include "content/public/test/test_browser_thread_bundle.h" |
| 25 #include "testing/gtest/include/gtest/gtest.h" | 24 #include "testing/gtest/include/gtest/gtest.h" |
| 26 | 25 |
| 27 using content::BrowserThread; | 26 using content::BrowserThread; |
| 28 | 27 |
| 29 namespace { | 28 namespace { |
| 30 | 29 |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 | 146 |
| 148 DISALLOW_COPY_AND_ASSIGN(SearchProviderInstallDataTest); | 147 DISALLOW_COPY_AND_ASSIGN(SearchProviderInstallDataTest); |
| 149 }; | 148 }; |
| 150 | 149 |
| 151 SearchProviderInstallDataTest::SearchProviderInstallDataTest() | 150 SearchProviderInstallDataTest::SearchProviderInstallDataTest() |
| 152 : install_data_(NULL) { | 151 : install_data_(NULL) { |
| 153 } | 152 } |
| 154 | 153 |
| 155 void SearchProviderInstallDataTest::SetUp() { | 154 void SearchProviderInstallDataTest::SetUp() { |
| 156 testing::Test::SetUp(); | 155 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())); | 156 process_.reset(new content::MockRenderProcessHost(util_.profile())); |
| 162 install_data_ = new SearchProviderInstallData( | 157 install_data_ = new SearchProviderInstallData( |
| 163 util_.model(), SearchTermsData().GoogleBaseURLValue(), NULL, | 158 util_.model(), SearchTermsData().GoogleBaseURLValue(), NULL, |
| 164 process_.get()); | 159 process_.get()); |
| 165 } | 160 } |
| 166 | 161 |
| 167 void SearchProviderInstallDataTest::TearDown() { | 162 void SearchProviderInstallDataTest::TearDown() { |
| 168 BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, install_data_); | 163 BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, install_data_); |
| 169 install_data_ = NULL; | 164 install_data_ = NULL; |
| 170 | 165 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 // Verify the search providers install state (with no default set). | 270 // Verify the search providers install state (with no default set). |
| 276 test_get_install_state.RunTests(google_host, std::string()); | 271 test_get_install_state.RunTests(google_host, std::string()); |
| 277 | 272 |
| 278 // Change the Google base url. | 273 // Change the Google base url. |
| 279 google_host = "foo.com"; | 274 google_host = "foo.com"; |
| 280 SetGoogleBaseURLAndProcessOnIOThread(GURL("http://" + google_host + "/")); | 275 SetGoogleBaseURLAndProcessOnIOThread(GURL("http://" + google_host + "/")); |
| 281 | 276 |
| 282 // Verify that the change got picked up. | 277 // Verify that the change got picked up. |
| 283 test_get_install_state.RunTests(google_host, std::string()); | 278 test_get_install_state.RunTests(google_host, std::string()); |
| 284 } | 279 } |
| OLD | NEW |