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 <algorithm> | 5 #include <algorithm> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/files/file_enumerator.h" | 9 #include "base/files/file_enumerator.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
664 // Version 4 is deprecated, the data should all be gone. | 664 // Version 4 is deprecated, the data should all be gone. |
665 VerifyDatabaseEmpty(&db->db_); | 665 VerifyDatabaseEmpty(&db->db_); |
666 } | 666 } |
667 | 667 |
668 // Test loading version 5 database. | 668 // Test loading version 5 database. |
669 TEST_F(ThumbnailDatabaseTest, Version5) { | 669 TEST_F(ThumbnailDatabaseTest, Version5) { |
670 scoped_ptr<ThumbnailDatabase> db = LoadFromGolden("Favicons.v5.sql"); | 670 scoped_ptr<ThumbnailDatabase> db = LoadFromGolden("Favicons.v5.sql"); |
671 ASSERT_TRUE(db.get() != NULL); | 671 ASSERT_TRUE(db.get() != NULL); |
672 VerifyTablesAndColumns(&db->db_); | 672 VerifyTablesAndColumns(&db->db_); |
673 | 673 |
674 EXPECT_TRUE(CheckPageHasIcon(db.get(), | 674 // Version 5 is deprecated, the data should all be gone. |
675 kPageUrl1, | 675 VerifyDatabaseEmpty(&db->db_); |
676 favicon_base::FAVICON, | |
677 kIconUrl1, | |
678 gfx::Size(), | |
679 sizeof(kBlob1), | |
680 kBlob1)); | |
681 EXPECT_TRUE(CheckPageHasIcon(db.get(), | |
682 kPageUrl2, | |
683 favicon_base::FAVICON, | |
684 kIconUrl2, | |
685 gfx::Size(), | |
686 sizeof(kBlob2), | |
687 kBlob2)); | |
688 EXPECT_TRUE(CheckPageHasIcon(db.get(), | |
689 kPageUrl3, | |
690 favicon_base::FAVICON, | |
691 kIconUrl1, | |
692 gfx::Size(), | |
693 sizeof(kBlob1), | |
694 kBlob1)); | |
695 EXPECT_TRUE(CheckPageHasIcon(db.get(), | |
696 kPageUrl3, | |
697 favicon_base::TOUCH_ICON, | |
698 kIconUrl3, | |
699 gfx::Size(), | |
700 sizeof(kBlob2), | |
701 kBlob2)); | |
702 } | 676 } |
703 | 677 |
704 // Test loading version 6 database. | 678 // Test loading version 6 database. |
705 TEST_F(ThumbnailDatabaseTest, Version6) { | 679 TEST_F(ThumbnailDatabaseTest, Version6) { |
706 scoped_ptr<ThumbnailDatabase> db = LoadFromGolden("Favicons.v6.sql"); | 680 scoped_ptr<ThumbnailDatabase> db = LoadFromGolden("Favicons.v6.sql"); |
707 ASSERT_TRUE(db.get() != NULL); | 681 ASSERT_TRUE(db.get() != NULL); |
708 VerifyTablesAndColumns(&db->db_); | 682 VerifyTablesAndColumns(&db->db_); |
709 | 683 |
710 EXPECT_TRUE(CheckPageHasIcon(db.get(), | 684 EXPECT_TRUE(CheckPageHasIcon(db.get(), |
711 kPageUrl1, | 685 kPageUrl1, |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1029 ThumbnailDatabase db(NULL); | 1003 ThumbnailDatabase db(NULL); |
1030 ASSERT_EQ(sql::INIT_OK, db.Init(db_path)); | 1004 ASSERT_EQ(sql::INIT_OK, db.Init(db_path)); |
1031 | 1005 |
1032 // Verify that the resulting schema is correct, whether it | 1006 // Verify that the resulting schema is correct, whether it |
1033 // involved razing the file or fixing things in place. | 1007 // involved razing the file or fixing things in place. |
1034 VerifyTablesAndColumns(&db.db_); | 1008 VerifyTablesAndColumns(&db.db_); |
1035 } | 1009 } |
1036 } | 1010 } |
1037 | 1011 |
1038 } // namespace history | 1012 } // namespace history |
OLD | NEW |