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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 file_thread_(BrowserThread::FILE, &message_loop_) { | 172 file_thread_(BrowserThread::FILE, &message_loop_) { |
173 } | 173 } |
174 | 174 |
175 void ShortcutsProviderTest::OnProviderUpdate(bool updated_matches) {} | 175 void ShortcutsProviderTest::OnProviderUpdate(bool updated_matches) {} |
176 | 176 |
177 void ShortcutsProviderTest::SetUp() { | 177 void ShortcutsProviderTest::SetUp() { |
178 ShortcutsBackendFactory::GetInstance()->SetTestingFactoryAndUse( | 178 ShortcutsBackendFactory::GetInstance()->SetTestingFactoryAndUse( |
179 &profile_, &ShortcutsBackendFactory::BuildProfileNoDatabaseForTesting); | 179 &profile_, &ShortcutsBackendFactory::BuildProfileNoDatabaseForTesting); |
180 backend_ = ShortcutsBackendFactory::GetForProfile(&profile_); | 180 backend_ = ShortcutsBackendFactory::GetForProfile(&profile_); |
181 ASSERT_TRUE(backend_.get()); | 181 ASSERT_TRUE(backend_.get()); |
182 ASSERT_TRUE(profile_.CreateHistoryService(true, false)); | 182 profile_.CreateHistoryService(true, false); |
183 provider_ = new ShortcutsProvider(this, &profile_); | 183 provider_ = new ShortcutsProvider(this, &profile_); |
184 FillData(shortcut_test_db, arraysize(shortcut_test_db)); | 184 FillData(shortcut_test_db, arraysize(shortcut_test_db)); |
185 } | 185 } |
186 | 186 |
187 void ShortcutsProviderTest::TearDown() { | 187 void ShortcutsProviderTest::TearDown() { |
188 // Run all pending tasks or else some threads hold on to the message loop | 188 // Run all pending tasks or else some threads hold on to the message loop |
189 // and prevent it from being deleted. | 189 // and prevent it from being deleted. |
190 message_loop_.RunUntilIdle(); | 190 message_loop_.RunUntilIdle(); |
191 provider_ = NULL; | 191 provider_ = NULL; |
192 } | 192 } |
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
664 | 664 |
665 match.destination_url = GURL(shortcuts_to_test_delete[2].url); | 665 match.destination_url = GURL(shortcuts_to_test_delete[2].url); |
666 match.contents = ASCIIToUTF16(shortcuts_to_test_delete[2].contents); | 666 match.contents = ASCIIToUTF16(shortcuts_to_test_delete[2].contents); |
667 match.description = ASCIIToUTF16(shortcuts_to_test_delete[2].description); | 667 match.description = ASCIIToUTF16(shortcuts_to_test_delete[2].description); |
668 | 668 |
669 provider_->DeleteMatch(match); | 669 provider_->DeleteMatch(match); |
670 EXPECT_EQ(original_shortcuts_count, backend_->shortcuts_map().size()); | 670 EXPECT_EQ(original_shortcuts_count, backend_->shortcuts_map().size()); |
671 EXPECT_TRUE(backend_->shortcuts_map().end() == | 671 EXPECT_TRUE(backend_->shortcuts_map().end() == |
672 backend_->shortcuts_map().find(ASCIIToUTF16("delete"))); | 672 backend_->shortcuts_map().find(ASCIIToUTF16("delete"))); |
673 } | 673 } |
OLD | NEW |