| 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 <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" |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 testing::Test::SetUp(); | 166 testing::Test::SetUp(); |
| 167 util_.SetUp(); | 167 util_.SetUp(); |
| 168 util_.StartIOThread(); | 168 util_.StartIOThread(); |
| 169 install_data_ = new SearchProviderInstallData( | 169 install_data_ = new SearchProviderInstallData( |
| 170 util_.GetWebDataService(), | 170 util_.GetWebDataService(), |
| 171 content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, | 171 content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, |
| 172 content::Source<SearchProviderInstallDataTest>(this)); | 172 content::Source<SearchProviderInstallDataTest>(this)); |
| 173 } | 173 } |
| 174 | 174 |
| 175 virtual void TearDown() { | 175 virtual void TearDown() { |
| 176 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)->PostTask( | 176 BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE, install_data_); |
| 177 FROM_HERE, | |
| 178 new DeleteTask<SearchProviderInstallData>(install_data_)); | |
| 179 install_data_ = NULL; | 177 install_data_ = NULL; |
| 180 | 178 |
| 181 // Make sure that the install data class on the UI thread gets cleaned up. | 179 // Make sure that the install data class on the UI thread gets cleaned up. |
| 182 // It doesn't matter that this happens after install_data_ is deleted. | 180 // It doesn't matter that this happens after install_data_ is deleted. |
| 183 content::NotificationService::current()->Notify( | 181 content::NotificationService::current()->Notify( |
| 184 content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, | 182 content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, |
| 185 content::Source<SearchProviderInstallDataTest>(this), | 183 content::Source<SearchProviderInstallDataTest>(this), |
| 186 content::NotificationService::NoDetails()); | 184 content::NotificationService::NoDetails()); |
| 187 | 185 |
| 188 util_.TearDown(); | 186 util_.TearDown(); |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 // Change the Google base url. | 304 // Change the Google base url. |
| 307 google_host = "foo.com"; | 305 google_host = "foo.com"; |
| 308 util_.SetGoogleBaseURL("http://" + google_host + "/"); | 306 util_.SetGoogleBaseURL("http://" + google_host + "/"); |
| 309 // Wait for the I/O thread to process the update notification. | 307 // Wait for the I/O thread to process the update notification. |
| 310 TemplateURLServiceTestUtil::BlockTillIOThreadProcessesRequests(); | 308 TemplateURLServiceTestUtil::BlockTillIOThreadProcessesRequests(); |
| 311 | 309 |
| 312 // Verify that the change got picked up. | 310 // Verify that the change got picked up. |
| 313 test_get_install_state->set_search_provider_host(google_host); | 311 test_get_install_state->set_search_provider_host(google_host); |
| 314 EXPECT_TRUE(test_get_install_state->RunTests()); | 312 EXPECT_TRUE(test_get_install_state->RunTests()); |
| 315 } | 313 } |
| OLD | NEW |