| 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/message_loop.h" | 10 #include "base/message_loop.h" |
| 11 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
| 12 #include "chrome/browser/search_engines/search_provider_install_data.h" | 12 #include "chrome/browser/search_engines/search_provider_install_data.h" |
| 13 #include "chrome/browser/search_engines/template_url.h" | 13 #include "chrome/browser/search_engines/template_url.h" |
| 14 #include "chrome/browser/search_engines/template_url_prepopulate_data.h" |
| 14 #include "chrome/browser/search_engines/template_url_service.h" | 15 #include "chrome/browser/search_engines/template_url_service.h" |
| 15 #include "chrome/browser/search_engines/template_url_service_test_util.h" | 16 #include "chrome/browser/search_engines/template_url_service_test_util.h" |
| 16 #include "chrome/common/chrome_notification_types.h" | 17 #include "chrome/common/chrome_notification_types.h" |
| 17 #include "chrome/common/pref_names.h" | 18 #include "chrome/common/pref_names.h" |
| 18 #include "chrome/test/base/testing_pref_service.h" | 19 #include "chrome/test/base/testing_pref_service.h" |
| 19 #include "chrome/test/base/testing_profile.h" | 20 #include "chrome/test/base/testing_profile.h" |
| 20 #include "content/public/browser/notification_service.h" | 21 #include "content/public/browser/notification_service.h" |
| 21 #include "content/public/browser/notification_source.h" | 22 #include "content/public/browser/notification_source.h" |
| 22 #include "content/public/test/test_browser_thread.h" | 23 #include "content/public/test/test_browser_thread.h" |
| 23 #include "testing/gtest/include/gtest/gtest.h" | 24 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 | 181 |
| 181 DISALLOW_COPY_AND_ASSIGN(SearchProviderInstallDataTest); | 182 DISALLOW_COPY_AND_ASSIGN(SearchProviderInstallDataTest); |
| 182 }; | 183 }; |
| 183 | 184 |
| 184 SearchProviderInstallDataTest::SearchProviderInstallDataTest() | 185 SearchProviderInstallDataTest::SearchProviderInstallDataTest() |
| 185 : install_data_(NULL) { | 186 : install_data_(NULL) { |
| 186 } | 187 } |
| 187 | 188 |
| 188 void SearchProviderInstallDataTest::SetUp() { | 189 void SearchProviderInstallDataTest::SetUp() { |
| 189 testing::Test::SetUp(); | 190 testing::Test::SetUp(); |
| 191 #if defined(OS_ANDROID) |
| 192 TemplateURLPrepopulateData::InitCountryCode( |
| 193 std::string() /* unknown country code */); |
| 194 #endif |
| 190 util_.SetUp(); | 195 util_.SetUp(); |
| 191 util_.StartIOThread(); | 196 util_.StartIOThread(); |
| 192 install_data_ = new SearchProviderInstallData(util_.profile(), | 197 install_data_ = new SearchProviderInstallData(util_.profile(), |
| 193 content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, | 198 content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, |
| 194 content::Source<SearchProviderInstallDataTest>(this)); | 199 content::Source<SearchProviderInstallDataTest>(this)); |
| 195 } | 200 } |
| 196 | 201 |
| 197 void SearchProviderInstallDataTest::TearDown() { | 202 void SearchProviderInstallDataTest::TearDown() { |
| 198 BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, install_data_); | 203 BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, install_data_); |
| 199 install_data_ = NULL; | 204 install_data_ = NULL; |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 // Change the Google base url. | 325 // Change the Google base url. |
| 321 google_host = "foo.com"; | 326 google_host = "foo.com"; |
| 322 util_.SetGoogleBaseURL(GURL("http://" + google_host + "/")); | 327 util_.SetGoogleBaseURL(GURL("http://" + google_host + "/")); |
| 323 // Wait for the I/O thread to process the update notification. | 328 // Wait for the I/O thread to process the update notification. |
| 324 TemplateURLServiceTestUtil::BlockTillIOThreadProcessesRequests(); | 329 TemplateURLServiceTestUtil::BlockTillIOThreadProcessesRequests(); |
| 325 | 330 |
| 326 // Verify that the change got picked up. | 331 // Verify that the change got picked up. |
| 327 test_get_install_state->set_search_provider_host(google_host); | 332 test_get_install_state->set_search_provider_host(google_host); |
| 328 EXPECT_TRUE(test_get_install_state->RunTests()); | 333 EXPECT_TRUE(test_get_install_state->RunTests()); |
| 329 } | 334 } |
| OLD | NEW |