| 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
| 7 #include "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/memory/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 1293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1304 | 1304 |
| 1305 // Simulates failing to load the webdb and makes sure the default search | 1305 // Simulates failing to load the webdb and makes sure the default search |
| 1306 // provider is valid. | 1306 // provider is valid. |
| 1307 TEST_F(TemplateURLServiceTest, FailedInit) { | 1307 TEST_F(TemplateURLServiceTest, FailedInit) { |
| 1308 test_util_.VerifyLoad(); | 1308 test_util_.VerifyLoad(); |
| 1309 | 1309 |
| 1310 test_util_.ClearModel(); | 1310 test_util_.ClearModel(); |
| 1311 scoped_refptr<WebDataService> web_service = | 1311 scoped_refptr<WebDataService> web_service = |
| 1312 WebDataServiceFactory::GetForProfile(test_util_.profile(), | 1312 WebDataServiceFactory::GetForProfile(test_util_.profile(), |
| 1313 Profile::EXPLICIT_ACCESS); | 1313 Profile::EXPLICIT_ACCESS); |
| 1314 web_service->UnloadDatabase(); | 1314 web_service->ShutdownDatabase(); |
| 1315 web_service->set_failed_init(true); | |
| 1316 | 1315 |
| 1317 test_util_.ResetModel(false); | 1316 test_util_.ResetModel(false); |
| 1318 model()->Load(); | 1317 model()->Load(); |
| 1319 test_util_.BlockTillServiceProcessesRequests(); | 1318 test_util_.BlockTillServiceProcessesRequests(); |
| 1320 | 1319 |
| 1321 ASSERT_TRUE(model()->GetDefaultSearchProvider()); | 1320 ASSERT_TRUE(model()->GetDefaultSearchProvider()); |
| 1322 } | 1321 } |
| 1323 | 1322 |
| 1324 // Verifies that if the default search URL preference is managed, we report | 1323 // Verifies that if the default search URL preference is managed, we report |
| 1325 // the default search as managed. Also check that we are getting the right | 1324 // the default search as managed. Also check that we are getting the right |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1517 EXPECT_EQ(8U, loaded_url->input_encodings().size()); | 1516 EXPECT_EQ(8U, loaded_url->input_encodings().size()); |
| 1518 | 1517 |
| 1519 // Reload the model to verify it was actually saved to the database and the | 1518 // Reload the model to verify it was actually saved to the database and the |
| 1520 // duplicate encodings were removed. | 1519 // duplicate encodings were removed. |
| 1521 test_util_.ResetModel(true); | 1520 test_util_.ResetModel(true); |
| 1522 ASSERT_EQ(initial_count + 1, model()->GetTemplateURLs().size()); | 1521 ASSERT_EQ(initial_count + 1, model()->GetTemplateURLs().size()); |
| 1523 loaded_url = model()->GetTemplateURLForKeyword(ASCIIToUTF16("keyword")); | 1522 loaded_url = model()->GetTemplateURLForKeyword(ASCIIToUTF16("keyword")); |
| 1524 ASSERT_FALSE(loaded_url == NULL); | 1523 ASSERT_FALSE(loaded_url == NULL); |
| 1525 EXPECT_EQ(4U, loaded_url->input_encodings().size()); | 1524 EXPECT_EQ(4U, loaded_url->input_encodings().size()); |
| 1526 } | 1525 } |
| OLD | NEW |