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/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 match.search_terms_args.reset( | 93 match.search_terms_args.reset( |
94 new TemplateURLRef::SearchTermsArgs(match.contents)); | 94 new TemplateURLRef::SearchTermsArgs(match.contents)); |
95 return ShortcutsBackend::MatchToMatchCore(match, &profile_); | 95 return ShortcutsBackend::MatchToMatchCore(match, &profile_); |
96 } | 96 } |
97 | 97 |
98 void ShortcutsBackendTest::SetSearchProvider() { | 98 void ShortcutsBackendTest::SetSearchProvider() { |
99 TemplateURLService* template_url_service = | 99 TemplateURLService* template_url_service = |
100 TemplateURLServiceFactory::GetForProfile(&profile_); | 100 TemplateURLServiceFactory::GetForProfile(&profile_); |
101 TemplateURLData data; | 101 TemplateURLData data; |
102 data.SetURL("http://foo.com/search?bar={searchTerms}"); | 102 data.SetURL("http://foo.com/search?bar={searchTerms}"); |
| 103 data.SetShortName(base::UTF8ToUTF16("foo")); |
103 data.SetKeyword(base::UTF8ToUTF16("foo")); | 104 data.SetKeyword(base::UTF8ToUTF16("foo")); |
104 | 105 |
105 TemplateURL* template_url = new TemplateURL(data); | 106 TemplateURL* template_url = new TemplateURL(data); |
106 // Takes ownership of |template_url|. | 107 // Takes ownership of |template_url|. |
107 template_url_service->Add(template_url); | 108 template_url_service->Add(template_url); |
108 template_url_service->SetUserSelectedDefaultSearchProvider(template_url); | 109 template_url_service->SetUserSelectedDefaultSearchProvider(template_url); |
109 } | 110 } |
110 | 111 |
111 void ShortcutsBackendTest::SetUp() { | 112 void ShortcutsBackendTest::SetUp() { |
112 db_thread_.Start(); | 113 db_thread_.Start(); |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 ASSERT_TRUE(shortcut4_iter != shortcuts_map().end()); | 310 ASSERT_TRUE(shortcut4_iter != shortcuts_map().end()); |
310 EXPECT_EQ(shortcut4.id, shortcut4_iter->second.id); | 311 EXPECT_EQ(shortcut4.id, shortcut4_iter->second.id); |
311 | 312 |
312 ShortcutsDatabase::ShortcutIDs deleted_ids; | 313 ShortcutsDatabase::ShortcutIDs deleted_ids; |
313 deleted_ids.push_back(shortcut3.id); | 314 deleted_ids.push_back(shortcut3.id); |
314 deleted_ids.push_back(shortcut4.id); | 315 deleted_ids.push_back(shortcut4.id); |
315 EXPECT_TRUE(DeleteShortcutsWithIDs(deleted_ids)); | 316 EXPECT_TRUE(DeleteShortcutsWithIDs(deleted_ids)); |
316 | 317 |
317 ASSERT_EQ(0U, shortcuts_map().size()); | 318 ASSERT_EQ(0U, shortcuts_map().size()); |
318 } | 319 } |
OLD | NEW |