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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 void SetUpVersion73Database(); |
| 52 void SetUpVersion74Database(); |
52 | 53 |
53 void SetUpCurrentDatabaseAndCheckVersion() { | 54 void SetUpCurrentDatabaseAndCheckVersion() { |
54 SetUpVersion70Database(); // Prepopulates data. | 55 SetUpVersion70Database(); // Prepopulates data. |
55 scoped_ptr<DirectoryBackingStore> dbs( | 56 scoped_ptr<DirectoryBackingStore> dbs( |
56 new DirectoryBackingStore(GetUsername(), GetDatabasePath())); | 57 new DirectoryBackingStore(GetUsername(), GetDatabasePath())); |
57 | 58 |
58 dbs->BeginLoad(); | 59 dbs->BeginLoad(); |
59 ASSERT_EQ(OPENED, dbs->InitializeTables()); | 60 ASSERT_EQ(OPENED, dbs->InitializeTables()); |
60 ASSERT_FALSE(dbs->needs_column_refresh_); | 61 ASSERT_FALSE(dbs->needs_column_refresh_); |
61 ASSERT_EQ(kCurrentDBVersion, dbs->GetVersion()); | 62 ASSERT_EQ(kCurrentDBVersion, dbs->GetVersion()); |
(...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
840 "CREATE TABLE 'share_info' (id TEXT primary key, name TEXT, " | 841 "CREATE TABLE 'share_info' (id TEXT primary key, name TEXT, " |
841 "store_birthday TEXT, db_create_version TEXT, db_create_time INT, " | 842 "store_birthday TEXT, db_create_version TEXT, db_create_time INT, " |
842 "next_id INT default -2, cache_guid TEXT, " | 843 "next_id INT default -2, cache_guid TEXT, " |
843 "notification_state BLOB);" | 844 "notification_state BLOB);" |
844 "INSERT INTO 'share_info' VALUES('nick@chromium.org','nick@chromium.org'," | 845 "INSERT INTO 'share_info' VALUES('nick@chromium.org','nick@chromium.org'," |
845 "'c27e9f59-08ca-46f8-b0cc-f16a2ed778bb','Unknown',1263522064,-65542," | 846 "'c27e9f59-08ca-46f8-b0cc-f16a2ed778bb','Unknown',1263522064,-65542," |
846 "'9010788312004066376x-6609234393368420856x',X'C2881000');")); | 847 "'9010788312004066376x-6609234393368420856x',X'C2881000');")); |
847 ASSERT_TRUE(connection.CommitTransaction()); | 848 ASSERT_TRUE(connection.CommitTransaction()); |
848 } | 849 } |
849 | 850 |
| 851 void MigrationTest::SetUpVersion74Database() { |
| 852 sql::Connection connection; |
| 853 ASSERT_TRUE(connection.Open(GetDatabasePath())); |
| 854 ASSERT_TRUE(connection.BeginTransaction()); |
| 855 ASSERT_TRUE(connection.Execute( |
| 856 "CREATE TABLE share_version (id VARCHAR(128) primary key, data INT);" |
| 857 "INSERT INTO 'share_version' VALUES('nick@chromium.org',74);" |
| 858 "CREATE TABLE models (model_id BLOB primary key, last_download_timestamp" |
| 859 " INT, initial_sync_ended BOOLEAN default 0);" |
| 860 "INSERT INTO 'models' VALUES(X'C2881000',694,1);" |
| 861 "CREATE TABLE 'share_info' (id TEXT primary key, name TEXT, store_birthd" |
| 862 "ay TEXT, db_create_version TEXT, db_create_time INT, next_id INT de" |
| 863 "fault -2, cache_guid TEXT , notification_state BLOB, autofill_migra" |
| 864 "tion_state INT default 0, bookmarks_added_during_autofill_migration" |
| 865 " INT default 0, autofill_migration_time INT default 0, autofill_ent" |
| 866 "ries_added_during_migration INT default 0, autofill_profiles_added_" |
| 867 "during_migration INT default 0);" |
| 868 "INSERT INTO 'share_info' VALUES('nick@chromium.org','nick@chromium.org'" |
| 869 ",'c27e9f59-08ca-46f8-b0cc-f16a2ed778bb','Unknown',1263522064,-65542" |
| 870 ",'9010788312004066376x-6609234393368420856x',NULL,0,0,0,0,0);" |
| 871 "CREATE TABLE 'metas'(metahandle bigint primary key ON CONFLICT FAIL,bas" |
| 872 "e_version bigint default -1,server_version bigint default 0,mtime b" |
| 873 "igint default 0,server_mtime bigint default 0,ctime bigint default " |
| 874 "0,server_ctime bigint default 0,server_position_in_parent bigint de" |
| 875 "fault 0,local_external_id bigint default 0,id varchar(255) default " |
| 876 "'r',parent_id varchar(255) default 'r',server_parent_id varchar(255" |
| 877 ") default 'r',prev_id varchar(255) default 'r',next_id varchar(255)" |
| 878 " default 'r',is_unsynced bit default 0,is_unapplied_update bit defa" |
| 879 "ult 0,is_del bit default 0,is_dir bit default 0,server_is_dir bit d" |
| 880 "efault 0,server_is_del bit default 0,non_unique_name varchar,server" |
| 881 "_non_unique_name varchar(255),unique_server_tag varchar,unique_clie" |
| 882 "nt_tag varchar,specifics blob,server_specifics blob);" |
| 883 "INSERT INTO 'metas' VALUES(1,-1,0,129079956640320000,0,1290799566403200" |
| 884 "00,0,0,0,'r','r','r','r','r',0,0,0,1,0,0,NULL,NULL,NULL,NULL,X'',X'" |
| 885 "');" |
| 886 "INSERT INTO 'metas' VALUES(2,669,669,128976886618480000,128976886618480" |
| 887 "000,128976886618480000,128976886618480000,-2097152,4,'s_ID_2','s_ID" |
| 888 "_9','s_ID_9','s_ID_2','s_ID_2',0,0,1,0,0,1,'Deleted Item','Deleted " |
| 889 "Item',NULL,NULL,X'C28810220A16687474703A2F2F7777772E676F6F676C652E6" |
| 890 "36F6D2F12084141534741534741',X'C28810260A17687474703A2F2F7777772E67" |
| 891 "6F6F676C652E636F6D2F32120B4153414447414447414447');" |
| 892 "INSERT INTO 'metas' VALUES(4,681,681,129002163642690000,129002163642690" |
| 893 "000,129002163642690000,129002163642690000,-3145728,3,'s_ID_4','s_ID" |
| 894 "_9','s_ID_9','s_ID_4','s_ID_4',0,0,1,0,0,1,'Welcome to Chromium','W" |
| 895 "elcome to Chromium',NULL,NULL,X'C28810350A31687474703A2F2F7777772E6" |
| 896 "76F6F676C652E636F6D2F6368726F6D652F696E746C2F656E2F77656C636F6D652E" |
| 897 "68746D6C1200',X'C28810350A31687474703A2F2F7777772E676F6F676C652E636" |
| 898 "F6D2F6368726F6D652F696E746C2F656E2F77656C636F6D652E68746D6C1200');" |
| 899 "INSERT INTO 'metas' VALUES(5,677,677,129001555500000000,129001555500000" |
| 900 "000,129001555500000000,129001555500000000,1048576,7,'s_ID_5','s_ID_" |
| 901 "9','s_ID_9','s_ID_5','s_ID_5',0,0,1,0,0,1,'Google','Google',NULL,NU" |
| 902 "LL,X'C28810220A16687474703A2F2F7777772E676F6F676C652E636F6D2F120841" |
| 903 "47415347415347',X'C28810220A16687474703A2F2F7777772E676F6F676C652E6" |
| 904 "36F6D2F12084147464447415347');" |
| 905 "INSERT INTO 'metas' VALUES(6,694,694,129053976170000000,129053976170000" |
| 906 "000,129053976170000000,129053976170000000,-4194304,6,'s_ID_6','s_ID" |
| 907 "_9','s_ID_9','r','r',0,0,0,1,1,0,'The Internet','The Internet',NULL" |
| 908 ",NULL,X'C2881000',X'C2881000');" |
| 909 "INSERT INTO 'metas' VALUES(7,663,663,128976864758480000,128976864758480" |
| 910 "000,128976864758480000,128976864758480000,1048576,0,'s_ID_7','r','r" |
| 911 "','r','r',0,0,0,1,1,0,'Google Chrome','Google Chrome','google_chrom" |
| 912 "e',NULL,NULL,NULL);" |
| 913 "INSERT INTO 'metas' VALUES(8,664,664,128976864758480000,128976864758480" |
| 914 "000,128976864758480000,128976864758480000,1048576,0,'s_ID_8','s_ID_" |
| 915 "7','s_ID_7','r','r',0,0,0,1,1,0,'Bookmarks','Bookmarks','google_chr" |
| 916 "ome_bookmarks',NULL,X'C2881000',X'C2881000');" |
| 917 "INSERT INTO 'metas' VALUES(9,665,665,128976864758480000,128976864758480" |
| 918 "000,128976864758480000,128976864758480000,1048576,1,'s_ID_9','s_ID_" |
| 919 "8','s_ID_8','r','s_ID_10',0,0,0,1,1,0,'Bookmark Bar','Bookmark Bar'" |
| 920 ",'bookmark_bar',NULL,X'C2881000',X'C2881000');" |
| 921 "INSERT INTO 'metas' VALUES(10,666,666,128976864758480000,12897686475848" |
| 922 "0000,128976864758480000,128976864758480000,2097152,2,'s_ID_10','s_I" |
| 923 "D_8','s_ID_8','s_ID_9','r',0,0,0,1,1,0,'Other Bookmarks','Other Boo" |
| 924 "kmarks','other_bookmarks',NULL,X'C2881000',X'C2881000');" |
| 925 "INSERT INTO 'metas' VALUES(11,683,683,129079956948440000,12907995694844" |
| 926 "0000,129079956948440000,129079956948440000,-1048576,8,'s_ID_11','s_" |
| 927 "ID_6','s_ID_6','r','s_ID_13',0,0,0,0,0,0,'Home (The Chromium Projec" |
| 928 "ts)','Home (The Chromium Projects)',NULL,NULL,X'C28810220A186874747" |
| 929 "03A2F2F6465762E6368726F6D69756D2E6F72672F1206414741545741',X'C28810" |
| 930 "290A1D687474703A2F2F6465762E6368726F6D69756D2E6F72672F6F74686572120" |
| 931 "84146414756415346');" |
| 932 "INSERT INTO 'metas' VALUES(12,685,685,129079957513650000,12907995751365" |
| 933 "0000,129079957513650000,129079957513650000,0,9,'s_ID_12','s_ID_6','" |
| 934 "s_ID_6','s_ID_13','s_ID_14',0,0,0,1,1,0,'Extra Bookmarks','Extra Bo" |
| 935 "okmarks',NULL,NULL,X'C2881000',X'C2881000');" |
| 936 "INSERT INTO 'metas' VALUES(13,687,687,129079957985300000,12907995798530" |
| 937 "0000,129079957985300000,129079957985300000,-917504,10,'s_ID_13','s_" |
| 938 "ID_6','s_ID_6','s_ID_11','s_ID_12',0,0,0,0,0,0,'ICANN | Internet Co" |
| 939 "rporation for Assigned Names and Numbers','ICANN | Internet Corpora" |
| 940 "tion for Assigned Names and Numbers',NULL,NULL,X'C28810240A15687474" |
| 941 "703A2F2F7777772E6963616E6E2E636F6D2F120B504E474158463041414646',X'C" |
| 942 "28810200A15687474703A2F2F7777772E6963616E6E2E636F6D2F12074441414641" |
| 943 "5346');" |
| 944 "INSERT INTO 'metas' VALUES(14,692,692,129079958383000000,12907995838300" |
| 945 "0000,129079958383000000,129079958383000000,1048576,11,'s_ID_14','s_" |
| 946 "ID_6','s_ID_6','s_ID_12','r',0,0,0,0,0,0,'The WebKit Open Source Pr" |
| 947 "oject','The WebKit Open Source Project',NULL,NULL,X'C288101A0A12687" |
| 948 "474703A2F2F7765626B69742E6F72672F1204504E4758',X'C288101C0A13687474" |
| 949 "703A2F2F7765626B69742E6F72672F781205504E473259');" |
| 950 )); |
| 951 ASSERT_TRUE(connection.CommitTransaction()); |
| 952 } |
| 953 |
850 TEST_F(DirectoryBackingStoreTest, MigrateVersion67To68) { | 954 TEST_F(DirectoryBackingStoreTest, MigrateVersion67To68) { |
851 SetUpVersion67Database(); | 955 SetUpVersion67Database(); |
852 | 956 |
853 { | 957 { |
854 sql::Connection connection; | 958 sql::Connection connection; |
855 ASSERT_TRUE(connection.Open(GetDatabasePath())); | 959 ASSERT_TRUE(connection.Open(GetDatabasePath())); |
856 | 960 |
857 // Columns existing before version 67. | 961 // Columns existing before version 67. |
858 ASSERT_TRUE(connection.DoesColumnExist("metas", "name")); | 962 ASSERT_TRUE(connection.DoesColumnExist("metas", "name")); |
859 ASSERT_TRUE(connection.DoesColumnExist("metas", "unsanitized_name")); | 963 ASSERT_TRUE(connection.DoesColumnExist("metas", "unsanitized_name")); |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1086 connection.DoesColumnExist("share_info", "autofill_migration_time")); | 1190 connection.DoesColumnExist("share_info", "autofill_migration_time")); |
1087 ASSERT_TRUE( | 1191 ASSERT_TRUE( |
1088 connection.DoesColumnExist("share_info", | 1192 connection.DoesColumnExist("share_info", |
1089 "autofill_entries_added_during_migration")); | 1193 "autofill_entries_added_during_migration")); |
1090 | 1194 |
1091 ASSERT_TRUE( | 1195 ASSERT_TRUE( |
1092 connection.DoesColumnExist("share_info", | 1196 connection.DoesColumnExist("share_info", |
1093 "autofill_profiles_added_during_migration")); | 1197 "autofill_profiles_added_during_migration")); |
1094 } | 1198 } |
1095 | 1199 |
| 1200 TEST_F(DirectoryBackingStoreTest, MigrateVersion74To75) { |
| 1201 SetUpVersion74Database(); |
| 1202 |
| 1203 { |
| 1204 sql::Connection connection; |
| 1205 ASSERT_TRUE(connection.Open(GetDatabasePath())); |
| 1206 ASSERT_FALSE(connection.DoesColumnExist("models", "progress_marker")); |
| 1207 ASSERT_TRUE(connection.DoesColumnExist("models", |
| 1208 "last_download_timestamp")); |
| 1209 } |
| 1210 |
| 1211 scoped_ptr<DirectoryBackingStore> dbs( |
| 1212 new DirectoryBackingStore(GetUsername(), GetDatabasePath())); |
| 1213 |
| 1214 dbs->BeginLoad(); |
| 1215 ASSERT_FALSE(dbs->needs_column_refresh_); |
| 1216 ASSERT_TRUE(dbs->MigrateVersion74To75()); |
| 1217 ASSERT_EQ(75, dbs->GetVersion()); |
| 1218 dbs->EndLoad(); |
| 1219 ASSERT_FALSE(dbs->needs_column_refresh_); |
| 1220 |
| 1221 sql::Connection connection; |
| 1222 ASSERT_TRUE(connection.Open(GetDatabasePath())); |
| 1223 |
| 1224 ASSERT_TRUE(connection.DoesColumnExist("models", "progress_marker")); |
| 1225 ASSERT_FALSE(connection.DoesColumnExist("models", |
| 1226 "last_download_timestamp")); |
| 1227 } |
| 1228 |
1096 TEST_P(MigrationTest, ToCurrentVersion) { | 1229 TEST_P(MigrationTest, ToCurrentVersion) { |
1097 switch (GetParam()) { | 1230 switch (GetParam()) { |
1098 case 67: | 1231 case 67: |
1099 SetUpVersion67Database(); | 1232 SetUpVersion67Database(); |
1100 break; | 1233 break; |
1101 case 68: | 1234 case 68: |
1102 SetUpVersion68Database(); | 1235 SetUpVersion68Database(); |
1103 break; | 1236 break; |
1104 case 69: | 1237 case 69: |
1105 SetUpVersion69Database(); | 1238 SetUpVersion69Database(); |
1106 break; | 1239 break; |
1107 case 70: | 1240 case 70: |
1108 SetUpVersion70Database(); | 1241 SetUpVersion70Database(); |
1109 break; | 1242 break; |
1110 case 71: | 1243 case 71: |
1111 SetUpVersion71Database(); | 1244 SetUpVersion71Database(); |
1112 break; | 1245 break; |
1113 case 72: | 1246 case 72: |
1114 SetUpVersion72Database(); | 1247 SetUpVersion72Database(); |
1115 break; | 1248 break; |
1116 case 73: | 1249 case 73: |
1117 SetUpVersion73Database(); | 1250 SetUpVersion73Database(); |
1118 break; | 1251 break; |
| 1252 case 74: |
| 1253 SetUpVersion74Database(); |
| 1254 break; |
1119 default: | 1255 default: |
1120 // If you see this error, it may mean that you've increased the | 1256 // If you see this error, it may mean that you've increased the |
1121 // database version number but you haven't finished adding unit tests | 1257 // database version number but you haven't finished adding unit tests |
1122 // for the database migration code. You need to need to supply a | 1258 // for the database migration code. You need to need to supply a |
1123 // SetUpVersionXXDatabase function with a dump of the test database | 1259 // SetUpVersionXXDatabase function with a dump of the test database |
1124 // at the old schema. Here's one way to do that: | 1260 // at the old schema. Here's one way to do that: |
1125 // 1. Start on a clean tree (with none of your pending schema changes). | 1261 // 1. Start on a clean tree (with none of your pending schema changes). |
1126 // 2. Set a breakpoint in this function and run the unit test. | 1262 // 2. Set a breakpoint in this function and run the unit test. |
1127 // 3. Allow this test to run to completion (step out of the call), | 1263 // 3. Allow this test to run to completion (step out of the call), |
1128 // without allowing ~MigrationTest to execute. | 1264 // without allowing ~MigrationTest to execute. |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1171 // Removed extended attributes in Version 72. | 1307 // Removed extended attributes in Version 72. |
1172 ASSERT_FALSE(connection.DoesTableExist("extended_attributes")); | 1308 ASSERT_FALSE(connection.DoesTableExist("extended_attributes")); |
1173 | 1309 |
1174 // Columns added in Version 73. | 1310 // Columns added in Version 73. |
1175 ASSERT_TRUE(connection.DoesColumnExist( | 1311 ASSERT_TRUE(connection.DoesColumnExist( |
1176 "share_info", "notification_state")); | 1312 "share_info", "notification_state")); |
1177 | 1313 |
1178 // Columns added in version 74. | 1314 // Columns added in version 74. |
1179 ASSERT_TRUE(connection.DoesColumnExist("share_info", | 1315 ASSERT_TRUE(connection.DoesColumnExist("share_info", |
1180 "autofill_migration_state")); | 1316 "autofill_migration_state")); |
| 1317 |
| 1318 // Column replaced in version 75. |
| 1319 ASSERT_TRUE(connection.DoesColumnExist("models", "progress_marker")); |
| 1320 ASSERT_FALSE(connection.DoesColumnExist("models", |
| 1321 "last_download_timestamp")); |
| 1322 } |
| 1323 { |
| 1324 syncable::Directory::KernelLoadInfo dir_info; |
| 1325 dbs->LoadInfo(&dir_info); |
| 1326 |
| 1327 // Check download_progress state (v75 migration) |
| 1328 ASSERT_EQ(694, |
| 1329 dir_info.kernel_info.download_progress[syncable::BOOKMARKS] |
| 1330 .timestamp_token_for_migration()); |
| 1331 ASSERT_FALSE( |
| 1332 dir_info.kernel_info.download_progress[syncable::BOOKMARKS] |
| 1333 .has_token()); |
| 1334 ASSERT_EQ(32904, |
| 1335 dir_info.kernel_info.download_progress[syncable::BOOKMARKS] |
| 1336 .data_type_id()); |
| 1337 ASSERT_FALSE( |
| 1338 dir_info.kernel_info.download_progress[syncable::THEMES] |
| 1339 .has_timestamp_token_for_migration()); |
| 1340 ASSERT_TRUE( |
| 1341 dir_info.kernel_info.download_progress[syncable::THEMES] |
| 1342 .has_token()); |
| 1343 ASSERT_TRUE( |
| 1344 dir_info.kernel_info.download_progress[syncable::THEMES] |
| 1345 .token().empty()); |
| 1346 ASSERT_EQ(41210, |
| 1347 dir_info.kernel_info.download_progress[syncable::THEMES] |
| 1348 .data_type_id()); |
1181 } | 1349 } |
1182 | 1350 |
1183 MetahandlesIndex index; | 1351 MetahandlesIndex index; |
1184 STLElementDeleter<MetahandlesIndex> index_deleter(&index); | 1352 STLElementDeleter<MetahandlesIndex> index_deleter(&index); |
1185 dbs->LoadEntries(&index); | 1353 dbs->LoadEntries(&index); |
1186 dbs->EndLoad(); | 1354 dbs->EndLoad(); |
1187 | 1355 |
1188 MetahandlesIndex::iterator it = index.begin(); | 1356 MetahandlesIndex::iterator it = index.begin(); |
1189 ASSERT_TRUE(it != index.end()); | 1357 ASSERT_TRUE(it != index.end()); |
1190 ASSERT_EQ(1, (*it)->ref(META_HANDLE)); | 1358 ASSERT_EQ(1, (*it)->ref(META_HANDLE)); |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1310 } | 1478 } |
1311 | 1479 |
1312 INSTANTIATE_TEST_CASE_P(DirectoryBackingStore, MigrationTest, | 1480 INSTANTIATE_TEST_CASE_P(DirectoryBackingStore, MigrationTest, |
1313 testing::Range(67, kCurrentDBVersion)); | 1481 testing::Range(67, kCurrentDBVersion)); |
1314 | 1482 |
1315 TEST_F(DirectoryBackingStoreTest, ModelTypeIds) { | 1483 TEST_F(DirectoryBackingStoreTest, ModelTypeIds) { |
1316 for (int i = FIRST_REAL_MODEL_TYPE; i < MODEL_TYPE_COUNT; ++i) { | 1484 for (int i = FIRST_REAL_MODEL_TYPE; i < MODEL_TYPE_COUNT; ++i) { |
1317 std::string model_id = | 1485 std::string model_id = |
1318 DirectoryBackingStore::ModelTypeEnumToModelId(ModelTypeFromInt(i)); | 1486 DirectoryBackingStore::ModelTypeEnumToModelId(ModelTypeFromInt(i)); |
1319 EXPECT_EQ(i, | 1487 EXPECT_EQ(i, |
1320 DirectoryBackingStore::ModelIdToModelTypeEnum(model_id)); | 1488 DirectoryBackingStore::ModelIdToModelTypeEnum(model_id.data(), |
| 1489 model_id.size())); |
1321 } | 1490 } |
1322 } | 1491 } |
1323 | 1492 |
1324 TEST_F(DirectoryBackingStoreTest, Corruption) { | 1493 TEST_F(DirectoryBackingStoreTest, Corruption) { |
1325 { | 1494 { |
1326 scoped_ptr<DirectoryBackingStore> dbs( | 1495 scoped_ptr<DirectoryBackingStore> dbs( |
1327 new DirectoryBackingStore(GetUsername(), GetDatabasePath())); | 1496 new DirectoryBackingStore(GetUsername(), GetDatabasePath())); |
1328 EXPECT_TRUE(dbs->BeginLoad()); | 1497 EXPECT_TRUE(dbs->BeginLoad()); |
1329 } | 1498 } |
1330 std::string bad_data("BAD DATA"); | 1499 std::string bad_data("BAD DATA"); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1383 | 1552 |
1384 STLDeleteElements(&index); | 1553 STLDeleteElements(&index); |
1385 dbs->LoadEntries(&index); | 1554 dbs->LoadEntries(&index); |
1386 EXPECT_EQ(0U, index.size()); | 1555 EXPECT_EQ(0U, index.size()); |
1387 | 1556 |
1388 dbs->EndLoad(); | 1557 dbs->EndLoad(); |
1389 dbs->EndSave(); | 1558 dbs->EndSave(); |
1390 } | 1559 } |
1391 | 1560 |
1392 } // namespace syncable | 1561 } // namespace syncable |
OLD | NEW |