Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(27)

Side by Side Diff: sync/syncable/directory_backing_store_unittest.cc

Issue 218623014: [Sync] Add context proto and directory support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update protos Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 "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 "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 void SetUpVersion77Database(sql::Connection* connection); 67 void SetUpVersion77Database(sql::Connection* connection);
68 void SetUpVersion78Database(sql::Connection* connection); 68 void SetUpVersion78Database(sql::Connection* connection);
69 void SetUpVersion79Database(sql::Connection* connection); 69 void SetUpVersion79Database(sql::Connection* connection);
70 void SetUpVersion80Database(sql::Connection* connection); 70 void SetUpVersion80Database(sql::Connection* connection);
71 void SetUpVersion81Database(sql::Connection* connection); 71 void SetUpVersion81Database(sql::Connection* connection);
72 void SetUpVersion82Database(sql::Connection* connection); 72 void SetUpVersion82Database(sql::Connection* connection);
73 void SetUpVersion83Database(sql::Connection* connection); 73 void SetUpVersion83Database(sql::Connection* connection);
74 void SetUpVersion84Database(sql::Connection* connection); 74 void SetUpVersion84Database(sql::Connection* connection);
75 void SetUpVersion85Database(sql::Connection* connection); 75 void SetUpVersion85Database(sql::Connection* connection);
76 void SetUpVersion86Database(sql::Connection* connection); 76 void SetUpVersion86Database(sql::Connection* connection);
77 void SetUpVersion87Database(sql::Connection* connection);
77 78
78 void SetUpCurrentDatabaseAndCheckVersion(sql::Connection* connection) { 79 void SetUpCurrentDatabaseAndCheckVersion(sql::Connection* connection) {
79 SetUpVersion86Database(connection); // Prepopulates data. 80 SetUpVersion87Database(connection); // Prepopulates data.
80 scoped_ptr<TestDirectoryBackingStore> dbs( 81 scoped_ptr<TestDirectoryBackingStore> dbs(
81 new TestDirectoryBackingStore(GetUsername(), connection)); 82 new TestDirectoryBackingStore(GetUsername(), connection));
82 ASSERT_EQ(kCurrentDBVersion, dbs->GetVersion()); 83 ASSERT_EQ(kCurrentDBVersion, dbs->GetVersion());
83 84
84 ASSERT_TRUE(LoadAndIgnoreReturnedData(dbs.get())); 85 ASSERT_TRUE(LoadAndIgnoreReturnedData(dbs.get()));
85 ASSERT_FALSE(dbs->needs_column_refresh_); 86 ASSERT_FALSE(dbs->needs_column_refresh_);
86 } 87 }
87 88
88 private: 89 private:
89 base::ScopedTempDir temp_dir_; 90 base::ScopedTempDir temp_dir_;
(...skipping 2437 matching lines...) Expand 10 before | Expand all | Expand 10 after
2527 "CREATE TABLE 'share_info' (id TEXT primary key, name TEXT, store_birt" 2528 "CREATE TABLE 'share_info' (id TEXT primary key, name TEXT, store_birt"
2528 "hday TEXT, db_create_version TEXT, db_create_time INT, next_id INT de" 2529 "hday TEXT, db_create_version TEXT, db_create_time INT, next_id INT de"
2529 "fault -2, cache_guid TEXT, notification_state BLOB, bag_of_chips BLOB" 2530 "fault -2, cache_guid TEXT, notification_state BLOB, bag_of_chips BLOB"
2530 ");" 2531 ");"
2531 "INSERT INTO 'share_info' VALUES('nick@chromium.org','nick@chromium.or" 2532 "INSERT INTO 'share_info' VALUES('nick@chromium.org','nick@chromium.or"
2532 "g','c27e9f59-08ca-46f8-b0cc-f16a2ed778bb','Unknown',1263522064,-13107" 2533 "g','c27e9f59-08ca-46f8-b0cc-f16a2ed778bb','Unknown',1263522064,-13107"
2533 "8,'9010788312004066376x-6609234393368420856x',NULL,NULL);")); 2534 "8,'9010788312004066376x-6609234393368420856x',NULL,NULL);"));
2534 ASSERT_TRUE(connection->CommitTransaction()); 2535 ASSERT_TRUE(connection->CommitTransaction());
2535 } 2536 }
2536 2537
2538 void MigrationTest::SetUpVersion87Database(sql::Connection* connection) {
maniscalco 2014/04/03 16:59:37 I'm afraid this patch is off an older HEAD. I rec
Nicolas Zea 2014/04/03 21:01:11 Done.
2539 ASSERT_TRUE(connection->is_open());
2540 ASSERT_TRUE(connection->BeginTransaction());
2541 ASSERT_TRUE(connection->Execute(
2542 "CREATE TABLE share_version (id VARCHAR(128) primary key, data INT);"
2543 "INSERT INTO 'share_version' VALUES('nick@chromium.org',87);"
2544 "CREATE TABLE models (model_id BLOB primary key, progress_marker BLOB,"
2545 " transaction_version BIGINT default 0, context BLOB);"
2546 "INSERT INTO 'models' VALUES(X'C2881000',X'0888810218B605',1,NULL);"
2547 "CREATE TABLE 'metas'(metahandle bigint primary key ON CONFLICT FAIL,b"
2548 "ase_version bigint default -1,server_version bigint default 0,local_e"
2549 "xternal_id bigint default 0,transaction_version bigint default 0,mtim"
2550 "e bigint default 0,server_mtime bigint default 0,ctime bigint default"
2551 " 0,server_ctime bigint default 0,id varchar(255) default 'r',parent_i"
2552 "d varchar(255) default 'r',server_parent_id varchar(255) default 'r',"
2553 "is_unsynced bit default 0,is_unapplied_update bit default 0,is_del bi"
2554 "t default 0,is_dir bit default 0,server_is_dir bit default 0,server_i"
2555 "s_del bit default 0,non_unique_name varchar,server_non_unique_name va"
2556 "rchar(255),unique_server_tag varchar,unique_client_tag varchar,unique"
2557 "_bookmark_tag varchar,specifics blob,server_specifics blob,base_serve"
2558 "r_specifics blob,server_unique_position blob,unique_position blob);"
2559 "INSERT INTO 'metas' VALUES(1,-1,0,0,0,"
2560 META_PROTO_TIMES_VALS(1)
2561 ",'r','r','r',0,0,0,1,0,0,NULL,NULL,NULL,NULL,"
2562 "X'',X'',X'',NULL,X'2200',X'2200');"
2563 "INSERT INTO 'metas' VALUES(6,694,694,6,0,"
2564 META_PROTO_TIMES_VALS(6) ",'s_ID_6','s_ID_9','s_ID_9',0,0,0,1,1,0,'The"
2565 " Internet','The Internet',NULL,NULL,X'6754307476346749735A5734654D653"
2566 "273625336557753582F77673D',X'C2881000',X'C2881000',NULL,X'22247FFFFFF"
2567 "FFFC000006754307476346749735A5734654D653273625336557753582F77673D',X'"
2568 "22247FFFFFFFFFC000006754307476346749735A5734654D653273625336557753582"
2569 "F77673D');"
2570 "INSERT INTO 'metas' VALUES(7,663,663,0,0,"
2571 META_PROTO_TIMES_VALS(7) ",'s_ID_7','r','r',0,0,0,1,1,0,'Google Chrome"
2572 "','Google Chrome','google_chrome',NULL,X'',NULL,NULL,NULL,X'2200',X'2"
2573 "200');"
2574 "INSERT INTO 'metas' VALUES(8,664,664,0,0,"
2575 META_PROTO_TIMES_VALS(8) ",'s_ID_8','s_ID_7','s_ID_7',0,0,0,1,1,0,'Boo"
2576 "kmarks','Bookmarks','google_chrome_bookmarks',NULL,X'',X'C2881000',X'"
2577 "C2881000',NULL,X'2200',X'2200');"
2578 "INSERT INTO 'metas' VALUES(9,665,665,1,0,"
2579 META_PROTO_TIMES_VALS(9) ",'s_ID_9','s_ID_8','s_ID_8',0,0,0,1,1,0,'Boo"
2580 "kmark Bar','Bookmark Bar','bookmark_bar',NULL,X'',X'C2881000',X'C2881"
2581 "000',NULL,X'2200',X'2200');"
2582 "INSERT INTO 'metas' VALUES(10,666,666,2,0,"
2583 META_PROTO_TIMES_VALS(10) ",'s_ID_10','s_ID_8','s_ID_8',0,0,0,1,1,0,'O"
2584 "ther Bookmarks','Other Bookmarks','other_bookmarks',NULL,X'',X'C28810"
2585 "00',X'C2881000',NULL,X'2200',X'2200');"
2586 "INSERT INTO 'metas' VALUES(11,683,683,8,0,"
2587 META_PROTO_TIMES_VALS(11) ",'s_ID_11','s_ID_6','s_ID_6',0,0,0,0,0,0,'H"
2588 "ome (The Chromium Projects)','Home (The Chromium Projects)',NULL,NULL"
2589 ",X'50514C784A456D623579366267644237646A7A2B62314130346E493D',X'C28810"
2590 "220A18687474703A2F2F6465762E6368726F6D69756D2E6F72672F120641474154574"
2591 "1',X'C28810290A1D687474703A2F2F6465762E6368726F6D69756D2E6F72672F6F74"
2592 "68657212084146414756415346',NULL,X'22247FFFFFFFFFF0000050514C784A456D"
2593 "623579366267644237646A7A2B62314130346E493D',X'22247FFFFFFFFFF00000505"
2594 "14C784A456D623579366267644237646A7A2B62314130346E493D');"
2595 "INSERT INTO 'metas' VALUES(12,685,685,9,0,"
2596 META_PROTO_TIMES_VALS(12) ",'s_ID_12','s_ID_6','s_ID_6',0,0,0,1,1,0,'E"
2597 "xtra Bookmarks','Extra Bookmarks',NULL,NULL,X'7867626A704A646134635A6"
2598 "F616C376A49513338734B46324837773D',X'C2881000',X'C2881000',NULL,X'222"
2599 "480000000000000007867626A704A646134635A6F616C376A49513338734B46324837"
2600 "773D',X'222480000000000000007867626A704A646134635A6F616C376A495133387"
2601 "34B46324837773D');"
2602 "INSERT INTO 'metas' VALUES(13,687,687,10,0,"
2603 META_PROTO_TIMES_VALS(13) ",'s_ID_13','s_ID_6','s_ID_6',0,0,0,0,0,0,'I"
2604 "CANN | Internet Corporation for Assigned Names and Numbers','ICANN | "
2605 "Internet Corporation for Assigned Names and Numbers',NULL,NULL,X'3142"
2606 "756B572F7741766956504179672B304A614A514B3452384A413D',X'C28810240A156"
2607 "87474703A2F2F7777772E6963616E6E2E636F6D2F120B504E474158463041414646',"
2608 "X'C28810200A15687474703A2F2F7777772E6963616E6E2E636F6D2F1207444141464"
2609 "15346',NULL,X'22247FFFFFFFFFF200003142756B572F7741766956504179672B304"
2610 "A614A514B3452384A413D',X'22247FFFFFFFFFF200003142756B572F774176695650"
2611 "4179672B304A614A514B3452384A413D');"
2612 "INSERT INTO 'metas' VALUES(14,692,692,11,0,"
2613 META_PROTO_TIMES_VALS(14) ",'s_ID_14','s_ID_6','s_ID_6',0,0,0,0,0,0,'T"
2614 "he WebKit Open Source Project','The WebKit Open Source Project',NULL,"
2615 "NULL,X'5A5678314E7976364579524D3177494F7236563159552F6E644C553D',X'C2"
2616 "88101A0A12687474703A2F2F7765626B69742E6F72672F1204504E4758',X'C288101"
2617 "C0A13687474703A2F2F7765626B69742E6F72672F781205504E473259',NULL,X'222"
2618 "480000000001000005A5678314E7976364579524D3177494F7236563159552F6E644C"
2619 "553D',X'222480000000001000005A5678314E7976364579524D3177494F723656315"
2620 "9552F6E644C553D');"
2621 "CREATE TABLE deleted_metas (metahandle bigint primary key ON CONFLICT FA"
2622 "IL,base_version bigint default -1,server_version bigint default 0,loc"
2623 "al_external_id bigint default 0,transaction_version bigint default 0,"
2624 "mtime bigint default 0,server_mtime bigint default 0,ctime bigint def"
2625 "ault 0,server_ctime bigint default 0,id varchar(255) default 'r',pare"
2626 "nt_id varchar(255) default 'r',server_parent_id varchar(255) default "
2627 "'r',is_unsynced bit default 0,is_unapplied_update bit default 0,is_de"
2628 "l bit default 0,is_dir bit default 0,server_is_dir bit default 0,serv"
2629 "er_is_del bit default 0,non_unique_name varchar,server_non_unique_nam"
2630 "e varchar(255),unique_server_tag varchar,unique_client_tag varchar,un"
2631 "ique_bookmark_tag varchar,specifics blob,server_specifics blob,base_s"
2632 "erver_specifics blob,server_unique_position blob,unique_position blob"
2633 ");"
2634 "CREATE TABLE 'share_info' (id TEXT primary key, name TEXT, store_birt"
2635 "hday TEXT, db_create_version TEXT, db_create_time INT, next_id INT de"
2636 "fault -2, cache_guid TEXT, notification_state BLOB, bag_of_chips BLOB"
2637 ");"
2638 "INSERT INTO 'share_info' VALUES('nick@chromium.org','nick@chromium.or"
2639 "g','c27e9f59-08ca-46f8-b0cc-f16a2ed778bb','Unknown',1263522064,-13107"
2640 "8,'9010788312004066376x-6609234393368420856x',NULL,NULL);"));
2641 ASSERT_TRUE(connection->CommitTransaction());
2642 }
2643
2537 TEST_F(DirectoryBackingStoreTest, MigrateVersion67To68) { 2644 TEST_F(DirectoryBackingStoreTest, MigrateVersion67To68) {
2538 sql::Connection connection; 2645 sql::Connection connection;
2539 ASSERT_TRUE(connection.OpenInMemory()); 2646 ASSERT_TRUE(connection.OpenInMemory());
2540 2647
2541 SetUpVersion67Database(&connection); 2648 SetUpVersion67Database(&connection);
2542 2649
2543 // Columns existing before version 67. 2650 // Columns existing before version 67.
2544 ASSERT_TRUE(connection.DoesColumnExist("metas", "name")); 2651 ASSERT_TRUE(connection.DoesColumnExist("metas", "name"));
2545 ASSERT_TRUE(connection.DoesColumnExist("metas", "unsanitized_name")); 2652 ASSERT_TRUE(connection.DoesColumnExist("metas", "unsanitized_name"));
2546 ASSERT_TRUE(connection.DoesColumnExist("metas", "server_name")); 2653 ASSERT_TRUE(connection.DoesColumnExist("metas", "server_name"));
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
2991 scoped_ptr<TestDirectoryBackingStore> dbs( 3098 scoped_ptr<TestDirectoryBackingStore> dbs(
2992 new TestDirectoryBackingStore(GetUsername(), &connection)); 3099 new TestDirectoryBackingStore(GetUsername(), &connection));
2993 ASSERT_TRUE(dbs->MigrateVersion85To86()); 3100 ASSERT_TRUE(dbs->MigrateVersion85To86());
2994 EXPECT_EQ(86, dbs->GetVersion()); 3101 EXPECT_EQ(86, dbs->GetVersion());
2995 EXPECT_TRUE(connection.DoesColumnExist("metas", "unique_position")); 3102 EXPECT_TRUE(connection.DoesColumnExist("metas", "unique_position"));
2996 EXPECT_TRUE(connection.DoesColumnExist("metas", "server_unique_position")); 3103 EXPECT_TRUE(connection.DoesColumnExist("metas", "server_unique_position"));
2997 EXPECT_TRUE(connection.DoesColumnExist("metas", "unique_bookmark_tag")); 3104 EXPECT_TRUE(connection.DoesColumnExist("metas", "unique_bookmark_tag"));
2998 ASSERT_TRUE(dbs->needs_column_refresh_); 3105 ASSERT_TRUE(dbs->needs_column_refresh_);
2999 } 3106 }
3000 3107
3108 TEST_F(DirectoryBackingStoreTest, MigrateVersion86To87) {
3109 sql::Connection connection;
3110 ASSERT_TRUE(connection.OpenInMemory());
3111 SetUpVersion86Database(&connection);
3112
3113 scoped_ptr<TestDirectoryBackingStore> dbs(
3114 new TestDirectoryBackingStore(GetUsername(), &connection));
3115 ASSERT_TRUE(dbs->MigrateVersion86To87());
3116 ASSERT_EQ(87, dbs->GetVersion());
3117 ASSERT_TRUE(connection.DoesColumnExist("models", "context"));
3118 }
3119
3001 // The purpose of this test case is to make it easier to get a dump of the 3120 // The purpose of this test case is to make it easier to get a dump of the
3002 // database so you can implement a SetUpVersionYDatabase method. Here's what 3121 // database so you can implement a SetUpVersionYDatabase method. Here's what
3003 // you should do: 3122 // you should do:
3004 // 3123 //
3005 // 1. Say you're going from version X to version Y. Write the migration 3124 // 1. Say you're going from version X to version Y. Write the migration
3006 // method MigrateVersionXToY. 3125 // method MigrateVersionXToY.
3007 // 2. Update the test below to call SetUpVersionXDatabase and then 3126 // 2. Update the test below to call SetUpVersionXDatabase and then
3008 // MigrateVersionXToY. You now have a database at version Y. Let's dump it. 3127 // MigrateVersionXToY. You now have a database at version Y. Let's dump it.
3009 // 3. Set a breakpoint to stop execution just after the connection is 3128 // 3. Set a breakpoint to stop execution just after the connection is
3010 // destroyed. Examine temp_dir_ to find the version Y database that was 3129 // destroyed. Examine temp_dir_ to find the version Y database that was
3011 // created on disk. E.g. (gdb) p temp_dir_.path().value().c_str() 3130 // created on disk. E.g. (gdb) p temp_dir_.path().value().c_str()
3012 // 4. Dump the database using the sqlite3 command line tool: 3131 // 4. Dump the database using the sqlite3 command line tool:
3013 // > .output foo_dump.sql 3132 // > .output foo_dump.sql
3014 // > .dump 3133 // > .dump
3015 // 5. Replace the timestamp columns with META_PROTO_TIMES(x) (or 3134 // 5. Replace the timestamp columns with META_PROTO_TIMES(x) (or
3016 // LEGACY_META_PROTO_TIMES(x) if before Version 77). Use this dump to write 3135 // LEGACY_META_PROTO_TIMES(x) if before Version 77). Use this dump to write
3017 // a SetupVersionYDatabase method. 3136 // a SetupVersionYDatabase method.
3018 TEST_F(DirectoryBackingStoreTest, MigrateToLatestAndDump) { 3137 TEST_F(DirectoryBackingStoreTest, MigrateToLatestAndDump) {
3019 { 3138 {
3020 sql::Connection connection; 3139 sql::Connection connection;
3021 ASSERT_TRUE(connection.Open(GetDatabasePath())); 3140 ASSERT_TRUE(connection.Open(GetDatabasePath()));
3022 SetUpVersion85Database(&connection); // Update this. 3141 SetUpVersion86Database(&connection); // Update this.
3023 3142
3024 scoped_ptr<TestDirectoryBackingStore> dbs( 3143 scoped_ptr<TestDirectoryBackingStore> dbs(
3025 new TestDirectoryBackingStore(GetUsername(), &connection)); 3144 new TestDirectoryBackingStore(GetUsername(), &connection));
3026 ASSERT_TRUE(dbs->MigrateVersion85To86()); // Update this. 3145 ASSERT_TRUE(dbs->MigrateVersion86To87()); // Update this.
3027 ASSERT_TRUE(LoadAndIgnoreReturnedData(dbs.get())); 3146 ASSERT_TRUE(LoadAndIgnoreReturnedData(dbs.get()));
3028 EXPECT_EQ(86, dbs->GetVersion()); // Update this. 3147 EXPECT_EQ(87, dbs->GetVersion()); // Update this.
3029 ASSERT_FALSE(dbs->needs_column_refresh_); 3148 ASSERT_FALSE(dbs->needs_column_refresh_);
3030 } 3149 }
3031 // Set breakpoint here. 3150 // Set breakpoint here.
3032 } 3151 }
3033 3152
3034 TEST_F(DirectoryBackingStoreTest, DetectInvalidPosition) { 3153 TEST_F(DirectoryBackingStoreTest, DetectInvalidPosition) {
3035 sql::Connection connection; 3154 sql::Connection connection;
3036 ASSERT_TRUE(connection.OpenInMemory()); 3155 ASSERT_TRUE(connection.OpenInMemory());
3037 SetUpVersion86Database(&connection); 3156 SetUpVersion86Database(&connection);
3038 3157
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
3114 break; 3233 break;
3115 case 84: 3234 case 84:
3116 SetUpVersion84Database(&connection); 3235 SetUpVersion84Database(&connection);
3117 break; 3236 break;
3118 case 85: 3237 case 85:
3119 SetUpVersion85Database(&connection); 3238 SetUpVersion85Database(&connection);
3120 break; 3239 break;
3121 case 86: 3240 case 86:
3122 SetUpVersion86Database(&connection); 3241 SetUpVersion86Database(&connection);
3123 break; 3242 break;
3243 case 87:
3244 SetUpVersion87Database(&connection);
3245 break;
3124 default: 3246 default:
3125 // If you see this error, it may mean that you've increased the 3247 // If you see this error, it may mean that you've increased the
3126 // database version number but you haven't finished adding unit tests 3248 // database version number but you haven't finished adding unit tests
3127 // for the database migration code. You need to need to supply a 3249 // for the database migration code. You need to need to supply a
3128 // SetUpVersionYDatabase function with a dump of the test database 3250 // SetUpVersionYDatabase function with a dump of the test database
3129 // at the new schema. See the MigrateToLatestAndDump test case. 3251 // at the new schema. See the MigrateToLatestAndDump test case.
3130 FAIL() << "Need to supply database dump for version " << GetParam(); 3252 FAIL() << "Need to supply database dump for version " << GetParam();
3131 } 3253 }
3132 3254
3133 syncable::Directory::KernelLoadInfo dir_info; 3255 syncable::Directory::KernelLoadInfo dir_info;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
3184 connection.DoesColumnExist("share_info", "autofill_migration_time")); 3306 connection.DoesColumnExist("share_info", "autofill_migration_time"));
3185 ASSERT_FALSE(connection.DoesColumnExist("share_info", 3307 ASSERT_FALSE(connection.DoesColumnExist("share_info",
3186 "autofill_entries_added_during_migration")); 3308 "autofill_entries_added_during_migration"));
3187 ASSERT_FALSE(connection.DoesColumnExist("share_info", 3309 ASSERT_FALSE(connection.DoesColumnExist("share_info",
3188 "autofill_profiles_added_during_migration")); 3310 "autofill_profiles_added_during_migration"));
3189 3311
3190 // Column added in version 78. 3312 // Column added in version 78.
3191 ASSERT_TRUE(connection.DoesColumnExist("metas", "base_server_specifics")); 3313 ASSERT_TRUE(connection.DoesColumnExist("metas", "base_server_specifics"));
3192 3314
3193 // Column added in version 82. 3315 // Column added in version 82.
3194 ASSERT_TRUE(connection.DoesColumnExist("models", "transaction_version")); 3316 ASSERT_TRUE(connection.DoesColumnExist("models", "transaction_version"));
maniscalco 2014/04/03 16:59:37 Can you an assert that verifies the DB has the new
Nicolas Zea 2014/04/03 21:01:11 Done.
3195 3317
3196 // Column added in version 83. 3318 // Column added in version 83.
3197 ASSERT_TRUE(connection.DoesColumnExist("metas", "transaction_version")); 3319 ASSERT_TRUE(connection.DoesColumnExist("metas", "transaction_version"));
3198 3320
3199 // Table added in version 84. 3321 // Table added in version 84.
3200 ASSERT_TRUE(connection.DoesTableExist("deleted_metas")); 3322 ASSERT_TRUE(connection.DoesTableExist("deleted_metas"));
3201 3323
3202 // Column removed in version 85. 3324 // Column removed in version 85.
3203 ASSERT_FALSE(connection.DoesColumnExist("models", "initial_sync_ended")); 3325 ASSERT_FALSE(connection.DoesColumnExist("models", "initial_sync_ended"));
3204 3326
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
3520 const std::string& guid2 = TestDirectoryBackingStore::GenerateCacheGUID(); 3642 const std::string& guid2 = TestDirectoryBackingStore::GenerateCacheGUID();
3521 EXPECT_EQ(24U, guid1.size()); 3643 EXPECT_EQ(24U, guid1.size());
3522 EXPECT_EQ(24U, guid2.size()); 3644 EXPECT_EQ(24U, guid2.size());
3523 // In theory this test can fail, but it won't before the universe 3645 // In theory this test can fail, but it won't before the universe
3524 // dies of heat death. 3646 // dies of heat death.
3525 EXPECT_NE(guid1, guid2); 3647 EXPECT_NE(guid1, guid2);
3526 } 3648 }
3527 3649
3528 } // namespace syncable 3650 } // namespace syncable
3529 } // namespace syncer 3651 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698