| 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 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 638 size_t original_shortcuts_count = backend_->shortcuts_map().size(); | 638 size_t original_shortcuts_count = backend_->shortcuts_map().size(); |
| 639 | 639 |
| 640 FillData(shortcuts_to_test_delete, arraysize(shortcuts_to_test_delete)); | 640 FillData(shortcuts_to_test_delete, arraysize(shortcuts_to_test_delete)); |
| 641 | 641 |
| 642 EXPECT_EQ(original_shortcuts_count + 3, backend_->shortcuts_map().size()); | 642 EXPECT_EQ(original_shortcuts_count + 3, backend_->shortcuts_map().size()); |
| 643 EXPECT_FALSE(backend_->shortcuts_map().end() == | 643 EXPECT_FALSE(backend_->shortcuts_map().end() == |
| 644 backend_->shortcuts_map().find(ASCIIToUTF16("delete"))); | 644 backend_->shortcuts_map().find(ASCIIToUTF16("delete"))); |
| 645 EXPECT_FALSE(backend_->shortcuts_map().end() == | 645 EXPECT_FALSE(backend_->shortcuts_map().end() == |
| 646 backend_->shortcuts_map().find(ASCIIToUTF16("erase"))); | 646 backend_->shortcuts_map().find(ASCIIToUTF16("erase"))); |
| 647 | 647 |
| 648 AutocompleteMatch match(provider_, 1200, true, | 648 AutocompleteMatch match( |
| 649 AutocompleteMatchType::HISTORY_TITLE); | 649 provider_.get(), 1200, true, AutocompleteMatchType::HISTORY_TITLE); |
| 650 | 650 |
| 651 match.destination_url = GURL(shortcuts_to_test_delete[0].url); | 651 match.destination_url = GURL(shortcuts_to_test_delete[0].url); |
| 652 match.contents = ASCIIToUTF16(shortcuts_to_test_delete[0].contents); | 652 match.contents = ASCIIToUTF16(shortcuts_to_test_delete[0].contents); |
| 653 match.description = ASCIIToUTF16(shortcuts_to_test_delete[0].description); | 653 match.description = ASCIIToUTF16(shortcuts_to_test_delete[0].description); |
| 654 | 654 |
| 655 provider_->DeleteMatch(match); | 655 provider_->DeleteMatch(match); |
| 656 | 656 |
| 657 // |shortcuts_to_test_delete[0]| and |shortcuts_to_test_delete[1]| should be | 657 // |shortcuts_to_test_delete[0]| and |shortcuts_to_test_delete[1]| should be |
| 658 // deleted, but not |shortcuts_to_test_delete[2]| as it has different url. | 658 // deleted, but not |shortcuts_to_test_delete[2]| as it has different url. |
| 659 EXPECT_EQ(original_shortcuts_count + 1, backend_->shortcuts_map().size()); | 659 EXPECT_EQ(original_shortcuts_count + 1, backend_->shortcuts_map().size()); |
| 660 EXPECT_FALSE(backend_->shortcuts_map().end() == | 660 EXPECT_FALSE(backend_->shortcuts_map().end() == |
| 661 backend_->shortcuts_map().find(ASCIIToUTF16("delete"))); | 661 backend_->shortcuts_map().find(ASCIIToUTF16("delete"))); |
| 662 EXPECT_TRUE(backend_->shortcuts_map().end() == | 662 EXPECT_TRUE(backend_->shortcuts_map().end() == |
| 663 backend_->shortcuts_map().find(ASCIIToUTF16("erase"))); | 663 backend_->shortcuts_map().find(ASCIIToUTF16("erase"))); |
| 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 |