OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "testing/gtest/include/gtest/gtest.h" | 5 #include "testing/gtest/include/gtest/gtest.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "app/sql/connection.h" | 9 #include "app/sql/connection.h" |
10 #include "app/sql/statement.h" | 10 #include "app/sql/statement.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 FilePath GetDatabasePath() { | 41 FilePath GetDatabasePath() { |
42 return temp_dir_.path().Append( | 42 return temp_dir_.path().Append( |
43 DirectoryManager::GetSyncDataDatabaseFilename()); | 43 DirectoryManager::GetSyncDataDatabaseFilename()); |
44 } | 44 } |
45 void SetUpVersion67Database(); | 45 void SetUpVersion67Database(); |
46 void SetUpVersion68Database(); | 46 void SetUpVersion68Database(); |
47 void SetUpVersion69Database(); | 47 void SetUpVersion69Database(); |
48 void SetUpVersion70Database(); | 48 void SetUpVersion70Database(); |
49 void SetUpVersion71Database(); | 49 void SetUpVersion71Database(); |
50 void SetUpVersion72Database(); | 50 void SetUpVersion72Database(); |
| 51 void SetUpVersion73Database(); |
51 | 52 |
52 void SetUpCurrentDatabaseAndCheckVersion() { | 53 void SetUpCurrentDatabaseAndCheckVersion() { |
53 SetUpVersion70Database(); // Prepopulates data. | 54 SetUpVersion70Database(); // Prepopulates data. |
54 scoped_ptr<DirectoryBackingStore> dbs( | 55 scoped_ptr<DirectoryBackingStore> dbs( |
55 new DirectoryBackingStore(GetUsername(), GetDatabasePath())); | 56 new DirectoryBackingStore(GetUsername(), GetDatabasePath())); |
56 | 57 |
57 dbs->BeginLoad(); | 58 dbs->BeginLoad(); |
58 ASSERT_EQ(OPENED, dbs->InitializeTables()); | 59 ASSERT_EQ(OPENED, dbs->InitializeTables()); |
59 ASSERT_FALSE(dbs->needs_column_refresh_); | 60 ASSERT_FALSE(dbs->needs_column_refresh_); |
60 ASSERT_EQ(kCurrentDBVersion, dbs->GetVersion()); | 61 ASSERT_EQ(kCurrentDBVersion, dbs->GetVersion()); |
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
636 "'9010788312004066376x-6609234393368420856x');")); | 637 "'9010788312004066376x-6609234393368420856x');")); |
637 ASSERT_TRUE(connection.CommitTransaction()); | 638 ASSERT_TRUE(connection.CommitTransaction()); |
638 } | 639 } |
639 | 640 |
640 void MigrationTest::SetUpVersion72Database() { | 641 void MigrationTest::SetUpVersion72Database() { |
641 sql::Connection connection; | 642 sql::Connection connection; |
642 ASSERT_TRUE(connection.Open(GetDatabasePath())); | 643 ASSERT_TRUE(connection.Open(GetDatabasePath())); |
643 ASSERT_TRUE(connection.BeginTransaction()); | 644 ASSERT_TRUE(connection.BeginTransaction()); |
644 ASSERT_TRUE(connection.Execute( | 645 ASSERT_TRUE(connection.Execute( |
645 "CREATE TABLE share_version (id VARCHAR(128) primary key, data INT);" | 646 "CREATE TABLE share_version (id VARCHAR(128) primary key, data INT);" |
646 "INSERT INTO 'share_version' VALUES('nick@chromium.org',71);" | 647 "INSERT INTO 'share_version' VALUES('nick@chromium.org',72);" |
647 "CREATE TABLE metas(metahandle bigint primary key ON CONFLICT FAIL," | 648 "CREATE TABLE metas(metahandle bigint primary key ON CONFLICT FAIL," |
648 "base_version bigint default -1,server_version bigint default 0," | 649 "base_version bigint default -1,server_version bigint default 0," |
649 "mtime bigint default 0,server_mtime bigint default 0,ctime bigint " | 650 "mtime bigint default 0,server_mtime bigint default 0,ctime bigint " |
650 "default 0,server_ctime bigint default 0,server_position_in_parent " | 651 "default 0,server_ctime bigint default 0,server_position_in_parent " |
651 "bigint default 0,local_external_id bigint default 0,id varchar(255) " | 652 "bigint default 0,local_external_id bigint default 0,id varchar(255) " |
652 "default 'r',parent_id varchar(255) default 'r',server_parent_id " | 653 "default 'r',parent_id varchar(255) default 'r',server_parent_id " |
653 "varchar(255) default 'r',prev_id varchar(255) default 'r',next_id " | 654 "varchar(255) default 'r',prev_id varchar(255) default 'r',next_id " |
654 "varchar(255) default 'r',is_unsynced bit default 0," | 655 "varchar(255) default 'r',is_unsynced bit default 0," |
655 "is_unapplied_update bit default 0,is_del bit default 0,is_dir bit " | 656 "is_unapplied_update bit default 0,is_del bit default 0,is_dir bit " |
656 "default 0,server_is_dir bit default 0,server_is_del bit default 0," | 657 "default 0,server_is_dir bit default 0,server_is_del bit default 0," |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
734 "INSERT INTO 'models' VALUES(X'C2881000',694,1);" | 735 "INSERT INTO 'models' VALUES(X'C2881000',694,1);" |
735 "CREATE TABLE 'share_info' (id TEXT primary key, name TEXT, " | 736 "CREATE TABLE 'share_info' (id TEXT primary key, name TEXT, " |
736 "store_birthday TEXT, db_create_version TEXT, db_create_time INT, " | 737 "store_birthday TEXT, db_create_version TEXT, db_create_time INT, " |
737 "next_id INT default -2, cache_guid TEXT);" | 738 "next_id INT default -2, cache_guid TEXT);" |
738 "INSERT INTO 'share_info' VALUES('nick@chromium.org','nick@chromium.org'," | 739 "INSERT INTO 'share_info' VALUES('nick@chromium.org','nick@chromium.org'," |
739 "'c27e9f59-08ca-46f8-b0cc-f16a2ed778bb','Unknown',1263522064,-65542," | 740 "'c27e9f59-08ca-46f8-b0cc-f16a2ed778bb','Unknown',1263522064,-65542," |
740 "'9010788312004066376x-6609234393368420856x');")); | 741 "'9010788312004066376x-6609234393368420856x');")); |
741 ASSERT_TRUE(connection.CommitTransaction()); | 742 ASSERT_TRUE(connection.CommitTransaction()); |
742 } | 743 } |
743 | 744 |
| 745 void MigrationTest::SetUpVersion73Database() { |
| 746 sql::Connection connection; |
| 747 ASSERT_TRUE(connection.Open(GetDatabasePath())); |
| 748 ASSERT_TRUE(connection.BeginTransaction()); |
| 749 ASSERT_TRUE(connection.Execute( |
| 750 "CREATE TABLE share_version (id VARCHAR(128) primary key, data INT);" |
| 751 "INSERT INTO 'share_version' VALUES('nick@chromium.org',73);" |
| 752 "CREATE TABLE metas(metahandle bigint primary key ON CONFLICT FAIL," |
| 753 "base_version bigint default -1,server_version bigint default 0," |
| 754 "mtime bigint default 0,server_mtime bigint default 0,ctime bigint " |
| 755 "default 0,server_ctime bigint default 0,server_position_in_parent " |
| 756 "bigint default 0,local_external_id bigint default 0,id varchar(255) " |
| 757 "default 'r',parent_id varchar(255) default 'r',server_parent_id " |
| 758 "varchar(255) default 'r',prev_id varchar(255) default 'r',next_id " |
| 759 "varchar(255) default 'r',is_unsynced bit default 0," |
| 760 "is_unapplied_update bit default 0,is_del bit default 0,is_dir bit " |
| 761 "default 0,server_is_dir bit default 0,server_is_del bit default 0," |
| 762 "non_unique_name varchar,server_non_unique_name varchar(255)," |
| 763 "unique_server_tag varchar,unique_client_tag varchar,specifics blob," |
| 764 "server_specifics blob);" |
| 765 "INSERT INTO 'metas' VALUES(1,-1,0,129079956640320000,0," |
| 766 "129079956640320000,0,0,0,'r','r','r','r','r',0,0,0,1,0,0,NULL,NULL," |
| 767 "NULL,NULL,X'',X'');" |
| 768 "INSERT INTO 'metas' VALUES(2,669,669,128976886618480000," |
| 769 "128976886618480000,128976886618480000,128976886618480000,-2097152,4," |
| 770 "'s_ID_2','s_ID_9','s_ID_9','s_ID_2','s_ID_2',0,0,1,0,0,1," |
| 771 "'Deleted Item','Deleted Item',NULL,NULL,X'C28810220A16687474703A2F2F" |
| 772 "7777772E676F6F676C652E636F6D2F12084141534741534741',X'C28810260A1768" |
| 773 "7474703A2F2F7777772E676F6F676C652E636F6D2F32120B41534144474144474144" |
| 774 "47');" |
| 775 "INSERT INTO 'metas' VALUES(4,681,681,129002163642690000," |
| 776 "129002163642690000,129002163642690000,129002163642690000,-3145728,3," |
| 777 "'s_ID_4','s_ID_9','s_ID_9','s_ID_4','s_ID_4',0,0,1,0,0,1," |
| 778 "'Welcome to Chromium','Welcome to Chromium',NULL,NULL,X'C28810350A31" |
| 779 "687474703A2F2F7777772E676F6F676C652E636F6D2F6368726F6D652F696E746C2F" |
| 780 "656E2F77656C636F6D652E68746D6C1200',X'C28810350A31687474703A2F2F7777" |
| 781 "772E676F6F676C652E636F6D2F6368726F6D652F696E746C2F656E2F77656C636F6D" |
| 782 "652E68746D6C1200');" |
| 783 "INSERT INTO 'metas' VALUES(5,677,677,129001555500000000," |
| 784 "129001555500000000,129001555500000000,129001555500000000,1048576,7," |
| 785 "'s_ID_5','s_ID_9','s_ID_9','s_ID_5','s_ID_5',0,0,1,0,0,1,'Google'," |
| 786 "'Google',NULL,NULL,X'C28810220A16687474703A2F2F7777772E676F6F676C652" |
| 787 "E636F6D2F12084147415347415347',X'C28810220A16687474703A2F2F7777772E6" |
| 788 "76F6F676C652E636F6D2F12084147464447415347');" |
| 789 "INSERT INTO 'metas' VALUES(6,694,694,129053976170000000," |
| 790 "129053976170000000,129053976170000000,129053976170000000,-4194304,6," |
| 791 "'s_ID_6','s_ID_9','s_ID_9','r','r',0,0,0,1,1,0,'The Internet'," |
| 792 "'The Internet',NULL,NULL,X'C2881000',X'C2881000');" |
| 793 "INSERT INTO 'metas' VALUES(7,663,663,128976864758480000," |
| 794 "128976864758480000,128976864758480000,128976864758480000,1048576,0," |
| 795 "'s_ID_7','r','r','r','r',0,0,0,1,1,0,'Google Chrome','Google Chrome'" |
| 796 ",'google_chrome',NULL,NULL,NULL);" |
| 797 "INSERT INTO 'metas' VALUES(8,664,664,128976864758480000," |
| 798 "128976864758480000,128976864758480000,128976864758480000,1048576,0," |
| 799 "'s_ID_8','s_ID_7','s_ID_7','r','r',0,0,0,1,1,0,'Bookmarks'," |
| 800 "'Bookmarks','google_chrome_bookmarks',NULL,X'C2881000',X'C2881000');" |
| 801 "INSERT INTO 'metas' VALUES(9,665,665,128976864758480000," |
| 802 "128976864758480000,128976864758480000,128976864758480000,1048576,1," |
| 803 "'s_ID_9','s_ID_8','s_ID_8','r','s_ID_10',0,0,0,1,1,0,'Bookmark Bar'," |
| 804 "'Bookmark Bar','bookmark_bar',NULL,X'C2881000',X'C2881000');" |
| 805 "INSERT INTO 'metas' VALUES(10,666,666,128976864758480000," |
| 806 "128976864758480000,128976864758480000,128976864758480000,2097152,2," |
| 807 "'s_ID_10','s_ID_8','s_ID_8','s_ID_9','r',0,0,0,1,1,0," |
| 808 "'Other Bookmarks','Other Bookmarks','other_bookmarks',NULL," |
| 809 "X'C2881000',X'C2881000');" |
| 810 "INSERT INTO 'metas' VALUES(11,683,683,129079956948440000," |
| 811 "129079956948440000,129079956948440000,129079956948440000,-1048576,8," |
| 812 "'s_ID_11','s_ID_6','s_ID_6','r','s_ID_13',0,0,0,0,0,0," |
| 813 "'Home (The Chromium Projects)','Home (The Chromium Projects)',NULL," |
| 814 "NULL,X'C28810220A18687474703A2F2F6465762E6368726F6D69756D2E6F72672F1" |
| 815 "206414741545741',X'C28810290A1D687474703A2F2F6465762E6368726F6D69756" |
| 816 "D2E6F72672F6F7468657212084146414756415346');" |
| 817 "INSERT INTO 'metas' VALUES(12,685,685,129079957513650000," |
| 818 "129079957513650000,129079957513650000,129079957513650000,0,9," |
| 819 "'s_ID_12','s_ID_6','s_ID_6','s_ID_13','s_ID_14',0,0,0,1,1,0," |
| 820 "'Extra Bookmarks','Extra Bookmarks',NULL,NULL,X'C2881000'," |
| 821 "X'C2881000');" |
| 822 "INSERT INTO 'metas' VALUES(13,687,687,129079957985300000," |
| 823 "129079957985300000,129079957985300000,129079957985300000,-917504,10," |
| 824 "'s_ID_13','s_ID_6','s_ID_6','s_ID_11','s_ID_12',0,0,0,0,0,0," |
| 825 "'ICANN | Internet Corporation for Assigned Names and Numbers'," |
| 826 "'ICANN | Internet Corporation for Assigned Names and Numbers',NULL," |
| 827 "NULL,X'C28810240A15687474703A2F2F7777772E6963616E6E2E636F6D2F120B504" |
| 828 "E474158463041414646',X'C28810200A15687474703A2F2F7777772E6963616E6E2" |
| 829 "E636F6D2F120744414146415346');" |
| 830 "INSERT INTO 'metas' VALUES(14,692,692,129079958383000000," |
| 831 "129079958383000000,129079958383000000,129079958383000000,1048576,11," |
| 832 "'s_ID_14','s_ID_6','s_ID_6','s_ID_12','r',0,0,0,0,0,0," |
| 833 "'The WebKit Open Source Project','The WebKit Open Source Project'," |
| 834 "NULL,NULL,""X'C288101A0A12687474703A2F2F7765626B69742E6F72672F120450" |
| 835 "4E4758',X'C288101C0A13687474703A2F2F7765626B69742E6F72672F781205504E" |
| 836 "473259');" |
| 837 "CREATE TABLE models (model_id BLOB primary key, " |
| 838 "last_download_timestamp INT, initial_sync_ended BOOLEAN default 0);" |
| 839 "INSERT INTO 'models' VALUES(X'C2881000',694,1);" |
| 840 "CREATE TABLE 'share_info' (id TEXT primary key, name TEXT, " |
| 841 "store_birthday TEXT, db_create_version TEXT, db_create_time INT, " |
| 842 "next_id INT default -2, cache_guid TEXT, " |
| 843 "notification_state BLOB);" |
| 844 "INSERT INTO 'share_info' VALUES('nick@chromium.org','nick@chromium.org'," |
| 845 "'c27e9f59-08ca-46f8-b0cc-f16a2ed778bb','Unknown',1263522064,-65542," |
| 846 "'9010788312004066376x-6609234393368420856x',X'C2881000');")); |
| 847 ASSERT_TRUE(connection.CommitTransaction()); |
| 848 } |
| 849 |
744 TEST_F(DirectoryBackingStoreTest, MigrateVersion67To68) { | 850 TEST_F(DirectoryBackingStoreTest, MigrateVersion67To68) { |
745 SetUpVersion67Database(); | 851 SetUpVersion67Database(); |
746 | 852 |
747 { | 853 { |
748 sql::Connection connection; | 854 sql::Connection connection; |
749 ASSERT_TRUE(connection.Open(GetDatabasePath())); | 855 ASSERT_TRUE(connection.Open(GetDatabasePath())); |
750 | 856 |
751 // Columns existing before version 67. | 857 // Columns existing before version 67. |
752 ASSERT_TRUE(connection.DoesColumnExist("metas", "name")); | 858 ASSERT_TRUE(connection.DoesColumnExist("metas", "name")); |
753 ASSERT_TRUE(connection.DoesColumnExist("metas", "unsanitized_name")); | 859 ASSERT_TRUE(connection.DoesColumnExist("metas", "unsanitized_name")); |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
930 ASSERT_EQ(73, dbs->GetVersion()); | 1036 ASSERT_EQ(73, dbs->GetVersion()); |
931 dbs->EndLoad(); | 1037 dbs->EndLoad(); |
932 ASSERT_FALSE(dbs->needs_column_refresh_); | 1038 ASSERT_FALSE(dbs->needs_column_refresh_); |
933 | 1039 |
934 sql::Connection connection; | 1040 sql::Connection connection; |
935 ASSERT_TRUE(connection.Open(GetDatabasePath())); | 1041 ASSERT_TRUE(connection.Open(GetDatabasePath())); |
936 ASSERT_TRUE( | 1042 ASSERT_TRUE( |
937 connection.DoesColumnExist("share_info", "notification_state")); | 1043 connection.DoesColumnExist("share_info", "notification_state")); |
938 } | 1044 } |
939 | 1045 |
| 1046 TEST_F(DirectoryBackingStoreTest, MigrateVersion73To74) { |
| 1047 SetUpVersion73Database(); |
| 1048 |
| 1049 { |
| 1050 sql::Connection connection; |
| 1051 ASSERT_TRUE(connection.Open(GetDatabasePath())); |
| 1052 ASSERT_FALSE( |
| 1053 connection.DoesColumnExist("share_info", "autofill_migration_state")); |
| 1054 ASSERT_FALSE( |
| 1055 connection.DoesColumnExist("share_info", |
| 1056 "bookmarks_added_during_autofill_migration")); |
| 1057 ASSERT_FALSE( |
| 1058 connection.DoesColumnExist("share_info", "autofill_migration_time")); |
| 1059 ASSERT_FALSE( |
| 1060 connection.DoesColumnExist("share_info", |
| 1061 "autofill_entries_added_during_migration")); |
| 1062 |
| 1063 ASSERT_FALSE( |
| 1064 connection.DoesColumnExist("share_info", |
| 1065 "autofill_profiles_added_during_migration")); |
| 1066 } |
| 1067 |
| 1068 scoped_ptr<DirectoryBackingStore> dbs( |
| 1069 new DirectoryBackingStore(GetUsername(), GetDatabasePath())); |
| 1070 |
| 1071 dbs->BeginLoad(); |
| 1072 ASSERT_FALSE(dbs->needs_column_refresh_); |
| 1073 ASSERT_TRUE(dbs->MigrateVersion73To74()); |
| 1074 ASSERT_EQ(74, dbs->GetVersion()); |
| 1075 dbs->EndLoad(); |
| 1076 ASSERT_FALSE(dbs->needs_column_refresh_); |
| 1077 |
| 1078 sql::Connection connection; |
| 1079 ASSERT_TRUE(connection.Open(GetDatabasePath())); |
| 1080 ASSERT_TRUE( |
| 1081 connection.DoesColumnExist("share_info", "autofill_migration_state")); |
| 1082 ASSERT_TRUE( |
| 1083 connection.DoesColumnExist("share_info", |
| 1084 "bookmarks_added_during_autofill_migration")); |
| 1085 ASSERT_TRUE( |
| 1086 connection.DoesColumnExist("share_info", "autofill_migration_time")); |
| 1087 ASSERT_TRUE( |
| 1088 connection.DoesColumnExist("share_info", |
| 1089 "autofill_entries_added_during_migration")); |
| 1090 |
| 1091 ASSERT_TRUE( |
| 1092 connection.DoesColumnExist("share_info", |
| 1093 "autofill_profiles_added_during_migration")); |
| 1094 } |
| 1095 |
940 TEST_P(MigrationTest, ToCurrentVersion) { | 1096 TEST_P(MigrationTest, ToCurrentVersion) { |
941 switch (GetParam()) { | 1097 switch (GetParam()) { |
942 case 67: | 1098 case 67: |
943 SetUpVersion67Database(); | 1099 SetUpVersion67Database(); |
944 break; | 1100 break; |
945 case 68: | 1101 case 68: |
946 SetUpVersion68Database(); | 1102 SetUpVersion68Database(); |
947 break; | 1103 break; |
948 case 69: | 1104 case 69: |
949 SetUpVersion69Database(); | 1105 SetUpVersion69Database(); |
950 break; | 1106 break; |
951 case 70: | 1107 case 70: |
952 SetUpVersion70Database(); | 1108 SetUpVersion70Database(); |
953 break; | 1109 break; |
954 case 71: | 1110 case 71: |
955 SetUpVersion71Database(); | 1111 SetUpVersion71Database(); |
956 break; | 1112 break; |
957 case 72: | 1113 case 72: |
958 SetUpVersion72Database(); | 1114 SetUpVersion72Database(); |
959 break; | 1115 break; |
| 1116 case 73: |
| 1117 SetUpVersion73Database(); |
| 1118 break; |
960 default: | 1119 default: |
961 // If you see this error, it may mean that you've increased the | 1120 // If you see this error, it may mean that you've increased the |
962 // database version number but you haven't finished adding unit tests | 1121 // database version number but you haven't finished adding unit tests |
963 // for the database migration code. You need to need to supply a | 1122 // for the database migration code. You need to need to supply a |
964 // SetUpVersionXXDatabase function with a dump of the test database | 1123 // SetUpVersionXXDatabase function with a dump of the test database |
965 // at the old schema. Here's one way to do that: | 1124 // at the old schema. Here's one way to do that: |
966 // 1. Start on a clean tree (with none of your pending schema changes). | 1125 // 1. Start on a clean tree (with none of your pending schema changes). |
967 // 2. Set a breakpoint in this function and run the unit test. | 1126 // 2. Set a breakpoint in this function and run the unit test. |
968 // 3. Allow this test to run to completion (step out of the call), | 1127 // 3. Allow this test to run to completion (step out of the call), |
969 // without allowing ~MigrationTest to execute. | 1128 // without allowing ~MigrationTest to execute. |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1008 ASSERT_FALSE(connection.DoesColumnExist("metas", "singleton_tag")); | 1167 ASSERT_FALSE(connection.DoesColumnExist("metas", "singleton_tag")); |
1009 ASSERT_TRUE(connection.DoesColumnExist("metas", "unique_server_tag")); | 1168 ASSERT_TRUE(connection.DoesColumnExist("metas", "unique_server_tag")); |
1010 ASSERT_TRUE(connection.DoesColumnExist("metas", "unique_client_tag")); | 1169 ASSERT_TRUE(connection.DoesColumnExist("metas", "unique_client_tag")); |
1011 | 1170 |
1012 // Removed extended attributes in Version 72. | 1171 // Removed extended attributes in Version 72. |
1013 ASSERT_FALSE(connection.DoesTableExist("extended_attributes")); | 1172 ASSERT_FALSE(connection.DoesTableExist("extended_attributes")); |
1014 | 1173 |
1015 // Columns added in Version 73. | 1174 // Columns added in Version 73. |
1016 ASSERT_TRUE(connection.DoesColumnExist( | 1175 ASSERT_TRUE(connection.DoesColumnExist( |
1017 "share_info", "notification_state")); | 1176 "share_info", "notification_state")); |
| 1177 |
| 1178 // Columns added in version 74. |
| 1179 ASSERT_TRUE(connection.DoesColumnExist("share_info", |
| 1180 "autofill_migration_state")); |
1018 } | 1181 } |
1019 | 1182 |
1020 MetahandlesIndex index; | 1183 MetahandlesIndex index; |
1021 STLElementDeleter<MetahandlesIndex> index_deleter(&index); | 1184 STLElementDeleter<MetahandlesIndex> index_deleter(&index); |
1022 dbs->LoadEntries(&index); | 1185 dbs->LoadEntries(&index); |
1023 dbs->EndLoad(); | 1186 dbs->EndLoad(); |
1024 | 1187 |
1025 MetahandlesIndex::iterator it = index.begin(); | 1188 MetahandlesIndex::iterator it = index.begin(); |
1026 ASSERT_TRUE(it != index.end()); | 1189 ASSERT_TRUE(it != index.end()); |
1027 ASSERT_EQ(1, (*it)->ref(META_HANDLE)); | 1190 ASSERT_EQ(1, (*it)->ref(META_HANDLE)); |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1220 | 1383 |
1221 STLDeleteElements(&index); | 1384 STLDeleteElements(&index); |
1222 dbs->LoadEntries(&index); | 1385 dbs->LoadEntries(&index); |
1223 EXPECT_EQ(0U, index.size()); | 1386 EXPECT_EQ(0U, index.size()); |
1224 | 1387 |
1225 dbs->EndLoad(); | 1388 dbs->EndLoad(); |
1226 dbs->EndSave(); | 1389 dbs->EndSave(); |
1227 } | 1390 } |
1228 | 1391 |
1229 } // namespace syncable | 1392 } // namespace syncable |
OLD | NEW |