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" |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 | 218 |
219 // Verify the search providers install state (with no default set). | 219 // Verify the search providers install state (with no default set). |
220 TestGetInstallState test_get_install_state(install_data_); | 220 TestGetInstallState test_get_install_state(install_data_); |
221 test_get_install_state.RunTests(host, std::string()); | 221 test_get_install_state.RunTests(host, std::string()); |
222 | 222 |
223 // Set-up a default and try it all one more time. | 223 // Set-up a default and try it all one more time. |
224 std::string default_host = "www.mmm.com"; | 224 std::string default_host = "www.mmm.com"; |
225 TemplateURL* default_url = | 225 TemplateURL* default_url = |
226 AddNewTemplateURL("http://" + default_host + "/", | 226 AddNewTemplateURL("http://" + default_host + "/", |
227 base::ASCIIToUTF16("mmm")); | 227 base::ASCIIToUTF16("mmm")); |
228 util_.model()->SetDefaultSearchProvider(default_url); | 228 util_.model()->SetUserSelectedDefaultSearchProvider(default_url); |
229 test_get_install_state.RunTests(host, default_host); | 229 test_get_install_state.RunTests(host, default_host); |
230 } | 230 } |
231 | 231 |
232 TEST_F(SearchProviderInstallDataTest, ManagedDefaultSearch) { | 232 TEST_F(SearchProviderInstallDataTest, ManagedDefaultSearch) { |
233 // Set up the database. | 233 // Set up the database. |
234 util_.ChangeModelToLoadState(); | 234 util_.ChangeModelToLoadState(); |
235 std::string host = "www.unittest.com"; | 235 std::string host = "www.unittest.com"; |
236 AddNewTemplateURL("http://" + host + "/path", base::ASCIIToUTF16("unittest")); | 236 AddNewTemplateURL("http://" + host + "/path", base::ASCIIToUTF16("unittest")); |
237 | 237 |
238 // Set a managed preference that establishes a default search provider. | 238 // Set a managed preference that establishes a default search provider. |
(...skipping 18 matching lines...) Expand all Loading... |
257 util_.ChangeModelToLoadState(); | 257 util_.ChangeModelToLoadState(); |
258 std::string google_host = "w.com"; | 258 std::string google_host = "w.com"; |
259 util_.SetGoogleBaseURL(GURL("http://" + google_host + "/")); | 259 util_.SetGoogleBaseURL(GURL("http://" + google_host + "/")); |
260 // Wait for the I/O thread to process the update notification. | 260 // Wait for the I/O thread to process the update notification. |
261 base::RunLoop().RunUntilIdle(); | 261 base::RunLoop().RunUntilIdle(); |
262 | 262 |
263 AddNewTemplateURL("{google:baseURL}?q={searchTerms}", | 263 AddNewTemplateURL("{google:baseURL}?q={searchTerms}", |
264 base::ASCIIToUTF16("t")); | 264 base::ASCIIToUTF16("t")); |
265 TemplateURL* default_url = | 265 TemplateURL* default_url = |
266 AddNewTemplateURL("http://d.com/", base::ASCIIToUTF16("d")); | 266 AddNewTemplateURL("http://d.com/", base::ASCIIToUTF16("d")); |
267 util_.model()->SetDefaultSearchProvider(default_url); | 267 util_.model()->SetUserSelectedDefaultSearchProvider(default_url); |
268 | 268 |
269 // Wait for the changes to be saved. | 269 // Wait for the changes to be saved. |
270 base::RunLoop().RunUntilIdle(); | 270 base::RunLoop().RunUntilIdle(); |
271 | 271 |
272 // Verify the search providers install state (with no default set). | 272 // Verify the search providers install state (with no default set). |
273 test_get_install_state.RunTests(google_host, std::string()); | 273 test_get_install_state.RunTests(google_host, std::string()); |
274 | 274 |
275 // Change the Google base url. | 275 // Change the Google base url. |
276 google_host = "foo.com"; | 276 google_host = "foo.com"; |
277 util_.SetGoogleBaseURL(GURL("http://" + google_host + "/")); | 277 util_.SetGoogleBaseURL(GURL("http://" + google_host + "/")); |
278 // Wait for the I/O thread to process the update notification. | 278 // Wait for the I/O thread to process the update notification. |
279 base::RunLoop().RunUntilIdle(); | 279 base::RunLoop().RunUntilIdle(); |
280 | 280 |
281 // Verify that the change got picked up. | 281 // Verify that the change got picked up. |
282 test_get_install_state.RunTests(google_host, std::string()); | 282 test_get_install_state.RunTests(google_host, std::string()); |
283 } | 283 } |
OLD | NEW |