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> |
11 #include <set> | 11 #include <set> |
12 #include <string> | 12 #include <string> |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
16 #include "base/message_loop.h" | 16 #include "base/message_loop.h" |
17 #include "base/stringprintf.h" | 17 #include "base/stringprintf.h" |
18 #include "base/utf_string_conversions.h" | 18 #include "base/utf_string_conversions.h" |
19 #include "chrome/browser/autocomplete/autocomplete.h" | 19 #include "chrome/browser/autocomplete/autocomplete.h" |
20 #include "chrome/browser/autocomplete/autocomplete_match.h" | 20 #include "chrome/browser/autocomplete/autocomplete_match.h" |
21 #include "chrome/browser/history/history.h" | 21 #include "chrome/browser/history/history.h" |
22 #include "chrome/browser/history/in_memory_url_index.h" | 22 #include "chrome/browser/history/in_memory_url_index.h" |
23 #include "chrome/browser/history/shortcuts_backend.h" | 23 #include "chrome/browser/history/shortcuts_backend.h" |
24 #include "chrome/browser/history/url_database.h" | 24 #include "chrome/browser/history/url_database.h" |
25 #include "chrome/browser/prefs/pref_service.h" | 25 #include "chrome/browser/prefs/pref_service.h" |
26 #include "chrome/common/pref_names.h" | 26 #include "chrome/common/pref_names.h" |
27 #include "chrome/test/base/testing_profile.h" | 27 #include "chrome/test/base/testing_profile.h" |
28 #include "content/test/test_browser_thread.h" | 28 #include "content/public/test/test_browser_thread.h" |
29 #include "testing/gtest/include/gtest/gtest.h" | 29 #include "testing/gtest/include/gtest/gtest.h" |
30 | 30 |
31 using content::BrowserThread; | 31 using content::BrowserThread; |
32 | 32 |
33 namespace { | 33 namespace { |
34 | 34 |
35 struct TestShortcutInfo { | 35 struct TestShortcutInfo { |
36 std::string guid; | 36 std::string guid; |
37 std::string url; | 37 std::string url; |
38 std::string title; // The text that orginally was searched for. | 38 std::string title; // The text that orginally was searched for. |
(...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
661 match.contents = ASCIIToUTF16(shortcuts_to_test_delete[2].contents); | 661 match.contents = ASCIIToUTF16(shortcuts_to_test_delete[2].contents); |
662 match.description = ASCIIToUTF16(shortcuts_to_test_delete[2].description); | 662 match.description = ASCIIToUTF16(shortcuts_to_test_delete[2].description); |
663 | 663 |
664 provider_->DeleteMatch(match); | 664 provider_->DeleteMatch(match); |
665 EXPECT_EQ(original_shortcuts_count, | 665 EXPECT_EQ(original_shortcuts_count, |
666 provider_->shortcuts_backend_->shortcuts_map().size()); | 666 provider_->shortcuts_backend_->shortcuts_map().size()); |
667 EXPECT_TRUE(provider_->shortcuts_backend_->shortcuts_map().end() == | 667 EXPECT_TRUE(provider_->shortcuts_backend_->shortcuts_map().end() == |
668 provider_->shortcuts_backend_->shortcuts_map().find( | 668 provider_->shortcuts_backend_->shortcuts_map().find( |
669 ASCIIToUTF16("delete"))); | 669 ASCIIToUTF16("delete"))); |
670 } | 670 } |
OLD | NEW |