| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/files/file_enumerator.h" | 10 #include "base/files/file_enumerator.h" |
| (...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 629 // Version 5 is deprecated, the data should all be gone. | 629 // Version 5 is deprecated, the data should all be gone. |
| 630 VerifyDatabaseEmpty(&db->db_); | 630 VerifyDatabaseEmpty(&db->db_); |
| 631 } | 631 } |
| 632 | 632 |
| 633 // Test loading version 6 database. | 633 // Test loading version 6 database. |
| 634 TEST_F(ThumbnailDatabaseTest, Version6) { | 634 TEST_F(ThumbnailDatabaseTest, Version6) { |
| 635 std::unique_ptr<ThumbnailDatabase> db = LoadFromGolden("Favicons.v6.sql"); | 635 std::unique_ptr<ThumbnailDatabase> db = LoadFromGolden("Favicons.v6.sql"); |
| 636 ASSERT_TRUE(db.get() != NULL); | 636 ASSERT_TRUE(db.get() != NULL); |
| 637 VerifyTablesAndColumns(&db->db_); | 637 VerifyTablesAndColumns(&db->db_); |
| 638 | 638 |
| 639 EXPECT_TRUE(CheckPageHasIcon(db.get(), | 639 // Version 6 is deprecated, the data should all be gone. |
| 640 kPageUrl1, | 640 VerifyDatabaseEmpty(&db->db_); |
| 641 favicon_base::FAVICON, | |
| 642 kIconUrl1, | |
| 643 kLargeSize, | |
| 644 sizeof(kBlob1), | |
| 645 kBlob1)); | |
| 646 EXPECT_TRUE(CheckPageHasIcon(db.get(), | |
| 647 kPageUrl2, | |
| 648 favicon_base::FAVICON, | |
| 649 kIconUrl2, | |
| 650 kLargeSize, | |
| 651 sizeof(kBlob2), | |
| 652 kBlob2)); | |
| 653 EXPECT_TRUE(CheckPageHasIcon(db.get(), | |
| 654 kPageUrl3, | |
| 655 favicon_base::FAVICON, | |
| 656 kIconUrl1, | |
| 657 kLargeSize, | |
| 658 sizeof(kBlob1), | |
| 659 kBlob1)); | |
| 660 EXPECT_TRUE(CheckPageHasIcon(db.get(), | |
| 661 kPageUrl3, | |
| 662 favicon_base::TOUCH_ICON, | |
| 663 kIconUrl3, | |
| 664 kLargeSize, | |
| 665 sizeof(kBlob2), | |
| 666 kBlob2)); | |
| 667 } | 641 } |
| 668 | 642 |
| 669 // Test loading version 7 database. | 643 // Test loading version 7 database. |
| 670 TEST_F(ThumbnailDatabaseTest, Version7) { | 644 TEST_F(ThumbnailDatabaseTest, Version7) { |
| 671 std::unique_ptr<ThumbnailDatabase> db = LoadFromGolden("Favicons.v7.sql"); | 645 std::unique_ptr<ThumbnailDatabase> db = LoadFromGolden("Favicons.v7.sql"); |
| 672 ASSERT_TRUE(db.get() != NULL); | 646 ASSERT_TRUE(db.get() != NULL); |
| 673 VerifyTablesAndColumns(&db->db_); | 647 VerifyTablesAndColumns(&db->db_); |
| 674 | 648 |
| 675 EXPECT_TRUE(CheckPageHasIcon(db.get(), | 649 EXPECT_TRUE(CheckPageHasIcon(db.get(), |
| 676 kPageUrl1, | 650 kPageUrl1, |
| (...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1106 ThumbnailDatabase db(NULL); | 1080 ThumbnailDatabase db(NULL); |
| 1107 ASSERT_EQ(sql::INIT_OK, db.Init(db_path)); | 1081 ASSERT_EQ(sql::INIT_OK, db.Init(db_path)); |
| 1108 | 1082 |
| 1109 // Verify that the resulting schema is correct, whether it | 1083 // Verify that the resulting schema is correct, whether it |
| 1110 // involved razing the file or fixing things in place. | 1084 // involved razing the file or fixing things in place. |
| 1111 VerifyTablesAndColumns(&db.db_); | 1085 VerifyTablesAndColumns(&db.db_); |
| 1112 } | 1086 } |
| 1113 } | 1087 } |
| 1114 | 1088 |
| 1115 } // namespace history | 1089 } // namespace history |
| OLD | NEW |