| 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_backend.h" | 5 #include "chrome/browser/autocomplete/shortcuts_backend.h" |
| 6 | 6 |
| 7 #include "base/files/scoped_temp_dir.h" | 7 #include "base/files/scoped_temp_dir.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 return ShortcutsBackend::MatchToMatchCore(match, &profile_); | 96 return ShortcutsBackend::MatchToMatchCore(match, &profile_); |
| 97 } | 97 } |
| 98 | 98 |
| 99 void ShortcutsBackendTest::SetSearchProvider() { | 99 void ShortcutsBackendTest::SetSearchProvider() { |
| 100 TemplateURLService* template_url_service = | 100 TemplateURLService* template_url_service = |
| 101 TemplateURLServiceFactory::GetForProfile(&profile_); | 101 TemplateURLServiceFactory::GetForProfile(&profile_); |
| 102 TemplateURLData data; | 102 TemplateURLData data; |
| 103 data.SetURL("http://foo.com/search?bar={searchTerms}"); | 103 data.SetURL("http://foo.com/search?bar={searchTerms}"); |
| 104 data.SetKeyword(base::UTF8ToUTF16("foo")); | 104 data.SetKeyword(base::UTF8ToUTF16("foo")); |
| 105 | 105 |
| 106 TemplateURL* template_url = new TemplateURL(&profile_, data); | 106 TemplateURL* template_url = new TemplateURL(data); |
| 107 // Takes ownership of |template_url|. | 107 // Takes ownership of |template_url|. |
| 108 template_url_service->Add(template_url); | 108 template_url_service->Add(template_url); |
| 109 template_url_service->SetUserSelectedDefaultSearchProvider(template_url); | 109 template_url_service->SetUserSelectedDefaultSearchProvider(template_url); |
| 110 } | 110 } |
| 111 | 111 |
| 112 void ShortcutsBackendTest::SetUp() { | 112 void ShortcutsBackendTest::SetUp() { |
| 113 db_thread_.Start(); | 113 db_thread_.Start(); |
| 114 ShortcutsBackendFactory::GetInstance()->SetTestingFactoryAndUse( | 114 ShortcutsBackendFactory::GetInstance()->SetTestingFactoryAndUse( |
| 115 &profile_, &ShortcutsBackendFactory::BuildProfileForTesting); | 115 &profile_, &ShortcutsBackendFactory::BuildProfileForTesting); |
| 116 backend_ = ShortcutsBackendFactory::GetForProfile(&profile_); | 116 backend_ = ShortcutsBackendFactory::GetForProfile(&profile_); |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 ASSERT_TRUE(shortcut4_iter != shortcuts_map().end()); | 313 ASSERT_TRUE(shortcut4_iter != shortcuts_map().end()); |
| 314 EXPECT_EQ(shortcut4.id, shortcut4_iter->second.id); | 314 EXPECT_EQ(shortcut4.id, shortcut4_iter->second.id); |
| 315 | 315 |
| 316 history::ShortcutsDatabase::ShortcutIDs deleted_ids; | 316 history::ShortcutsDatabase::ShortcutIDs deleted_ids; |
| 317 deleted_ids.push_back(shortcut3.id); | 317 deleted_ids.push_back(shortcut3.id); |
| 318 deleted_ids.push_back(shortcut4.id); | 318 deleted_ids.push_back(shortcut4.id); |
| 319 EXPECT_TRUE(DeleteShortcutsWithIDs(deleted_ids)); | 319 EXPECT_TRUE(DeleteShortcutsWithIDs(deleted_ids)); |
| 320 | 320 |
| 321 ASSERT_EQ(0U, shortcuts_map().size()); | 321 ASSERT_EQ(0U, shortcuts_map().size()); |
| 322 } | 322 } |
| OLD | NEW |