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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 { "0,1", "0,0", AutocompleteMatchType::SEARCH_SUGGEST, | 191 { "0,1", "0,0", AutocompleteMatchType::SEARCH_SUGGEST, |
192 "0,1", "0,0", AutocompleteMatchType::SEARCH_HISTORY }, | 192 "0,1", "0,0", AutocompleteMatchType::SEARCH_HISTORY }, |
193 { "0,1", "0,0", AutocompleteMatchType::SEARCH_SUGGEST_ENTITY, | 193 { "0,1", "0,0", AutocompleteMatchType::SEARCH_SUGGEST_ENTITY, |
194 "", "", AutocompleteMatchType::SEARCH_HISTORY }, | 194 "", "", AutocompleteMatchType::SEARCH_HISTORY }, |
195 { "0,1", "0,0", AutocompleteMatchType::SEARCH_SUGGEST_INFINITE, | 195 { "0,1", "0,0", AutocompleteMatchType::SEARCH_SUGGEST_INFINITE, |
196 "", "", AutocompleteMatchType::SEARCH_HISTORY }, | 196 "", "", AutocompleteMatchType::SEARCH_HISTORY }, |
197 { "0,1", "0,0", AutocompleteMatchType::SEARCH_SUGGEST_PERSONALIZED, | 197 { "0,1", "0,0", AutocompleteMatchType::SEARCH_SUGGEST_PERSONALIZED, |
198 "", "", AutocompleteMatchType::SEARCH_HISTORY }, | 198 "", "", AutocompleteMatchType::SEARCH_HISTORY }, |
199 { "0,1", "0,0", AutocompleteMatchType::SEARCH_SUGGEST_PROFILE, | 199 { "0,1", "0,0", AutocompleteMatchType::SEARCH_SUGGEST_PROFILE, |
200 "", "", AutocompleteMatchType::SEARCH_HISTORY }, | 200 "", "", AutocompleteMatchType::SEARCH_HISTORY }, |
201 { "0,1", "0,0", AutocompleteMatchType::SEARCH_SUGGEST_ANSWER, | |
202 "", "", AutocompleteMatchType::SEARCH_HISTORY }, | |
203 }; | 201 }; |
204 | 202 |
205 for (size_t i = 0; i < arraysize(cases); ++i) { | 203 for (size_t i = 0; i < arraysize(cases); ++i) { |
206 history::ShortcutsDatabase::Shortcut::MatchCore match_core( | 204 history::ShortcutsDatabase::Shortcut::MatchCore match_core( |
207 MatchCoreForTesting(std::string(), cases[i].input_contents_class, | 205 MatchCoreForTesting(std::string(), cases[i].input_contents_class, |
208 cases[i].input_description_class, | 206 cases[i].input_description_class, |
209 cases[i].input_type)); | 207 cases[i].input_type)); |
210 EXPECT_EQ(cases[i].output_contents_class, match_core.contents_class) | 208 EXPECT_EQ(cases[i].output_contents_class, match_core.contents_class) |
211 << ":i:" << i << ":type:" << cases[i].input_type; | 209 << ":i:" << i << ":type:" << cases[i].input_type; |
212 EXPECT_EQ(cases[i].output_description_class, match_core.description_class) | 210 EXPECT_EQ(cases[i].output_description_class, match_core.description_class) |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 ASSERT_TRUE(shortcut4_iter != shortcuts_map().end()); | 310 ASSERT_TRUE(shortcut4_iter != shortcuts_map().end()); |
313 EXPECT_EQ(shortcut4.id, shortcut4_iter->second.id); | 311 EXPECT_EQ(shortcut4.id, shortcut4_iter->second.id); |
314 | 312 |
315 history::ShortcutsDatabase::ShortcutIDs deleted_ids; | 313 history::ShortcutsDatabase::ShortcutIDs deleted_ids; |
316 deleted_ids.push_back(shortcut3.id); | 314 deleted_ids.push_back(shortcut3.id); |
317 deleted_ids.push_back(shortcut4.id); | 315 deleted_ids.push_back(shortcut4.id); |
318 EXPECT_TRUE(DeleteShortcutsWithIDs(deleted_ids)); | 316 EXPECT_TRUE(DeleteShortcutsWithIDs(deleted_ids)); |
319 | 317 |
320 ASSERT_EQ(0U, shortcuts_map().size()); | 318 ASSERT_EQ(0U, shortcuts_map().size()); |
321 } | 319 } |
OLD | NEW |