| 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 "chrome/browser/autocomplete/shortcuts_provider.h" | 5 #include "chrome/browser/autocomplete/shortcuts_provider.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <functional> | 10 #include <functional> |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 ASSERT_TRUE(backend_.get()); | 307 ASSERT_TRUE(backend_.get()); |
| 308 ASSERT_TRUE(profile_.CreateHistoryService(true, false)); | 308 ASSERT_TRUE(profile_.CreateHistoryService(true, false)); |
| 309 provider_ = new ShortcutsProvider(&profile_); | 309 provider_ = new ShortcutsProvider(&profile_); |
| 310 FillData(shortcut_test_db, arraysize(shortcut_test_db)); | 310 FillData(shortcut_test_db, arraysize(shortcut_test_db)); |
| 311 } | 311 } |
| 312 | 312 |
| 313 void ShortcutsProviderTest::TearDown() { | 313 void ShortcutsProviderTest::TearDown() { |
| 314 // Run all pending tasks or else some threads hold on to the message loop | 314 // Run all pending tasks or else some threads hold on to the message loop |
| 315 // and prevent it from being deleted. | 315 // and prevent it from being deleted. |
| 316 message_loop_.RunUntilIdle(); | 316 message_loop_.RunUntilIdle(); |
| 317 profile_.DestroyHistoryService(); |
| 317 provider_ = NULL; | 318 provider_ = NULL; |
| 318 } | 319 } |
| 319 | 320 |
| 320 void ShortcutsProviderTest::FillData(TestShortcutInfo* db, size_t db_size) { | 321 void ShortcutsProviderTest::FillData(TestShortcutInfo* db, size_t db_size) { |
| 321 DCHECK(provider_.get()); | 322 DCHECK(provider_.get()); |
| 322 size_t expected_size = backend_->shortcuts_map().size() + db_size; | 323 size_t expected_size = backend_->shortcuts_map().size() + db_size; |
| 323 for (size_t i = 0; i < db_size; ++i) { | 324 for (size_t i = 0; i < db_size; ++i) { |
| 324 const TestShortcutInfo& cur = db[i]; | 325 const TestShortcutInfo& cur = db[i]; |
| 325 history::ShortcutsDatabase::Shortcut shortcut( | 326 history::ShortcutsDatabase::Shortcut shortcut( |
| 326 cur.guid, ASCIIToUTF16(cur.text), | 327 cur.guid, ASCIIToUTF16(cur.text), |
| (...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 854 extension.get(), extensions::UnloadedExtensionInfo::REASON_UNINSTALL); | 855 extension.get(), extensions::UnloadedExtensionInfo::REASON_UNINSTALL); |
| 855 content::NotificationService::current()->Notify( | 856 content::NotificationService::current()->Notify( |
| 856 extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, | 857 extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, |
| 857 content::Source<Profile>(&profile_), | 858 content::Source<Profile>(&profile_), |
| 858 content::Details<extensions::UnloadedExtensionInfo>(&details)); | 859 content::Details<extensions::UnloadedExtensionInfo>(&details)); |
| 859 | 860 |
| 860 // Now the URL should have disappeared. | 861 // Now the URL should have disappeared. |
| 861 RunTest(text, false, ExpectedURLs(), std::string(), base::string16()); | 862 RunTest(text, false, ExpectedURLs(), std::string(), base::string16()); |
| 862 } | 863 } |
| 863 #endif | 864 #endif |
| OLD | NEW |