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

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

Issue 10989063: Changed DB to store node positions as Ordinals. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Implemented feedback changes. Created 8 years, 2 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
OLDNEW
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 "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_path.h" 9 #include "base/file_path.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/scoped_temp_dir.h" 12 #include "base/scoped_temp_dir.h"
13 #include "base/stl_util.h" 13 #include "base/stl_util.h"
14 #include "base/string_number_conversions.h" 14 #include "base/string_number_conversions.h"
15 #include "sql/connection.h" 15 #include "sql/connection.h"
16 #include "sql/statement.h" 16 #include "sql/statement.h"
17 #include "sync/protocol/bookmark_specifics.pb.h" 17 #include "sync/protocol/bookmark_specifics.pb.h"
18 #include "sync/protocol/sync.pb.h" 18 #include "sync/protocol/sync.pb.h"
19 #include "sync/syncable/directory_backing_store.h" 19 #include "sync/syncable/directory_backing_store.h"
20 #include "sync/syncable/on_disk_directory_backing_store.h" 20 #include "sync/syncable/on_disk_directory_backing_store.h"
21 #include "sync/syncable/syncable-inl.h" 21 #include "sync/syncable/syncable-inl.h"
22 #include "sync/test/test_directory_backing_store.h" 22 #include "sync/test/test_directory_backing_store.h"
23 #include "sync/util/time.h" 23 #include "sync/util/time.h"
24 #include "testing/gtest/include/gtest/gtest-param-test.h" 24 #include "testing/gtest/include/gtest/gtest-param-test.h"
25 #include "sync/internal_api/public/base/ordinal.h"
rlarocque 2012/10/01 21:45:55 These should be in alphabetical order.
vishwath 2012/10/02 01:06:33 Done.
26 #include "sync/internal_api/public/base/node_ordinal.h"
25 27
26 namespace syncer { 28 namespace syncer {
27 namespace syncable { 29 namespace syncable {
28 30
29 extern const int32 kCurrentDBVersion; 31 extern const int32 kCurrentDBVersion;
30 32
31 class MigrationTest : public testing::TestWithParam<int> { 33 class MigrationTest : public testing::TestWithParam<int> {
32 public: 34 public:
33 virtual void SetUp() { 35 virtual void SetUp() {
34 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); 36 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
(...skipping 21 matching lines...) Expand all
56 void SetUpVersion70Database(sql::Connection* connection); 58 void SetUpVersion70Database(sql::Connection* connection);
57 void SetUpVersion71Database(sql::Connection* connection); 59 void SetUpVersion71Database(sql::Connection* connection);
58 void SetUpVersion72Database(sql::Connection* connection); 60 void SetUpVersion72Database(sql::Connection* connection);
59 void SetUpVersion73Database(sql::Connection* connection); 61 void SetUpVersion73Database(sql::Connection* connection);
60 void SetUpVersion74Database(sql::Connection* connection); 62 void SetUpVersion74Database(sql::Connection* connection);
61 void SetUpVersion75Database(sql::Connection* connection); 63 void SetUpVersion75Database(sql::Connection* connection);
62 void SetUpVersion76Database(sql::Connection* connection); 64 void SetUpVersion76Database(sql::Connection* connection);
63 void SetUpVersion77Database(sql::Connection* connection); 65 void SetUpVersion77Database(sql::Connection* connection);
64 void SetUpVersion78Database(sql::Connection* connection); 66 void SetUpVersion78Database(sql::Connection* connection);
65 void SetUpVersion79Database(sql::Connection* connection); 67 void SetUpVersion79Database(sql::Connection* connection);
68 void SetUpVersion80Database(sql::Connection* connection);
66 69
67 void SetUpCurrentDatabaseAndCheckVersion(sql::Connection* connection) { 70 void SetUpCurrentDatabaseAndCheckVersion(sql::Connection* connection) {
68 SetUpVersion77Database(connection); // Prepopulates data. 71 SetUpVersion77Database(connection); // Prepopulates data.
69 scoped_ptr<TestDirectoryBackingStore> dbs( 72 scoped_ptr<TestDirectoryBackingStore> dbs(
70 new TestDirectoryBackingStore(GetUsername(), connection)); 73 new TestDirectoryBackingStore(GetUsername(), connection));
71 74
72 ASSERT_TRUE(LoadAndIgnoreReturnedData(dbs.get())); 75 ASSERT_TRUE(LoadAndIgnoreReturnedData(dbs.get()));
73 ASSERT_FALSE(dbs->needs_column_refresh_); 76 ASSERT_FALSE(dbs->needs_column_refresh_);
74 ASSERT_EQ(kCurrentDBVersion, dbs->GetVersion()); 77 ASSERT_EQ(kCurrentDBVersion, dbs->GetVersion());
75 } 78 }
(...skipping 1552 matching lines...) Expand 10 before | Expand all | Expand 10 after
1628 "9010788312004066376x-6609234393368420856x',NULL);" 1631 "9010788312004066376x-6609234393368420856x',NULL);"
1629 )); 1632 ));
1630 ASSERT_TRUE(connection->CommitTransaction()); 1633 ASSERT_TRUE(connection->CommitTransaction());
1631 } 1634 }
1632 1635
1633 void MigrationTest::SetUpVersion79Database(sql::Connection* connection) { 1636 void MigrationTest::SetUpVersion79Database(sql::Connection* connection) {
1634 ASSERT_TRUE(connection->is_open()); 1637 ASSERT_TRUE(connection->is_open());
1635 ASSERT_TRUE(connection->BeginTransaction()); 1638 ASSERT_TRUE(connection->BeginTransaction());
1636 ASSERT_TRUE(connection->Execute( 1639 ASSERT_TRUE(connection->Execute(
1637 "CREATE TABLE share_version (id VARCHAR(128) primary key, data INT);" 1640 "CREATE TABLE share_version (id VARCHAR(128) primary key, data INT);"
1638 "INSERT INTO 'share_version' VALUES('nick@chromium.org',78);" 1641 "INSERT INTO 'share_version' VALUES('nick@chromium.org',79);"
1639 "CREATE TABLE models (model_id BLOB primary key, progress_marker BLOB, in" 1642 "CREATE TABLE models (model_id BLOB primary key, progress_marker BLOB, in"
1640 "itial_sync_ended BOOLEAN default 0);" 1643 "itial_sync_ended BOOLEAN default 0);"
1641 "INSERT INTO 'models' VALUES(X'C2881000',X'0888810218B605',1);" 1644 "INSERT INTO 'models' VALUES(X'C2881000',X'0888810218B605',1);"
1642 "CREATE TABLE 'metas'(metahandle bigint primary key ON CONFLICT FAIL,base" 1645 "CREATE TABLE 'metas'(metahandle bigint primary key ON CONFLICT FAIL,base"
1643 "_version bigint default -1,server_version bigint default 0,server_po" 1646 "_version bigint default -1,server_version bigint default 0,server_po"
1644 "sition_in_parent bigint default 0,local_external_id bigint default 0" 1647 "sition_in_parent bigint default 0,local_external_id bigint default 0"
1645 ",mtime bigint default 0,server_mtime bigint default 0,ctime bigint d" 1648 ",mtime bigint default 0,server_mtime bigint default 0,ctime bigint d"
1646 "efault 0,server_ctime bigint default 0,id varchar(255) default 'r',p" 1649 "efault 0,server_ctime bigint default 0,id varchar(255) default 'r',p"
1647 "arent_id varchar(255) default 'r',server_parent_id varchar(255) defa" 1650 "arent_id varchar(255) default 'r',server_parent_id varchar(255) defa"
1648 "ult 'r',prev_id varchar(255) default 'r',next_id varchar(255) defaul" 1651 "ult 'r',prev_id varchar(255) default 'r',next_id varchar(255) defaul"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
1718 "CREATE TABLE 'share_info' (id TEXT primary key, name TEXT, store_birthda" 1721 "CREATE TABLE 'share_info' (id TEXT primary key, name TEXT, store_birthda"
1719 "y TEXT, db_create_version TEXT, db_create_time INT, next_id INT defa" 1722 "y TEXT, db_create_version TEXT, db_create_time INT, next_id INT defa"
1720 "ult -2, cache_guid TEXT , notification_state BLOB);" 1723 "ult -2, cache_guid TEXT , notification_state BLOB);"
1721 "INSERT INTO 'share_info' VALUES('nick@chromium.org','nick@chromium.org'," 1724 "INSERT INTO 'share_info' VALUES('nick@chromium.org','nick@chromium.org',"
1722 "'c27e9f59-08ca-46f8-b0cc-f16a2ed778bb','Unknown',1263522064," 1725 "'c27e9f59-08ca-46f8-b0cc-f16a2ed778bb','Unknown',1263522064,"
1723 "-131078,'9010788312004066376x-6609234393368420856x',NULL);" 1726 "-131078,'9010788312004066376x-6609234393368420856x',NULL);"
1724 )); 1727 ));
1725 ASSERT_TRUE(connection->CommitTransaction()); 1728 ASSERT_TRUE(connection->CommitTransaction());
1726 } 1729 }
1727 1730
1731 void MigrationTest::SetUpVersion80Database(sql::Connection* connection) {
1732 ASSERT_TRUE(connection->is_open());
1733 ASSERT_TRUE(connection->BeginTransaction());
1734 ASSERT_TRUE(connection->Execute(
1735 "CREATE TABLE share_version (id VARCHAR(128) primary key, data INT);"
1736 "INSERT INTO 'share_version' VALUES('nick@chromium.org',80);"
1737 "CREATE TABLE models (model_id BLOB primary key, progress_marker BLOB, in"
1738 "itial_sync_ended BOOLEAN default 0);"
1739 "INSERT INTO 'models' VALUES(X'C2881000',X'0888810218B605',1);"
1740 "CREATE TABLE 'metas'(metahandle bigint primary key ON CONFLICT FAIL,base"
1741 "_version bigint default -1,server_version bigint default 0,server_po"
1742 "sition_in_parent bigint default 0,local_external_id bigint default 0"
1743 ",mtime bigint default 0,server_mtime bigint default 0,ctime bigint d"
1744 "efault 0,server_ctime bigint default 0,id varchar(255) default 'r',p"
1745 "arent_id varchar(255) default 'r',server_parent_id varchar(255) defa"
1746 "ult 'r',prev_id varchar(255) default 'r',next_id varchar(255) defaul"
1747 "t 'r',is_unsynced bit default 0,is_unapplied_update bit default 0,is"
1748 "_del bit default 0,is_dir bit default 0,server_is_dir bit default 0,"
1749 "server_is_del bit default 0,non_unique_name varchar,server_non_uniqu"
1750 "e_name varchar(255),unique_server_tag varchar,unique_client_tag varc"
1751 "har,specifics blob,server_specifics blob, base_server_specifics BLOB"
1752 ");"
1753 "INSERT INTO 'metas' VALUES(1,-1,0,0,0," META_PROTO_TIMES_VALS(1) ",'r','"
1754 "r','r','r','r',0,0,0,1,0,0,NULL,NULL,NULL,NULL,X'',X'',NULL);"
1755 "INSERT INTO 'metas' VALUES(2,669,669,-2097152,4,"
1756 META_PROTO_TIMES_VALS(2) ",'s_ID_2','s_ID_9','s_ID_9','s_ID_2','s_ID_"
1757 "2',0,0,1,0,0,1,'Deleted Item','Deleted Item',NULL,NULL,X'C28810220A1"
1758 "6687474703A2F2F7777772E676F6F676C652E636F6D2F12084141534741534741',X"
1759 "'C28810260A17687474703A2F2F7777772E676F6F676C652E636F6D2F32120B41534"
1760 "14447414447414447',NULL);"
1761 "INSERT INTO 'metas' VALUES(4,681,681,-3145728,3,"
1762 META_PROTO_TIMES_VALS(4) ",'s_ID_4','s_ID_9','s_ID_9','s_ID_4','s_ID_"
1763 "4',0,0,1,0,0,1,'Welcome to Chromium','Welcome to Chromium',NULL,NULL"
1764 ",X'C28810350A31687474703A2F2F7777772E676F6F676C652E636F6D2F6368726F6"
1765 "D652F696E746C2F656E2F77656C636F6D652E68746D6C1200',X'C28810350A31687"
1766 "474703A2F2F7777772E676F6F676C652E636F6D2F6368726F6D652F696E746C2F656"
1767 "E2F77656C636F6D652E68746D6C1200',NULL);"
1768 "INSERT INTO 'metas' VALUES(5,677,677,1048576,7,"
1769 META_PROTO_TIMES_VALS(5) ",'s_ID_5','s_ID_9','s_ID_9','s_ID_5','s_ID_"
1770 "5',0,0,1,0,0,1,'Google','Google',NULL,NULL,X'C28810220A16687474703A2"
1771 "F2F7777772E676F6F676C652E636F6D2F12084147415347415347',X'C28810220A1"
1772 "6687474703A2F2F7777772E676F6F676C652E636F6D2F12084147464447415347',N"
1773 "ULL);"
1774 "INSERT INTO 'metas' VALUES(6,694,694,-4194304,6,"
1775 META_PROTO_TIMES_VALS(6) ",'s_ID_6','s_ID_9','s_ID_9','r','r',0,0,0,1"
1776 ",1,0,'The Internet','The Internet',NULL,NULL,X'C2881000',X'C2881000'"
1777 ",NULL);"
1778 "INSERT INTO 'metas' VALUES(7,663,663,1048576,0,"
1779 META_PROTO_TIMES_VALS(7) ",'s_ID_7','r','r','r','r',0,0,0,1,1,0,'Goog"
1780 "le Chrome','Google Chrome','google_chrome',NULL,NULL,NULL,NULL);"
1781 "INSERT INTO 'metas' VALUES(8,664,664,1048576,0,"
1782 META_PROTO_TIMES_VALS(8) ",'s_ID_8','s_ID_7','s_ID_7','r','r',0,0,0,1"
1783 ",1,0,'Bookmarks','Bookmarks','google_chrome_bookmarks',NULL,X'C28810"
1784 "00',X'C2881000',NULL);"
1785 "INSERT INTO 'metas' VALUES(9,665,665,1048576,1,"
1786 META_PROTO_TIMES_VALS(9) ",'s_ID_9','s_ID_8','s_ID_8','r','s_ID_10',0"
1787 ",0,0,1,1,0,'Bookmark Bar','Bookmark Bar','bookmark_bar',NULL,X'C2881"
1788 "000',X'C2881000',NULL);"
1789 "INSERT INTO 'metas' VALUES(10,666,666,2097152,2,"
1790 META_PROTO_TIMES_VALS(10) ",'s_ID_10','s_ID_8','s_ID_8','s_ID_9','r',"
1791 "0,0,0,1,1,0,'Other Bookmarks','Other Bookmarks','other_bookmarks',NU"
1792 "LL,X'C2881000',X'C2881000',NULL);"
1793 "INSERT INTO 'metas' VALUES(11,683,683,-1048576,8,"
1794 META_PROTO_TIMES_VALS(11) ",'s_ID_11','s_ID_6','s_ID_6','r','s_ID_13'"
1795 ",0,0,0,0,0,0,'Home (The Chromium Projects)','Home (The Chromium Proj"
1796 "ects)',NULL,NULL,X'C28810220A18687474703A2F2F6465762E6368726F6D69756"
1797 "D2E6F72672F1206414741545741',X'C28810290A1D687474703A2F2F6465762E636"
1798 "8726F6D69756D2E6F72672F6F7468657212084146414756415346',NULL);"
1799 "INSERT INTO 'metas' VALUES(12,685,685,0,9,"
1800 META_PROTO_TIMES_VALS(12) ",'s_ID_12','s_ID_6','s_ID_6','s_ID_13','s_"
1801 "ID_14',0,0,0,1,1,0,'Extra Bookmarks','Extra Bookmarks',NULL,NULL,X'C"
1802 "2881000',X'C2881000',NULL);"
1803 "INSERT INTO 'metas' VALUES(13,687,687,-917504,10,"
1804 META_PROTO_TIMES_VALS(13) ",'s_ID_13','s_ID_6','s_ID_6','s_ID_11','s_"
1805 "ID_12',0,0,0,0,0,0,'ICANN | Internet Corporation for Assigned Names "
1806 "and Numbers','ICANN | Internet Corporation for Assigned Names and Nu"
1807 "mbers',NULL,NULL,X'C28810240A15687474703A2F2F7777772E6963616E6E2E636"
1808 "F6D2F120B504E474158463041414646',X'C28810200A15687474703A2F2F7777772"
1809 "E6963616E6E2E636F6D2F120744414146415346',NULL);"
1810 "INSERT INTO 'metas' VALUES(14,692,692,1048576,11,"
1811 META_PROTO_TIMES_VALS(14) ",'s_ID_14','s_ID_6','s_ID_6','s_ID_12','r'"
1812 ",0,0,0,0,0,0,'The WebKit Open Source Project','The WebKit Open Sourc"
1813 "e Project',NULL,NULL,X'C288101A0A12687474703A2F2F7765626B69742E6F726"
1814 "72F1204504E4758',X'C288101C0A13687474703A2F2F7765626B69742E6F72672F7"
1815 "81205504E473259',NULL);"
1816 "CREATE TABLE 'share_info' (id TEXT primary key, name TEXT, store_birthda"
1817 "y TEXT, db_create_version TEXT, db_create_time INT, next_id INT defa"
1818 "ult -2, cache_guid TEXT , notification_state BLOB, bag_of_chips "
1819 "blob);"
1820 "INSERT INTO 'share_info' VALUES('nick@chromium.org','nick@chromium.org',"
1821 "'c27e9f59-08ca-46f8-b0cc-f16a2ed778bb','Unknown',1263522064,"
1822 "-131078,'9010788312004066376x-6609234393368420856x',NULL, NULL);"
1823 ));
1824 ASSERT_TRUE(connection->CommitTransaction());
1825 }
1826
1728 TEST_F(DirectoryBackingStoreTest, MigrateVersion67To68) { 1827 TEST_F(DirectoryBackingStoreTest, MigrateVersion67To68) {
1729 sql::Connection connection; 1828 sql::Connection connection;
1730 ASSERT_TRUE(connection.OpenInMemory()); 1829 ASSERT_TRUE(connection.OpenInMemory());
1731 1830
1732 SetUpVersion67Database(&connection); 1831 SetUpVersion67Database(&connection);
1733 1832
1734 // Columns existing before version 67. 1833 // Columns existing before version 67.
1735 ASSERT_TRUE(connection.DoesColumnExist("metas", "name")); 1834 ASSERT_TRUE(connection.DoesColumnExist("metas", "name"));
1736 ASSERT_TRUE(connection.DoesColumnExist("metas", "unsanitized_name")); 1835 ASSERT_TRUE(connection.DoesColumnExist("metas", "unsanitized_name"));
1737 ASSERT_TRUE(connection.DoesColumnExist("metas", "server_name")); 1836 ASSERT_TRUE(connection.DoesColumnExist("metas", "server_name"));
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
2072 Directory::KernelLoadInfo load_info; 2171 Directory::KernelLoadInfo load_info;
2073 2172
2074 ASSERT_TRUE(dbs->Load(&entry_bucket, &load_info)); 2173 ASSERT_TRUE(dbs->Load(&entry_bucket, &load_info));
2075 // Check that the initial value is the serialization of an empty ChipBag. 2174 // Check that the initial value is the serialization of an empty ChipBag.
2076 sync_pb::ChipBag chip_bag; 2175 sync_pb::ChipBag chip_bag;
2077 std::string serialized_chip_bag; 2176 std::string serialized_chip_bag;
2078 ASSERT_TRUE(chip_bag.SerializeToString(&serialized_chip_bag)); 2177 ASSERT_TRUE(chip_bag.SerializeToString(&serialized_chip_bag));
2079 EXPECT_EQ(serialized_chip_bag, load_info.kernel_info.bag_of_chips); 2178 EXPECT_EQ(serialized_chip_bag, load_info.kernel_info.bag_of_chips);
2080 } 2179 }
2081 2180
2181 TEST_F(DirectoryBackingStoreTest, MigrateVersion80To81) {
2182 sql::Connection connection;
2183 ASSERT_TRUE(connection.OpenInMemory());
2184 SetUpVersion80Database(&connection);
2185
2186 sql::Statement s(connection.GetUniqueStatement(
2187 "SELECT metahandle, server_position_in_parent "
2188 "FROM metas WHERE unique_server_tag = 'google_chrome'"));
2189 ASSERT_TRUE(s.Step());
2190 ASSERT_EQ(sql::COLUMN_TYPE_INTEGER, s.ColumnType(1));
2191
2192 scoped_ptr<TestDirectoryBackingStore> dbs(
2193 new TestDirectoryBackingStore(GetUsername(), &connection));
2194 ASSERT_TRUE(dbs->MigrateVersion80To81());
2195
2196 // First test that a normal ordinal value is preserved correctly.
2197 sql::Statement new_s(connection.GetUniqueStatement(
2198 "SELECT metahandle, server_position_in_parent "
2199 "FROM metas WHERE unique_server_tag = 'google_chrome'"));
2200 ASSERT_TRUE(new_s.Step());
2201 ASSERT_EQ(sql::COLUMN_TYPE_BLOB, new_s.ColumnType(1));
2202
2203 std::string expected_ordinal = Int64ToNodeOrdinal(1048576).ToInternalValue();
2204 std::string actual_ordinal;
2205 new_s.ColumnBlobAsString(1, &actual_ordinal);
2206 ASSERT_EQ(expected_ordinal, actual_ordinal);
2207
2208 // Next, test that null characters in the
2209 // server_position_in_parent_field are handled correctly
2210 expected_ordinal = "This\0should\0read\0completely";
2211 sql::Statement s2(connection.GetUniqueStatement(
2212 "UPDATE metas SET server_position_in_parent = ?"
2213 "WHERE metahandle = ?"));
2214 s2.BindBlob(0, expected_ordinal.data(), expected_ordinal.length());
2215 s2.BindInt64(1, new_s.ColumnInt64(0));
2216 ASSERT_TRUE(s2.Run());
2217
2218 new_s.Reset(true);
2219 ASSERT_TRUE(new_s.Step());
2220 new_s.ColumnBlobAsString(1, &actual_ordinal);
2221 ASSERT_EQ(expected_ordinal, actual_ordinal);
2222 }
2223
2082 TEST_P(MigrationTest, ToCurrentVersion) { 2224 TEST_P(MigrationTest, ToCurrentVersion) {
2083 sql::Connection connection; 2225 sql::Connection connection;
2084 ASSERT_TRUE(connection.OpenInMemory()); 2226 ASSERT_TRUE(connection.OpenInMemory());
2085 switch (GetParam()) { 2227 switch (GetParam()) {
2086 case 67: 2228 case 67:
2087 SetUpVersion67Database(&connection); 2229 SetUpVersion67Database(&connection);
2088 break; 2230 break;
2089 case 68: 2231 case 68:
2090 SetUpVersion68Database(&connection); 2232 SetUpVersion68Database(&connection);
2091 break; 2233 break;
(...skipping 23 matching lines...) Expand all
2115 break; 2257 break;
2116 case 77: 2258 case 77:
2117 SetUpVersion77Database(&connection); 2259 SetUpVersion77Database(&connection);
2118 break; 2260 break;
2119 case 78: 2261 case 78:
2120 SetUpVersion78Database(&connection); 2262 SetUpVersion78Database(&connection);
2121 break; 2263 break;
2122 case 79: 2264 case 79:
2123 SetUpVersion79Database(&connection); 2265 SetUpVersion79Database(&connection);
2124 break; 2266 break;
2267 case 80:
2268 SetUpVersion80Database(&connection);
2269 break;
2125 default: 2270 default:
2126 // If you see this error, it may mean that you've increased the 2271 // If you see this error, it may mean that you've increased the
2127 // database version number but you haven't finished adding unit tests 2272 // database version number but you haven't finished adding unit tests
2128 // for the database migration code. You need to need to supply a 2273 // for the database migration code. You need to need to supply a
2129 // SetUpVersionXXDatabase function with a dump of the test database 2274 // SetUpVersionXXDatabase function with a dump of the test database
2130 // at the old schema. Here's one way to do that: 2275 // at the old schema. Here's one way to do that:
2131 // 1. Start on a clean tree (with none of your pending schema changes). 2276 // 1. Start on a clean tree (with none of your pending schema changes).
2132 // 2. Set a breakpoint in this function and run the unit test. 2277 // 2. Set a breakpoint in this function and run the unit test.
2133 // 3. Allow this test to run to completion (step out of the call), 2278 // 3. Allow this test to run to completion (step out of the call),
2134 // without allowing ~MigrationTest to execute. 2279 // without allowing ~MigrationTest to execute.
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
2452 const std::string& guid2 = TestDirectoryBackingStore::GenerateCacheGUID(); 2597 const std::string& guid2 = TestDirectoryBackingStore::GenerateCacheGUID();
2453 EXPECT_EQ(24U, guid1.size()); 2598 EXPECT_EQ(24U, guid1.size());
2454 EXPECT_EQ(24U, guid2.size()); 2599 EXPECT_EQ(24U, guid2.size());
2455 // In theory this test can fail, but it won't before the universe 2600 // In theory this test can fail, but it won't before the universe
2456 // dies of heat death. 2601 // dies of heat death.
2457 EXPECT_NE(guid1, guid2); 2602 EXPECT_NE(guid1, guid2);
2458 } 2603 }
2459 2604
2460 } // namespace syncable 2605 } // namespace syncable
2461 } // namespace syncer 2606 } // namespace syncer
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698