| 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 public: | 135 public: |
| 136 explicit SetShouldContain(const ACMatches& matched_urls); | 136 explicit SetShouldContain(const ACMatches& matched_urls); |
| 137 | 137 |
| 138 void operator()(const std::string& expected); | 138 void operator()(const std::string& expected); |
| 139 std::set<std::string> Leftovers() const { return matches_; } | 139 std::set<std::string> Leftovers() const { return matches_; } |
| 140 | 140 |
| 141 private: | 141 private: |
| 142 std::set<std::string> matches_; | 142 std::set<std::string> matches_; |
| 143 }; | 143 }; |
| 144 | 144 |
| 145 void SetUp(); | 145 virtual void SetUp(); |
| 146 void TearDown(); | 146 virtual void TearDown(); |
| 147 | 147 |
| 148 // Fills test data into the provider. | 148 // Fills test data into the provider. |
| 149 void FillData(TestShortcutInfo* db, size_t db_size); | 149 void FillData(TestShortcutInfo* db, size_t db_size); |
| 150 | 150 |
| 151 // Runs an autocomplete query on |text| and checks to see that the returned | 151 // Runs an autocomplete query on |text| and checks to see that the returned |
| 152 // results' destination URLs match those provided. |expected_urls| does not | 152 // results' destination URLs match those provided. |expected_urls| does not |
| 153 // need to be in sorted order. | 153 // need to be in sorted order. |
| 154 void RunTest(const string16 text, | 154 void RunTest(const string16 text, |
| 155 std::vector<std::string> expected_urls, | 155 std::vector<std::string> expected_urls, |
| 156 std::string expected_top_result); | 156 std::string expected_top_result); |
| (...skipping 507 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 |