| 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 28 matching lines...) Expand all  Loading... | 
| 39   } | 39   } | 
| 40 | 40 | 
| 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 | 50 | 
| 50   void SetUpCurrentDatabaseAndCheckVersion() { | 51   void SetUpCurrentDatabaseAndCheckVersion() { | 
| 51     SetUpVersion70Database();  // Prepopulates data. | 52     SetUpVersion70Database();  // Prepopulates data. | 
| 52     scoped_ptr<DirectoryBackingStore> dbs( | 53     scoped_ptr<DirectoryBackingStore> dbs( | 
| 53         new DirectoryBackingStore(GetUsername(), GetDatabasePath())); | 54         new DirectoryBackingStore(GetUsername(), GetDatabasePath())); | 
| 54 | 55 | 
| 55     dbs->BeginLoad(); | 56     dbs->BeginLoad(); | 
| 56     ASSERT_EQ(OPENED, dbs->InitializeTables()); | 57     ASSERT_EQ(OPENED, dbs->InitializeTables()); | 
| 57     ASSERT_FALSE(dbs->needs_column_refresh_); | 58     ASSERT_FALSE(dbs->needs_column_refresh_); | 
| 58     ASSERT_EQ(kCurrentDBVersion, dbs->GetVersion()); | 59     ASSERT_EQ(kCurrentDBVersion, dbs->GetVersion()); | 
| 59     dbs->EndLoad(); | 60     dbs->EndLoad(); | 
| 60   } | 61   } | 
| 61 | 62 | 
| 62  private: | 63  private: | 
| 63   ScopedTempDir temp_dir_; | 64   ScopedTempDir temp_dir_; | 
| 64 }; | 65 }; | 
| 65 | 66 | 
| 66 class DirectoryBackingStoreTest : public MigrationTest {}; | 67 class DirectoryBackingStoreTest : public MigrationTest {}; | 
| 67 | 68 | 
| 68 void MigrationTest::SetUpVersion67Database() { | 69 void MigrationTest::SetUpVersion67Database() { | 
| 69   // This is a version 67 database dump whose contents were backformed from | 70   // This is a version 67 database dump whose contents were backformed from | 
| 70   // the contents of the version 68 database dump (the v68 migration was | 71   // the contents of the version 68 database dump (the v68 migration was | 
| 71   // actually written first). | 72   // actually written first). | 
| 72   sql::Connection connection; | 73   sql::Connection connection; | 
| 73   ASSERT_TRUE(connection.Open(GetDatabasePath())); | 74   ASSERT_TRUE(connection.Open(GetDatabasePath())); | 
| 74   ASSERT_TRUE(connection.BeginTransaction()); | 75   ASSERT_TRUE(connection.BeginTransaction()); | 
| 75   ASSERT_TRUE(connection.Execute( | 76   ASSERT_TRUE(connection.Execute( | 
| 76       "CREATE TABLE extended_attributes(metahandle bigint, key varchar(127), " | 77       "CREATE TABLE extended_attributes(metahandle bigint, key varchar(127), " | 
| 77           "value blob, PRIMARY KEY(metahandle, key) ON CONFLICT REPLACE);" | 78           "value blob, PRIMARY KEY(metahandle, key) ON CONFLICT REPLACE);" | 
| 78           "CREATE TABLE metas (metahandle bigint primary key ON CONFLICT FAIL," | 79       "CREATE TABLE metas (metahandle bigint primary key ON CONFLICT FAIL," | 
| 79           "base_version bigint default -1,server_version bigint default 0," | 80           "base_version bigint default -1,server_version bigint default 0," | 
| 80           "mtime bigint default 0,server_mtime bigint default 0," | 81           "mtime bigint default 0,server_mtime bigint default 0," | 
| 81           "ctime bigint default 0,server_ctime bigint default 0," | 82           "ctime bigint default 0,server_ctime bigint default 0," | 
| 82           "server_position_in_parent bigint default 0," | 83           "server_position_in_parent bigint default 0," | 
| 83           "local_external_id bigint default 0,id varchar(255) default 'r'," | 84           "local_external_id bigint default 0,id varchar(255) default 'r'," | 
| 84           "parent_id varchar(255) default 'r'," | 85           "parent_id varchar(255) default 'r'," | 
| 85           "server_parent_id varchar(255) default 'r'," | 86           "server_parent_id varchar(255) default 'r'," | 
| 86           "prev_id varchar(255) default 'r',next_id varchar(255) default 'r'," | 87           "prev_id varchar(255) default 'r',next_id varchar(255) default 'r'," | 
| 87           "is_unsynced bit default 0,is_unapplied_update bit default 0," | 88           "is_unsynced bit default 0,is_unapplied_update bit default 0," | 
| 88           "is_del bit default 0,is_dir bit default 0," | 89           "is_del bit default 0,is_dir bit default 0," | 
| (...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 522           "129079958383000000,129079958383000000,129079958383000000,1048576," | 523           "129079958383000000,129079958383000000,129079958383000000,1048576," | 
| 523           "11,'s_ID_14','s_ID_6','s_ID_6','s_ID_12','r',0,0,0,0,0,0," | 524           "11,'s_ID_14','s_ID_6','s_ID_6','s_ID_12','r',0,0,0,0,0,0," | 
| 524           "'The WebKit Open Source Project','The WebKit Open Source Project'," | 525           "'The WebKit Open Source Project','The WebKit Open Source Project'," | 
| 525           "NULL,NULL,X'C288101A0A12687474703A2F2F7765626B69742E6F72672F120450" | 526           "NULL,NULL,X'C288101A0A12687474703A2F2F7765626B69742E6F72672F120450" | 
| 526           "4E4758',X'C288101C0A13687474703A2F2F7765626B69742E6F72672F78120550" | 527           "4E4758',X'C288101C0A13687474703A2F2F7765626B69742E6F72672F78120550" | 
| 527           "4E473259');" | 528           "4E473259');" | 
| 528       )); | 529       )); | 
| 529   ASSERT_TRUE(connection.CommitTransaction()); | 530   ASSERT_TRUE(connection.CommitTransaction()); | 
| 530 } | 531 } | 
| 531 | 532 | 
|  | 533 void MigrationTest::SetUpVersion71Database() { | 
|  | 534   sql::Connection connection; | 
|  | 535   ASSERT_TRUE(connection.Open(GetDatabasePath())); | 
|  | 536   ASSERT_TRUE(connection.BeginTransaction()); | 
|  | 537   ASSERT_TRUE(connection.Execute( | 
|  | 538       "CREATE TABLE extended_attributes(metahandle bigint, key varchar(127), " | 
|  | 539           "value blob, PRIMARY KEY(metahandle, key) ON CONFLICT REPLACE);" | 
|  | 540       "CREATE TABLE share_version (id VARCHAR(128) primary key, data INT);" | 
|  | 541       "INSERT INTO 'share_version' VALUES('nick@chromium.org',71);" | 
|  | 542       "CREATE TABLE metas(metahandle bigint primary key ON CONFLICT FAIL," | 
|  | 543           "base_version bigint default -1,server_version bigint default 0," | 
|  | 544           "mtime bigint default 0,server_mtime bigint default 0,ctime bigint " | 
|  | 545           "default 0,server_ctime bigint default 0,server_position_in_parent " | 
|  | 546           "bigint default 0,local_external_id bigint default 0,id varchar(255) " | 
|  | 547           "default 'r',parent_id varchar(255) default 'r',server_parent_id " | 
|  | 548           "varchar(255) default 'r',prev_id varchar(255) default 'r',next_id " | 
|  | 549           "varchar(255) default 'r',is_unsynced bit default 0," | 
|  | 550           "is_unapplied_update bit default 0,is_del bit default 0,is_dir bit " | 
|  | 551           "default 0,server_is_dir bit default 0,server_is_del bit default 0," | 
|  | 552           "non_unique_name varchar,server_non_unique_name varchar(255)," | 
|  | 553           "unique_server_tag varchar,unique_client_tag varchar,specifics blob," | 
|  | 554           "server_specifics blob);" | 
|  | 555       "INSERT INTO 'metas' VALUES(1,-1,0,129079956640320000,0," | 
|  | 556           "129079956640320000,0,0,0,'r','r','r','r','r',0,0,0,1,0,0,NULL,NULL," | 
|  | 557           "NULL,NULL,X'',X'');" | 
|  | 558       "INSERT INTO 'metas' VALUES(2,669,669,128976886618480000," | 
|  | 559           "128976886618480000,128976886618480000,128976886618480000,-2097152,4," | 
|  | 560           "'s_ID_2','s_ID_9','s_ID_9','s_ID_2','s_ID_2',0,0,1,0,0,1," | 
|  | 561           "'Deleted Item','Deleted Item',NULL,NULL,X'C28810220A16687474703A2F2F" | 
|  | 562           "7777772E676F6F676C652E636F6D2F12084141534741534741',X'C28810260A1768" | 
|  | 563           "7474703A2F2F7777772E676F6F676C652E636F6D2F32120B41534144474144474144" | 
|  | 564           "47');" | 
|  | 565       "INSERT INTO 'metas' VALUES(4,681,681,129002163642690000," | 
|  | 566           "129002163642690000,129002163642690000,129002163642690000,-3145728,3," | 
|  | 567           "'s_ID_4','s_ID_9','s_ID_9','s_ID_4','s_ID_4',0,0,1,0,0,1," | 
|  | 568           "'Welcome to Chromium','Welcome to Chromium',NULL,NULL,X'C28810350A31" | 
|  | 569           "687474703A2F2F7777772E676F6F676C652E636F6D2F6368726F6D652F696E746C2F" | 
|  | 570           "656E2F77656C636F6D652E68746D6C1200',X'C28810350A31687474703A2F2F7777" | 
|  | 571           "772E676F6F676C652E636F6D2F6368726F6D652F696E746C2F656E2F77656C636F6D" | 
|  | 572           "652E68746D6C1200');" | 
|  | 573       "INSERT INTO 'metas' VALUES(5,677,677,129001555500000000," | 
|  | 574           "129001555500000000,129001555500000000,129001555500000000,1048576,7," | 
|  | 575           "'s_ID_5','s_ID_9','s_ID_9','s_ID_5','s_ID_5',0,0,1,0,0,1,'Google'," | 
|  | 576           "'Google',NULL,NULL,X'C28810220A16687474703A2F2F7777772E676F6F676C652" | 
|  | 577           "E636F6D2F12084147415347415347',X'C28810220A16687474703A2F2F7777772E6" | 
|  | 578           "76F6F676C652E636F6D2F12084147464447415347');" | 
|  | 579       "INSERT INTO 'metas' VALUES(6,694,694,129053976170000000," | 
|  | 580           "129053976170000000,129053976170000000,129053976170000000,-4194304,6," | 
|  | 581           "'s_ID_6','s_ID_9','s_ID_9','r','r',0,0,0,1,1,0,'The Internet'," | 
|  | 582           "'The Internet',NULL,NULL,X'C2881000',X'C2881000');" | 
|  | 583       "INSERT INTO 'metas' VALUES(7,663,663,128976864758480000," | 
|  | 584           "128976864758480000,128976864758480000,128976864758480000,1048576,0," | 
|  | 585           "'s_ID_7','r','r','r','r',0,0,0,1,1,0,'Google Chrome','Google Chrome'" | 
|  | 586           ",'google_chrome',NULL,NULL,NULL);" | 
|  | 587       "INSERT INTO 'metas' VALUES(8,664,664,128976864758480000," | 
|  | 588           "128976864758480000,128976864758480000,128976864758480000,1048576,0," | 
|  | 589           "'s_ID_8','s_ID_7','s_ID_7','r','r',0,0,0,1,1,0,'Bookmarks'," | 
|  | 590           "'Bookmarks','google_chrome_bookmarks',NULL,X'C2881000',X'C2881000');" | 
|  | 591       "INSERT INTO 'metas' VALUES(9,665,665,128976864758480000," | 
|  | 592           "128976864758480000,128976864758480000,128976864758480000,1048576,1," | 
|  | 593           "'s_ID_9','s_ID_8','s_ID_8','r','s_ID_10',0,0,0,1,1,0,'Bookmark Bar'," | 
|  | 594           "'Bookmark Bar','bookmark_bar',NULL,X'C2881000',X'C2881000');" | 
|  | 595       "INSERT INTO 'metas' VALUES(10,666,666,128976864758480000," | 
|  | 596           "128976864758480000,128976864758480000,128976864758480000,2097152,2," | 
|  | 597           "'s_ID_10','s_ID_8','s_ID_8','s_ID_9','r',0,0,0,1,1,0," | 
|  | 598           "'Other Bookmarks','Other Bookmarks','other_bookmarks',NULL," | 
|  | 599           "X'C2881000',X'C2881000');" | 
|  | 600       "INSERT INTO 'metas' VALUES(11,683,683,129079956948440000," | 
|  | 601           "129079956948440000,129079956948440000,129079956948440000,-1048576,8," | 
|  | 602           "'s_ID_11','s_ID_6','s_ID_6','r','s_ID_13',0,0,0,0,0,0," | 
|  | 603           "'Home (The Chromium Projects)','Home (The Chromium Projects)',NULL," | 
|  | 604           "NULL,X'C28810220A18687474703A2F2F6465762E6368726F6D69756D2E6F72672F1" | 
|  | 605           "206414741545741',X'C28810290A1D687474703A2F2F6465762E6368726F6D69756" | 
|  | 606           "D2E6F72672F6F7468657212084146414756415346');" | 
|  | 607       "INSERT INTO 'metas' VALUES(12,685,685,129079957513650000," | 
|  | 608           "129079957513650000,129079957513650000,129079957513650000,0,9," | 
|  | 609           "'s_ID_12','s_ID_6','s_ID_6','s_ID_13','s_ID_14',0,0,0,1,1,0," | 
|  | 610           "'Extra Bookmarks','Extra Bookmarks',NULL,NULL,X'C2881000'," | 
|  | 611           "X'C2881000');" | 
|  | 612       "INSERT INTO 'metas' VALUES(13,687,687,129079957985300000," | 
|  | 613           "129079957985300000,129079957985300000,129079957985300000,-917504,10," | 
|  | 614           "'s_ID_13','s_ID_6','s_ID_6','s_ID_11','s_ID_12',0,0,0,0,0,0," | 
|  | 615           "'ICANN | Internet Corporation for Assigned Names and Numbers'," | 
|  | 616           "'ICANN | Internet Corporation for Assigned Names and Numbers',NULL," | 
|  | 617           "NULL,X'C28810240A15687474703A2F2F7777772E6963616E6E2E636F6D2F120B504" | 
|  | 618           "E474158463041414646',X'C28810200A15687474703A2F2F7777772E6963616E6E2" | 
|  | 619           "E636F6D2F120744414146415346');" | 
|  | 620       "INSERT INTO 'metas' VALUES(14,692,692,129079958383000000," | 
|  | 621           "129079958383000000,129079958383000000,129079958383000000,1048576,11," | 
|  | 622           "'s_ID_14','s_ID_6','s_ID_6','s_ID_12','r',0,0,0,0,0,0," | 
|  | 623           "'The WebKit Open Source Project','The WebKit Open Source Project'," | 
|  | 624           "NULL,NULL,""X'C288101A0A12687474703A2F2F7765626B69742E6F72672F120450" | 
|  | 625           "4E4758',X'C288101C0A13687474703A2F2F7765626B69742E6F72672F781205504E" | 
|  | 626           "473259');" | 
|  | 627       "CREATE TABLE models (model_id BLOB primary key, " | 
|  | 628           "last_download_timestamp INT, initial_sync_ended BOOLEAN default 0);" | 
|  | 629       "INSERT INTO 'models' VALUES(X'C2881000',694,1);" | 
|  | 630       "CREATE TABLE 'share_info' (id TEXT primary key, name TEXT, " | 
|  | 631           "store_birthday TEXT, db_create_version TEXT, db_create_time INT, " | 
|  | 632           "next_id INT default -2, cache_guid TEXT);" | 
|  | 633       "INSERT INTO 'share_info' VALUES('nick@chromium.org','nick@chromium.org'," | 
|  | 634           "'c27e9f59-08ca-46f8-b0cc-f16a2ed778bb','Unknown',1263522064,-65542," | 
|  | 635           "'9010788312004066376x-6609234393368420856x');")); | 
|  | 636   ASSERT_TRUE(connection.CommitTransaction()); | 
|  | 637 } | 
| 532 TEST_F(DirectoryBackingStoreTest, MigrateVersion67To68) { | 638 TEST_F(DirectoryBackingStoreTest, MigrateVersion67To68) { | 
| 533   SetUpVersion67Database(); | 639   SetUpVersion67Database(); | 
| 534 | 640 | 
| 535   { | 641   { | 
| 536     sql::Connection connection; | 642     sql::Connection connection; | 
| 537     ASSERT_TRUE(connection.Open(GetDatabasePath())); | 643     ASSERT_TRUE(connection.Open(GetDatabasePath())); | 
| 538 | 644 | 
| 539     // Columns existing before version 67. | 645     // Columns existing before version 67. | 
| 540     ASSERT_TRUE(connection.DoesColumnExist("metas", "name")); | 646     ASSERT_TRUE(connection.DoesColumnExist("metas", "name")); | 
| 541     ASSERT_TRUE(connection.DoesColumnExist("metas", "unsanitized_name")); | 647     ASSERT_TRUE(connection.DoesColumnExist("metas", "unsanitized_name")); | 
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 667       "initial_sync_ended, last_download_timestamp FROM models")); | 773       "initial_sync_ended, last_download_timestamp FROM models")); | 
| 668   ASSERT_TRUE(s.Step()); | 774   ASSERT_TRUE(s.Step()); | 
| 669   std::string model_id = s.ColumnString(0); | 775   std::string model_id = s.ColumnString(0); | 
| 670   EXPECT_EQ("C2881000", HexEncode(model_id.data(), model_id.size())) | 776   EXPECT_EQ("C2881000", HexEncode(model_id.data(), model_id.size())) | 
| 671       << "Model ID is expected to be the empty BookmarkSpecifics proto."; | 777       << "Model ID is expected to be the empty BookmarkSpecifics proto."; | 
| 672   EXPECT_EQ(true, s.ColumnBool(1)); | 778   EXPECT_EQ(true, s.ColumnBool(1)); | 
| 673   EXPECT_EQ(694, s.ColumnInt64(2)); | 779   EXPECT_EQ(694, s.ColumnInt64(2)); | 
| 674   ASSERT_FALSE(s.Step()); | 780   ASSERT_FALSE(s.Step()); | 
| 675 } | 781 } | 
| 676 | 782 | 
|  | 783 | 
|  | 784 TEST_F(DirectoryBackingStoreTest, MigrateVersion71To72) { | 
|  | 785   SetUpVersion71Database(); | 
|  | 786 | 
|  | 787   { | 
|  | 788     sql::Connection connection; | 
|  | 789     ASSERT_TRUE(connection.Open(GetDatabasePath())); | 
|  | 790     ASSERT_TRUE(connection.DoesTableExist("extended_attributes")); | 
|  | 791   } | 
|  | 792 | 
|  | 793   scoped_ptr<DirectoryBackingStore> dbs( | 
|  | 794       new DirectoryBackingStore(GetUsername(), GetDatabasePath())); | 
|  | 795 | 
|  | 796   dbs->BeginLoad(); | 
|  | 797   ASSERT_FALSE(dbs->needs_column_refresh_); | 
|  | 798   ASSERT_TRUE(dbs->MigrateVersion71To72()); | 
|  | 799   ASSERT_EQ(72, dbs->GetVersion()); | 
|  | 800   dbs->EndLoad(); | 
|  | 801   ASSERT_FALSE(dbs->needs_column_refresh_); | 
|  | 802 | 
|  | 803   sql::Connection connection; | 
|  | 804   ASSERT_TRUE(connection.Open(GetDatabasePath())); | 
|  | 805   ASSERT_FALSE(connection.DoesTableExist("extended_attributes")); | 
|  | 806 } | 
|  | 807 | 
| 677 TEST_P(MigrationTest, ToCurrentVersion) { | 808 TEST_P(MigrationTest, ToCurrentVersion) { | 
| 678   switch (GetParam()) { | 809   switch (GetParam()) { | 
| 679     case 67: | 810     case 67: | 
| 680       SetUpVersion67Database(); | 811       SetUpVersion67Database(); | 
| 681       break; | 812       break; | 
| 682     case 68: | 813     case 68: | 
| 683       SetUpVersion68Database(); | 814       SetUpVersion68Database(); | 
| 684       break; | 815       break; | 
| 685     case 69: | 816     case 69: | 
| 686       SetUpVersion69Database(); | 817       SetUpVersion69Database(); | 
| 687       break; | 818       break; | 
| 688     case 70: | 819     case 70: | 
| 689       SetUpVersion70Database(); | 820       SetUpVersion70Database(); | 
| 690       break; | 821       break; | 
|  | 822     case 71: | 
|  | 823       SetUpVersion71Database(); | 
|  | 824       break; | 
| 691     default: | 825     default: | 
| 692       // If you see this error, it may mean that you've increased the | 826       // If you see this error, it may mean that you've increased the | 
| 693       // database version number but you haven't finished adding unit tests | 827       // database version number but you haven't finished adding unit tests | 
| 694       // for the database migration code.  You need to need to supply a | 828       // for the database migration code.  You need to need to supply a | 
| 695       // SetUpVersionXXDatabase function with a dump of the test database | 829       // SetUpVersionXXDatabase function with a dump of the test database | 
| 696       // at the old schema.  Here's one way to do that: | 830       // at the old schema.  Here's one way to do that: | 
| 697       //   1. Start on a clean tree (with none of your pending schema changes). | 831       //   1. Start on a clean tree (with none of your pending schema changes). | 
| 698       //   2. Set a breakpoint in this function and run the unit test. | 832       //   2. Set a breakpoint in this function and run the unit test. | 
| 699       //   3. Allow this test to run to completion (step out of the call), | 833       //   3. Allow this test to run to completion (step out of the call), | 
| 700       //      without allowing ~MigrationTest to execute. | 834       //      without allowing ~MigrationTest to execute. | 
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 732     ASSERT_FALSE(connection.DoesColumnExist("metas", | 866     ASSERT_FALSE(connection.DoesColumnExist("metas", | 
| 733                                             "server_is_bookmark_object")); | 867                                             "server_is_bookmark_object")); | 
| 734     ASSERT_FALSE(connection.DoesColumnExist("metas", "bookmark_favicon")); | 868     ASSERT_FALSE(connection.DoesColumnExist("metas", "bookmark_favicon")); | 
| 735     ASSERT_FALSE(connection.DoesColumnExist("metas", "bookmark_url")); | 869     ASSERT_FALSE(connection.DoesColumnExist("metas", "bookmark_url")); | 
| 736     ASSERT_FALSE(connection.DoesColumnExist("metas", "server_bookmark_url")); | 870     ASSERT_FALSE(connection.DoesColumnExist("metas", "server_bookmark_url")); | 
| 737 | 871 | 
| 738     // Renamed a column in Version 70 | 872     // Renamed a column in Version 70 | 
| 739     ASSERT_FALSE(connection.DoesColumnExist("metas", "singleton_tag")); | 873     ASSERT_FALSE(connection.DoesColumnExist("metas", "singleton_tag")); | 
| 740     ASSERT_TRUE(connection.DoesColumnExist("metas", "unique_server_tag")); | 874     ASSERT_TRUE(connection.DoesColumnExist("metas", "unique_server_tag")); | 
| 741     ASSERT_TRUE(connection.DoesColumnExist("metas", "unique_client_tag")); | 875     ASSERT_TRUE(connection.DoesColumnExist("metas", "unique_client_tag")); | 
|  | 876 | 
|  | 877     // Removed extended attributes in Version 72. | 
|  | 878     ASSERT_FALSE(connection.DoesTableExist("extended_attributes")); | 
| 742   } | 879   } | 
| 743 | 880 | 
| 744   MetahandlesIndex index; | 881   MetahandlesIndex index; | 
| 745   dbs->LoadEntries(&index); | 882   dbs->LoadEntries(&index); | 
| 746   dbs->EndLoad(); | 883   dbs->EndLoad(); | 
| 747 | 884 | 
| 748   MetahandlesIndex::iterator it = index.begin(); | 885   MetahandlesIndex::iterator it = index.begin(); | 
| 749   ASSERT_TRUE(it != index.end()); | 886   ASSERT_TRUE(it != index.end()); | 
| 750   ASSERT_EQ(1, (*it)->ref(META_HANDLE)); | 887   ASSERT_EQ(1, (*it)->ref(META_HANDLE)); | 
| 751   EXPECT_TRUE((*it)->ref(ID).IsRoot()); | 888   EXPECT_TRUE((*it)->ref(ID).IsRoot()); | 
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 900     // over if it detects invalid/corrupted data. | 1037     // over if it detects invalid/corrupted data. | 
| 901 #if defined(NDEBUG) | 1038 #if defined(NDEBUG) | 
| 902     EXPECT_TRUE(dbs->BeginLoad()); | 1039     EXPECT_TRUE(dbs->BeginLoad()); | 
| 903 #else | 1040 #else | 
| 904     EXPECT_DEATH(dbs->BeginLoad(), "sqlite error"); | 1041     EXPECT_DEATH(dbs->BeginLoad(), "sqlite error"); | 
| 905 #endif | 1042 #endif | 
| 906   } | 1043   } | 
| 907 } | 1044 } | 
| 908 | 1045 | 
| 909 }  // namespace syncable | 1046 }  // namespace syncable | 
| OLD | NEW | 
|---|