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

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

Issue 11636006: WIP: The Bookmark Position Megapatch (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Various updates, including switch suffix to unique_client_tag style Created 8 years 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
« no previous file with comments | « sync/syncable/directory_backing_store.cc ('k') | sync/syncable/entry.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 void SetUpVersion76Database(sql::Connection* connection); 63 void SetUpVersion76Database(sql::Connection* connection);
64 void SetUpVersion77Database(sql::Connection* connection); 64 void SetUpVersion77Database(sql::Connection* connection);
65 void SetUpVersion78Database(sql::Connection* connection); 65 void SetUpVersion78Database(sql::Connection* connection);
66 void SetUpVersion79Database(sql::Connection* connection); 66 void SetUpVersion79Database(sql::Connection* connection);
67 void SetUpVersion80Database(sql::Connection* connection); 67 void SetUpVersion80Database(sql::Connection* connection);
68 void SetUpVersion81Database(sql::Connection* connection); 68 void SetUpVersion81Database(sql::Connection* connection);
69 void SetUpVersion82Database(sql::Connection* connection); 69 void SetUpVersion82Database(sql::Connection* connection);
70 void SetUpVersion83Database(sql::Connection* connection); 70 void SetUpVersion83Database(sql::Connection* connection);
71 void SetUpVersion84Database(sql::Connection* connection); 71 void SetUpVersion84Database(sql::Connection* connection);
72 void SetUpVersion85Database(sql::Connection* connection); 72 void SetUpVersion85Database(sql::Connection* connection);
73 void SetUpVersion86Database(sql::Connection* connection);
73 74
74 void SetUpCurrentDatabaseAndCheckVersion(sql::Connection* connection) { 75 void SetUpCurrentDatabaseAndCheckVersion(sql::Connection* connection) {
75 SetUpVersion85Database(connection); // Prepopulates data. 76 SetUpVersion86Database(connection); // Prepopulates data.
76 scoped_ptr<TestDirectoryBackingStore> dbs( 77 scoped_ptr<TestDirectoryBackingStore> dbs(
77 new TestDirectoryBackingStore(GetUsername(), connection)); 78 new TestDirectoryBackingStore(GetUsername(), connection));
79 ASSERT_EQ(kCurrentDBVersion, dbs->GetVersion());
78 80
79 ASSERT_TRUE(LoadAndIgnoreReturnedData(dbs.get())); 81 ASSERT_TRUE(LoadAndIgnoreReturnedData(dbs.get()));
80 ASSERT_FALSE(dbs->needs_column_refresh_); 82 ASSERT_FALSE(dbs->needs_column_refresh_);
81 ASSERT_EQ(kCurrentDBVersion, dbs->GetVersion());
82 } 83 }
83 84
84 private: 85 private:
85 base::ScopedTempDir temp_dir_; 86 base::ScopedTempDir temp_dir_;
86 }; 87 };
87 88
88 class DirectoryBackingStoreTest : public MigrationTest {}; 89 class DirectoryBackingStoreTest : public MigrationTest {};
89 90
90 #if defined(OS_WIN) 91 #if defined(OS_WIN)
91 92
(...skipping 2325 matching lines...) Expand 10 before | Expand all | Expand 10 after
2417 for (int i = 0; i < V80_ROW_COUNT; i++) { 2418 for (int i = 0; i < V80_ROW_COUNT; i++) {
2418 sql::Statement s(connection->GetUniqueStatement(insert_stmts[i])); 2419 sql::Statement s(connection->GetUniqueStatement(insert_stmts[i]));
2419 std::string ord = V81_Ordinal(i); 2420 std::string ord = V81_Ordinal(i);
2420 s.BindBlob(0, ord.data(), ord.length()); 2421 s.BindBlob(0, ord.data(), ord.length());
2421 ASSERT_TRUE(s.Run()); 2422 ASSERT_TRUE(s.Run());
2422 s.Reset(true); 2423 s.Reset(true);
2423 } 2424 }
2424 ASSERT_TRUE(connection->CommitTransaction()); 2425 ASSERT_TRUE(connection->CommitTransaction());
2425 } 2426 }
2426 2427
2428 void MigrationTest::SetUpVersion86Database(sql::Connection* connection) {
2429 ASSERT_TRUE(connection->is_open());
2430 ASSERT_TRUE(connection->BeginTransaction());
2431 ASSERT_TRUE(connection->Execute(
2432 "CREATE TABLE share_version (id VARCHAR(128) primary key, data INT);"
2433 "INSERT INTO 'share_version' VALUES('nick@chromium.org',86);"
2434 "CREATE TABLE models (model_id BLOB primary key, progress_marker BLOB,"
2435 " transaction_version BIGINT default 0);"
2436 "INSERT INTO 'models' VALUES(X'C2881000',X'0888810218B605',1);"
2437 "CREATE TABLE 'metas'(metahandle bigint primary key ON CONFLICT FAIL,b"
2438 "ase_version bigint default -1,server_version bigint default 0,local_e"
2439 "xternal_id bigint default 0,transaction_version bigint default 0,mtim"
2440 "e bigint default 0,server_mtime bigint default 0,ctime bigint default"
2441 " 0,server_ctime bigint default 0,id varchar(255) default 'r',parent_i"
2442 "d varchar(255) default 'r',server_parent_id varchar(255) default 'r',"
2443 "is_unsynced bit default 0,is_unapplied_update bit default 0,is_del bi"
2444 "t default 0,is_dir bit default 0,server_is_dir bit default 0,server_i"
2445 "s_del bit default 0,non_unique_name varchar,server_non_unique_name va"
2446 "rchar(255),unique_server_tag varchar,unique_client_tag varchar,specif"
2447 "ics blob,server_specifics blob,base_server_specifics blob,server_uniq"
2448 "ue_position blob,unique_position blob,unique_bookmark_tag blob);"
2449 "INSERT INTO 'metas' VALUES(1,-1,0,0,0,1263522064000,1263522064000,126"
2450 "3522064000,1263522064000,'r','r','r',0,0,0,1,0,0,NULL,NULL,NULL,NULL,"
2451 "X'',X'',NULL,X'',X'',X'');"
2452 "INSERT INTO 'metas' VALUES(6,694,694,6,0,1260924017000,1260924017000,"
2453 "1260924017000,1260924017000,'s_ID_6','s_ID_9','s_ID_9',0,0,0,1,1,0,'T"
2454 "he Internet','The Internet',NULL,NULL,X'C2881000',X'C2881000',NULL,X'"
2455 "',X'',X'');"
2456 "INSERT INTO 'metas' VALUES(7,663,663,0,0,1253212875000,1253212875000,"
2457 "1253212875000,1253212875000,'s_ID_7','r','r',0,0,0,1,1,0,'Google Chro"
2458 "me','Google Chrome','google_chrome',NULL,NULL,NULL,NULL,X'',X'',X'');"
2459 "INSERT INTO 'metas' VALUES(8,664,664,0,0,1253212875000,1253212875000,"
2460 "1253212875000,1253212875000,'s_ID_8','s_ID_7','s_ID_7',0,0,0,1,1,0,'B"
2461 "ookmarks','Bookmarks','google_chrome_bookmarks',NULL,X'C2881000',X'C2"
2462 "881000',NULL,X'',X'',X'');"
2463 "INSERT INTO 'metas' VALUES(9,665,665,1,0,1253212875000,1253212875000,"
2464 "1253212875000,1253212875000,'s_ID_9','s_ID_8','s_ID_8',0,0,0,1,1,0,'B"
2465 "ookmark Bar','Bookmark Bar','bookmark_bar',NULL,X'C2881000',X'C288100"
2466 "0',NULL,X'',X'',X'');"
2467 "INSERT INTO 'metas' VALUES(10,666,666,2,0,1253212875000,1253212875000"
2468 ",1253212875000,1253212875000,'s_ID_10','s_ID_8','s_ID_8',0,0,0,1,1,0,"
2469 "'Other Bookmarks','Other Bookmarks','other_bookmarks',NULL,X'C2881000"
2470 "',X'C2881000',NULL,X'',X'',X'');"
2471 "INSERT INTO 'metas' VALUES(11,683,683,8,0,1263522094000,1263522094000"
2472 ",1263522094000,1263522094000,'s_ID_11','s_ID_6','s_ID_6',0,0,0,0,0,0,"
2473 "'Home (The Chromium Projects)','Home (The Chromium Projects)',NULL,NU"
2474 "LL,X'C28810220A18687474703A2F2F6465762E6368726F6D69756D2E6F72672F1206"
2475 "414741545741',X'C28810290A1D687474703A2F2F6465762E6368726F6D69756D2E6"
2476 "F72672F6F7468657212084146414756415346',NULL,X'',X'',X'');"
2477 "INSERT INTO 'metas' VALUES(12,685,685,9,0,1263522151000,1263522151000"
2478 ",1263522151000,1263522151000,'s_ID_12','s_ID_6','s_ID_6',0,0,0,1,1,0,"
2479 "'Extra Bookmarks','Extra Bookmarks',NULL,NULL,X'C2881000',X'C2881000'"
2480 ",NULL,X'',X'',X'');"
2481 "INSERT INTO 'metas' VALUES(13,687,687,10,0,1263522198000,126352219800"
2482 "0,1263522198000,1263522198000,'s_ID_13','s_ID_6','s_ID_6',0,0,0,0,0,0"
2483 ",'ICANN | Internet Corporation for Assigned Names and Numbers','ICANN"
2484 " | Internet Corporation for Assigned Names and Numbers',NULL,NULL,X'C"
2485 "28810240A15687474703A2F2F7777772E6963616E6E2E636F6D2F120B504E47415846"
2486 "3041414646',X'C28810200A15687474703A2F2F7777772E6963616E6E2E636F6D2F1"
2487 "20744414146415346',NULL,X'',X'',X'');"
2488 "INSERT INTO 'metas' VALUES(14,692,692,11,0,1263522238000,126352223800"
2489 "0,1263522238000,1263522238000,'s_ID_14','s_ID_6','s_ID_6',0,0,0,0,0,0"
2490 ",'The WebKit Open Source Project','The WebKit Open Source Project',NU"
2491 "LL,NULL,X'C288101A0A12687474703A2F2F7765626B69742E6F72672F1204504E475"
2492 "8',X'C288101C0A13687474703A2F2F7765626B69742E6F72672F781205504E473259"
2493 "',NULL,X'',X'',X'');"
2494 "CREATE TABLE deleted_metas (metahandle bigint primary key ON CONFLICT"
2495 " FAIL,base_version bigint default -1,server_version bigint default 0,"
2496 "local_external_id bigint default 0,transaction_version bigint default"
2497 " 0,mtime bigint default 0,server_mtime bigint default 0,ctime bigint "
2498 "default 0,server_ctime bigint default 0,id varchar(255) default 'r',p"
2499 "arent_id varchar(255) default 'r',server_parent_id varchar(255) defau"
2500 "lt 'r',is_unsynced bit default 0,is_unapplied_update bit default 0,is"
2501 "_del bit default 0,is_dir bit default 0,server_is_dir bit default 0,s"
2502 "erver_is_del bit default 0,non_unique_name varchar,server_non_unique_"
2503 "name varchar(255),unique_server_tag varchar,unique_client_tag varchar"
2504 ",specifics blob,server_specifics blob,base_server_specifics blob,serv"
2505 "er_unique_position blob,unique_position blob,unique_bookmark_tag blob"
2506 ");"
2507 "CREATE TABLE 'share_info' (id TEXT primary key, name TEXT, store_birt"
2508 "hday TEXT, db_create_version TEXT, db_create_time INT, next_id INT de"
2509 "fault -2, cache_guid TEXT, notification_state BLOB, bag_of_chips BLOB"
2510 ");"
2511 "INSERT INTO 'share_info' VALUES('nick@chromium.org','nick@chromium.or"
2512 "g','c27e9f59-08ca-46f8-b0cc-f16a2ed778bb','Unknown',1263522064,-13107"
2513 "8,'9010788312004066376x-6609234393368420856x',NULL,NULL);"));
2514 ASSERT_TRUE(connection->CommitTransaction());
2515 }
2516
2427 TEST_F(DirectoryBackingStoreTest, MigrateVersion67To68) { 2517 TEST_F(DirectoryBackingStoreTest, MigrateVersion67To68) {
2428 sql::Connection connection; 2518 sql::Connection connection;
2429 ASSERT_TRUE(connection.OpenInMemory()); 2519 ASSERT_TRUE(connection.OpenInMemory());
2430 2520
2431 SetUpVersion67Database(&connection); 2521 SetUpVersion67Database(&connection);
2432 2522
2433 // Columns existing before version 67. 2523 // Columns existing before version 67.
2434 ASSERT_TRUE(connection.DoesColumnExist("metas", "name")); 2524 ASSERT_TRUE(connection.DoesColumnExist("metas", "name"));
2435 ASSERT_TRUE(connection.DoesColumnExist("metas", "unsanitized_name")); 2525 ASSERT_TRUE(connection.DoesColumnExist("metas", "unsanitized_name"));
2436 ASSERT_TRUE(connection.DoesColumnExist("metas", "server_name")); 2526 ASSERT_TRUE(connection.DoesColumnExist("metas", "server_name"));
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
2801 "FROM metas WHERE unique_server_tag = 'google_chrome'")); 2891 "FROM metas WHERE unique_server_tag = 'google_chrome'"));
2802 ASSERT_TRUE(new_s.Step()); 2892 ASSERT_TRUE(new_s.Step());
2803 ASSERT_EQ(sql::COLUMN_TYPE_BLOB, new_s.ColumnType(1)); 2893 ASSERT_EQ(sql::COLUMN_TYPE_BLOB, new_s.ColumnType(1));
2804 2894
2805 std::string expected_ordinal = Int64ToNodeOrdinal(1048576).ToInternalValue(); 2895 std::string expected_ordinal = Int64ToNodeOrdinal(1048576).ToInternalValue();
2806 std::string actual_ordinal; 2896 std::string actual_ordinal;
2807 new_s.ColumnBlobAsString(1, &actual_ordinal); 2897 new_s.ColumnBlobAsString(1, &actual_ordinal);
2808 ASSERT_EQ(expected_ordinal, actual_ordinal); 2898 ASSERT_EQ(expected_ordinal, actual_ordinal);
2809 } 2899 }
2810 2900
2811 TEST_F(DirectoryBackingStoreTest, DetectInvalidOrdinal) { 2901 TEST_F(DirectoryBackingStoreTest, DetectInvalidPosition) {
2812 sql::Connection connection; 2902 sql::Connection connection;
2813 ASSERT_TRUE(connection.OpenInMemory()); 2903 ASSERT_TRUE(connection.OpenInMemory());
2814 SetUpVersion81Database(&connection); 2904 SetUpVersion86Database(&connection);
2815 2905
2816 scoped_ptr<TestDirectoryBackingStore> dbs( 2906 scoped_ptr<TestDirectoryBackingStore> dbs(
2817 new TestDirectoryBackingStore(GetUsername(), &connection)); 2907 new TestDirectoryBackingStore(GetUsername(), &connection));
2818 ASSERT_EQ(81, dbs->GetVersion()); 2908 ASSERT_EQ(86, dbs->GetVersion());
2819 2909
2820 // Insert row with bad ordinal. 2910 // Insert row with bad position.
2821 const int64 now = TimeToProtoTime(base::Time::Now());
2822 sql::Statement s(connection.GetUniqueStatement( 2911 sql::Statement s(connection.GetUniqueStatement(
2823 "INSERT INTO metas " 2912 "INSERT INTO metas "
2824 "( id, metahandle, is_dir, ctime, mtime, server_ordinal_in_parent) " 2913 "( id, metahandle, is_dir, ctime, mtime,"
2825 "VALUES( \"c-invalid\", 9999, 1, ?, ?, \" \")")); 2914 " unique_position, server_unique_position) "
2826 s.BindInt64(0, now); 2915 "VALUES('c-invalid', 9999, 1, 0, 0, 'BAD_POS', 'BAD_POS')"));
2827 s.BindInt64(1, now);
2828 ASSERT_TRUE(s.Run()); 2916 ASSERT_TRUE(s.Run());
2829 2917
2830 // Trying to unpack this entry should signal that the DB is corrupted. 2918 // Trying to unpack this entry should signal that the DB is corrupted.
2831 MetahandlesIndex entry_bucket; 2919 MetahandlesIndex entry_bucket;
2832 STLElementDeleter<MetahandlesIndex> deleter(&entry_bucket); 2920 STLElementDeleter<MetahandlesIndex> deleter(&entry_bucket);
2833 Directory::KernelLoadInfo kernel_load_info; 2921 Directory::KernelLoadInfo kernel_load_info;
2834 ASSERT_EQ(FAILED_DATABASE_CORRUPT, 2922 ASSERT_EQ(FAILED_DATABASE_CORRUPT,
2835 dbs->Load(&entry_bucket, &kernel_load_info)); 2923 dbs->Load(&entry_bucket, &kernel_load_info));
2836 } 2924 }
2837 2925
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
2885 SetUpVersion84Database(&connection); 2973 SetUpVersion84Database(&connection);
2886 ASSERT_TRUE(connection.DoesColumnExist("models", "initial_sync_ended")); 2974 ASSERT_TRUE(connection.DoesColumnExist("models", "initial_sync_ended"));
2887 2975
2888 scoped_ptr<TestDirectoryBackingStore> dbs( 2976 scoped_ptr<TestDirectoryBackingStore> dbs(
2889 new TestDirectoryBackingStore(GetUsername(), &connection)); 2977 new TestDirectoryBackingStore(GetUsername(), &connection));
2890 ASSERT_TRUE(dbs->MigrateVersion84To85()); 2978 ASSERT_TRUE(dbs->MigrateVersion84To85());
2891 ASSERT_EQ(85, dbs->GetVersion()); 2979 ASSERT_EQ(85, dbs->GetVersion());
2892 ASSERT_FALSE(connection.DoesColumnExist("models", "initial_sync_ended")); 2980 ASSERT_FALSE(connection.DoesColumnExist("models", "initial_sync_ended"));
2893 } 2981 }
2894 2982
2983 TEST_F(DirectoryBackingStoreTest, MigrateVersion85To86) {
2984 sql::Connection connection;
2985 ASSERT_TRUE(connection.OpenInMemory());
2986 SetUpVersion85Database(&connection);
2987 EXPECT_TRUE(connection.DoesColumnExist("metas", "next_id"));
2988 EXPECT_TRUE(connection.DoesColumnExist("metas", "prev_id"));
2989 EXPECT_TRUE(connection.DoesColumnExist("metas", "server_ordinal_in_parent"));
2990 EXPECT_FALSE(connection.DoesColumnExist("metas", "unique_position"));
2991 EXPECT_FALSE(connection.DoesColumnExist("metas", "server_unique_position"));
2992 EXPECT_FALSE(connection.DoesColumnExist("metas", "unique_bookmark_tag"));
2993
2994 scoped_ptr<TestDirectoryBackingStore> dbs(
2995 new TestDirectoryBackingStore(GetUsername(), &connection));
2996 ASSERT_TRUE(dbs->MigrateVersion85To86());
2997 EXPECT_EQ(86, dbs->GetVersion());
2998 EXPECT_TRUE(connection.DoesColumnExist("metas", "unique_position"));
2999 EXPECT_TRUE(connection.DoesColumnExist("metas", "server_unique_position"));
3000 EXPECT_TRUE(connection.DoesColumnExist("metas", "unique_bookmark_tag"));
3001 ASSERT_TRUE(dbs->needs_column_refresh_);
3002 ASSERT_TRUE(dbs->RefreshColumns());
3003 EXPECT_FALSE(connection.DoesColumnExist("metas", "next_id"));
3004 EXPECT_FALSE(connection.DoesColumnExist("metas", "prev_id"));
3005 EXPECT_FALSE(connection.DoesColumnExist("metas", "server_ordinal_in_parent"));
3006 }
3007
2895 TEST_P(MigrationTest, ToCurrentVersion) { 3008 TEST_P(MigrationTest, ToCurrentVersion) {
2896 sql::Connection connection; 3009 sql::Connection connection;
2897 ASSERT_TRUE(connection.OpenInMemory()); 3010 ASSERT_TRUE(connection.OpenInMemory());
2898 switch (GetParam()) { 3011 switch (GetParam()) {
2899 case 67: 3012 case 67:
2900 SetUpVersion67Database(&connection); 3013 SetUpVersion67Database(&connection);
2901 break; 3014 break;
2902 case 68: 3015 case 68:
2903 SetUpVersion68Database(&connection); 3016 SetUpVersion68Database(&connection);
2904 break; 3017 break;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
2943 break; 3056 break;
2944 case 82: 3057 case 82:
2945 SetUpVersion82Database(&connection); 3058 SetUpVersion82Database(&connection);
2946 break; 3059 break;
2947 case 83: 3060 case 83:
2948 SetUpVersion83Database(&connection); 3061 SetUpVersion83Database(&connection);
2949 break; 3062 break;
2950 case 84: 3063 case 84:
2951 SetUpVersion84Database(&connection); 3064 SetUpVersion84Database(&connection);
2952 break; 3065 break;
3066 case 85:
3067 SetUpVersion85Database(&connection);
3068 break;
3069 case 86:
3070 SetUpVersion86Database(&connection);
3071 break;
2953 default: 3072 default:
2954 // If you see this error, it may mean that you've increased the 3073 // If you see this error, it may mean that you've increased the
2955 // database version number but you haven't finished adding unit tests 3074 // database version number but you haven't finished adding unit tests
2956 // for the database migration code. You need to need to supply a 3075 // for the database migration code. You need to need to supply a
2957 // SetUpVersionXXDatabase function with a dump of the test database 3076 // SetUpVersionXXDatabase function with a dump of the test database
2958 // at the old schema. Here's one way to do that: 3077 // at the old schema. Here's one way to do that:
2959 // 1. Start on a clean tree (with none of your pending schema changes). 3078 // 1. Start on a clean tree (with none of your pending schema changes).
2960 // 2. Set a breakpoint in this function and run the unit test. 3079 // 2. Set a breakpoint in this function and run the unit test.
2961 // 3. Allow this test to run to completion (step out of the call), 3080 // 3. Allow this test to run to completion (step out of the call),
2962 // without allowing ~MigrationTest to execute. 3081 // without allowing ~MigrationTest to execute.
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
3156 ASSERT_TRUE(++it != index.end()); 3275 ASSERT_TRUE(++it != index.end());
3157 ASSERT_EQ(13, (*it)->ref(META_HANDLE)); 3276 ASSERT_EQ(13, (*it)->ref(META_HANDLE));
3158 3277
3159 ASSERT_TRUE(++it != index.end()); 3278 ASSERT_TRUE(++it != index.end());
3160 ASSERT_EQ(14, (*it)->ref(META_HANDLE)); 3279 ASSERT_EQ(14, (*it)->ref(META_HANDLE));
3161 3280
3162 ASSERT_TRUE(++it == index.end()); 3281 ASSERT_TRUE(++it == index.end());
3163 } 3282 }
3164 3283
3165 INSTANTIATE_TEST_CASE_P(DirectoryBackingStore, MigrationTest, 3284 INSTANTIATE_TEST_CASE_P(DirectoryBackingStore, MigrationTest,
3166 testing::Range(67, kCurrentDBVersion)); 3285 testing::Range(67, kCurrentDBVersion+1));
3167 3286
3168 TEST_F(DirectoryBackingStoreTest, ModelTypeIds) { 3287 TEST_F(DirectoryBackingStoreTest, ModelTypeIds) {
3169 for (int i = FIRST_REAL_MODEL_TYPE; i < MODEL_TYPE_COUNT; ++i) { 3288 for (int i = FIRST_REAL_MODEL_TYPE; i < MODEL_TYPE_COUNT; ++i) {
3170 std::string model_id = 3289 std::string model_id =
3171 TestDirectoryBackingStore::ModelTypeEnumToModelId(ModelTypeFromInt(i)); 3290 TestDirectoryBackingStore::ModelTypeEnumToModelId(ModelTypeFromInt(i));
3172 EXPECT_EQ(i, 3291 EXPECT_EQ(i,
3173 TestDirectoryBackingStore::ModelIdToModelTypeEnum(model_id.data(), 3292 TestDirectoryBackingStore::ModelIdToModelTypeEnum(model_id.data(),
3174 model_id.size())); 3293 model_id.size()));
3175 } 3294 }
3176 } 3295 }
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
3292 const std::string& guid2 = TestDirectoryBackingStore::GenerateCacheGUID(); 3411 const std::string& guid2 = TestDirectoryBackingStore::GenerateCacheGUID();
3293 EXPECT_EQ(24U, guid1.size()); 3412 EXPECT_EQ(24U, guid1.size());
3294 EXPECT_EQ(24U, guid2.size()); 3413 EXPECT_EQ(24U, guid2.size());
3295 // In theory this test can fail, but it won't before the universe 3414 // In theory this test can fail, but it won't before the universe
3296 // dies of heat death. 3415 // dies of heat death.
3297 EXPECT_NE(guid1, guid2); 3416 EXPECT_NE(guid1, guid2);
3298 } 3417 }
3299 3418
3300 } // namespace syncable 3419 } // namespace syncable
3301 } // namespace syncer 3420 } // namespace syncer
OLDNEW
« no previous file with comments | « sync/syncable/directory_backing_store.cc ('k') | sync/syncable/entry.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698