OLD | NEW |
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 Loading... |
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 Loading... |
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) { |
| 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, tr" |
| 2545 "ansaction_version BIGINT default 0);" |
| 2546 "INSERT INTO 'models' VALUES(X'C2881000',X'0888810218B605',1);" |
| 2547 "CREATE TABLE 'metas'(metahandle bigint primary key ON CONFLICT FAIL,base" |
| 2548 "_version bigint default -1,server_version bigint default 0,local_exte" |
| 2549 "rnal_id bigint default 0,transaction_version bigint default 0,mtime b" |
| 2550 "igint default 0,server_mtime bigint default 0,ctime bigint default 0," |
| 2551 "server_ctime bigint default 0,id varchar(255) default 'r',parent_id v" |
| 2552 "archar(255) default 'r',server_parent_id varchar(255) default 'r',is_" |
| 2553 "unsynced bit default 0,is_unapplied_update bit default 0,is_del bit d" |
| 2554 "efault 0,is_dir bit default 0,server_is_dir bit default 0,server_is_d" |
| 2555 "el bit default 0,non_unique_name varchar,server_non_unique_name varch" |
| 2556 "ar(255),unique_server_tag varchar,unique_client_tag varchar,unique_bo" |
| 2557 "okmark_tag varchar,specifics blob,server_specifics blob,base_server_s" |
| 2558 "pecifics blob,server_unique_position blob,unique_position blob,attach" |
| 2559 "ment_metadata blob);" |
| 2560 "INSERT INTO 'metas' VALUES(1,-1,0,0,0," |
| 2561 META_PROTO_TIMES_VALS(1) |
| 2562 ",'r','r','r',0,0,0,1,0,0,NULL,NULL,NULL,NULL,X''" |
| 2563 ",X'',X'',NULL,X'2200',X'2200',NULL);" |
| 2564 "INSERT INTO 'metas' VALUES(6,694,694,6,0," |
| 2565 META_PROTO_TIMES_VALS(6) |
| 2566 ",'s_ID_6','s_ID_9','s_ID_9',0,0,0,1,1,0,'The " |
| 2567 "Internet','The Internet',NULL,NULL,X'6754307476346749735A5734654D6532" |
| 2568 "73625336557753582F77673D',X'C2881000',X'C2881000',NULL,X'22247FFFFFFF" |
| 2569 "FFC000006754307476346749735A5734654D653273625336557753582F77673D',X'2" |
| 2570 "2247FFFFFFFFFC000006754307476346749735A5734654D653273625336557753582F" |
| 2571 "77673D',NULL);" |
| 2572 "INSERT INTO 'metas' VALUES(7,663,663,0,0," |
| 2573 META_PROTO_TIMES_VALS(7) |
| 2574 ",'s_ID_7','r','r',0,0,0,1,1,0,'Google Chrome'" |
| 2575 ",'Google Chrome','google_chrome',NULL,X'',NULL,NULL,NULL,X'2200',X'22" |
| 2576 "00',NULL);" |
| 2577 "INSERT INTO 'metas' VALUES(8,664,664,0,0," |
| 2578 META_PROTO_TIMES_VALS(8) |
| 2579 ",'s_ID_8','s_ID_7','s_ID_7',0,0,0,1,1,0,'Book" |
| 2580 "marks','Bookmarks','google_chrome_bookmarks',NULL,X'',X'C2881000',X'C" |
| 2581 "2881000',NULL,X'2200',X'2200',NULL);" |
| 2582 "INSERT INTO 'metas' VALUES(9,665,665,1,0," |
| 2583 META_PROTO_TIMES_VALS(9) |
| 2584 ",'s_ID_9','s_ID_8','s_ID_8',0,0,0,1,1,0,'Book" |
| 2585 "mark Bar','Bookmark Bar','bookmark_bar',NULL,X'',X'C2881000',X'C28810" |
| 2586 "00',NULL,X'2200',X'2200',NULL);" |
| 2587 "INSERT INTO 'metas' VALUES(10,666,666,2,0," |
| 2588 META_PROTO_TIMES_VALS(10) |
| 2589 ",'s_ID_10','s_ID_8','s_ID_8',0,0,0,1,1,0,'Ot" |
| 2590 "her Bookmarks','Other Bookmarks','other_bookmarks',NULL,X'',X'C288100" |
| 2591 "0',X'C2881000',NULL,X'2200',X'2200',NULL);" |
| 2592 "INSERT INTO 'metas' VALUES(11,683,683,8,0," |
| 2593 META_PROTO_TIMES_VALS(11) |
| 2594 ",'s_ID_11','s_ID_6','s_ID_6',0,0,0,0,0,0,'Ho" |
| 2595 "me (The Chromium Projects)','Home (The Chromium Projects)',NULL,NULL," |
| 2596 "X'50514C784A456D623579366267644237646A7A2B62314130346E493D',X'C288102" |
| 2597 "20A18687474703A2F2F6465762E6368726F6D69756D2E6F72672F1206414741545741" |
| 2598 "',X'C28810290A1D687474703A2F2F6465762E6368726F6D69756D2E6F72672F6F746" |
| 2599 "8657212084146414756415346',NULL,X'22247FFFFFFFFFF0000050514C784A456D6" |
| 2600 "23579366267644237646A7A2B62314130346E493D',X'22247FFFFFFFFFF000005051" |
| 2601 "4C784A456D623579366267644237646A7A2B62314130346E493D',NULL);" |
| 2602 "INSERT INTO 'metas' VALUES(12,685,685,9,0," |
| 2603 META_PROTO_TIMES_VALS(12) |
| 2604 ",'s_ID_12','s_ID_6','s_ID_6',0,0,0,1,1,0,'Ex" |
| 2605 "tra Bookmarks','Extra Bookmarks',NULL,NULL,X'7867626A704A646134635A6F" |
| 2606 "616C376A49513338734B46324837773D',X'C2881000',X'C2881000',NULL,X'2224" |
| 2607 "80000000000000007867626A704A646134635A6F616C376A49513338734B463248377" |
| 2608 "73D',X'222480000000000000007867626A704A646134635A6F616C376A4951333873" |
| 2609 "4B46324837773D',NULL);" |
| 2610 "INSERT INTO 'metas' VALUES(13,687,687,10,0," |
| 2611 META_PROTO_TIMES_VALS(13) |
| 2612 ",'s_ID_13','s_ID_6','s_ID_6',0,0,0,0,0,0,'I" |
| 2613 "CANN | Internet Corporation for Assigned Names and Numbers','ICANN | " |
| 2614 "Internet Corporation for Assigned Names and Numbers',NULL,NULL,X'3142" |
| 2615 "756B572F7741766956504179672B304A614A514B3452384A413D',X'C28810240A156" |
| 2616 "87474703A2F2F7777772E6963616E6E2E636F6D2F120B504E474158463041414646'," |
| 2617 "X'C28810200A15687474703A2F2F7777772E6963616E6E2E636F6D2F1207444141464" |
| 2618 "15346',NULL,X'22247FFFFFFFFFF200003142756B572F7741766956504179672B304" |
| 2619 "A614A514B3452384A413D',X'22247FFFFFFFFFF200003142756B572F774176695650" |
| 2620 "4179672B304A614A514B3452384A413D',NULL);" |
| 2621 "INSERT INTO 'metas' VALUES(14,692,692,11,0," |
| 2622 META_PROTO_TIMES_VALS(14) |
| 2623 ",'s_ID_14','s_ID_6','s_ID_6',0,0,0,0,0,0,'T" |
| 2624 "he WebKit Open Source Project','The WebKit Open Source Project',NULL," |
| 2625 "NULL,X'5A5678314E7976364579524D3177494F7236563159552F6E644C553D',X'C2" |
| 2626 "88101A0A12687474703A2F2F7765626B69742E6F72672F1204504E4758',X'C288101" |
| 2627 "C0A13687474703A2F2F7765626B69742E6F72672F781205504E473259',NULL,X'222" |
| 2628 "480000000001000005A5678314E7976364579524D3177494F7236563159552F6E644C" |
| 2629 "553D',X'222480000000001000005A5678314E7976364579524D3177494F723656315" |
| 2630 "9552F6E644C553D',NULL);" |
| 2631 "CREATE TABLE deleted_metas (metahandle bigint primary key ON CONFLICT FA" |
| 2632 "IL,base_version bigint default -1,server_version bigint default 0,loc" |
| 2633 "al_external_id bigint default 0,transaction_version bigint default 0," |
| 2634 "mtime bigint default 0,server_mtime bigint default 0,ctime bigint def" |
| 2635 "ault 0,server_ctime bigint default 0,id varchar(255) default 'r',pare" |
| 2636 "nt_id varchar(255) default 'r',server_parent_id varchar(255) default " |
| 2637 "'r',is_unsynced bit default 0,is_unapplied_update bit default 0,is_de" |
| 2638 "l bit default 0,is_dir bit default 0,server_is_dir bit default 0,serv" |
| 2639 "er_is_del bit default 0,non_unique_name varchar,server_non_unique_nam" |
| 2640 "e varchar(255),unique_server_tag varchar,unique_client_tag varchar,un" |
| 2641 "ique_bookmark_tag varchar,specifics blob,server_specifics blob,base_s" |
| 2642 "erver_specifics blob,server_unique_position blob,unique_position blob" |
| 2643 ",attachment_metadata blob);" |
| 2644 "CREATE TABLE 'share_info' (id TEXT primary key, name TEXT, store_birthda" |
| 2645 "y TEXT, db_create_version TEXT, db_create_time INT, next_id INT defau" |
| 2646 "lt -2, cache_guid TEXT, notification_state BLOB, bag_of_chips BLOB);" |
| 2647 "INSERT INTO 'share_info' VALUES('nick@chromium.org','nick@chromium.org'," |
| 2648 "'c27e9f59-08ca-46f8-b0cc-f16a2ed778bb','Unknown',1263522064,-131078,'" |
| 2649 "9010788312004066376x-6609234393368420856x',NULL,NULL);")); |
| 2650 ASSERT_TRUE(connection->CommitTransaction()); |
| 2651 } |
| 2652 |
2537 TEST_F(DirectoryBackingStoreTest, MigrateVersion67To68) { | 2653 TEST_F(DirectoryBackingStoreTest, MigrateVersion67To68) { |
2538 sql::Connection connection; | 2654 sql::Connection connection; |
2539 ASSERT_TRUE(connection.OpenInMemory()); | 2655 ASSERT_TRUE(connection.OpenInMemory()); |
2540 | 2656 |
2541 SetUpVersion67Database(&connection); | 2657 SetUpVersion67Database(&connection); |
2542 | 2658 |
2543 // Columns existing before version 67. | 2659 // Columns existing before version 67. |
2544 ASSERT_TRUE(connection.DoesColumnExist("metas", "name")); | 2660 ASSERT_TRUE(connection.DoesColumnExist("metas", "name")); |
2545 ASSERT_TRUE(connection.DoesColumnExist("metas", "unsanitized_name")); | 2661 ASSERT_TRUE(connection.DoesColumnExist("metas", "unsanitized_name")); |
2546 ASSERT_TRUE(connection.DoesColumnExist("metas", "server_name")); | 2662 ASSERT_TRUE(connection.DoesColumnExist("metas", "server_name")); |
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2991 scoped_ptr<TestDirectoryBackingStore> dbs( | 3107 scoped_ptr<TestDirectoryBackingStore> dbs( |
2992 new TestDirectoryBackingStore(GetUsername(), &connection)); | 3108 new TestDirectoryBackingStore(GetUsername(), &connection)); |
2993 ASSERT_TRUE(dbs->MigrateVersion85To86()); | 3109 ASSERT_TRUE(dbs->MigrateVersion85To86()); |
2994 EXPECT_EQ(86, dbs->GetVersion()); | 3110 EXPECT_EQ(86, dbs->GetVersion()); |
2995 EXPECT_TRUE(connection.DoesColumnExist("metas", "unique_position")); | 3111 EXPECT_TRUE(connection.DoesColumnExist("metas", "unique_position")); |
2996 EXPECT_TRUE(connection.DoesColumnExist("metas", "server_unique_position")); | 3112 EXPECT_TRUE(connection.DoesColumnExist("metas", "server_unique_position")); |
2997 EXPECT_TRUE(connection.DoesColumnExist("metas", "unique_bookmark_tag")); | 3113 EXPECT_TRUE(connection.DoesColumnExist("metas", "unique_bookmark_tag")); |
2998 ASSERT_TRUE(dbs->needs_column_refresh_); | 3114 ASSERT_TRUE(dbs->needs_column_refresh_); |
2999 } | 3115 } |
3000 | 3116 |
| 3117 TEST_F(DirectoryBackingStoreTest, MigrateVersion86To87) { |
| 3118 sql::Connection connection; |
| 3119 EXPECT_TRUE(connection.OpenInMemory()); |
| 3120 SetUpVersion86Database(&connection); |
| 3121 EXPECT_FALSE(connection.DoesColumnExist("metas", "attachment_metadata")); |
| 3122 |
| 3123 scoped_ptr<TestDirectoryBackingStore> dbs( |
| 3124 new TestDirectoryBackingStore(GetUsername(), &connection)); |
| 3125 EXPECT_TRUE(dbs->MigrateVersion86To87()); |
| 3126 EXPECT_EQ(87, dbs->GetVersion()); |
| 3127 EXPECT_TRUE(connection.DoesColumnExist("metas", "attachment_metadata")); |
| 3128 EXPECT_TRUE(dbs->needs_column_refresh_); |
| 3129 } |
| 3130 |
3001 // The purpose of this test case is to make it easier to get a dump of the | 3131 // 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 | 3132 // database so you can implement a SetUpVersionYDatabase method. Here's what |
3003 // you should do: | 3133 // you should do: |
3004 // | 3134 // |
3005 // 1. Say you're going from version X to version Y. Write the migration | 3135 // 1. Say you're going from version X to version Y. Write the migration |
3006 // method MigrateVersionXToY. | 3136 // method MigrateVersionXToY. |
3007 // 2. Update the test below to call SetUpVersionXDatabase and then | 3137 // 2. Update the test below to call SetUpVersionXDatabase and then |
3008 // MigrateVersionXToY. You now have a database at version Y. Let's dump it. | 3138 // 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 | 3139 // 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 | 3140 // 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() | 3141 // created on disk. E.g. (gdb) p temp_dir_.path().value().c_str() |
3012 // 4. Dump the database using the sqlite3 command line tool: | 3142 // 4. Dump the database using the sqlite3 command line tool: |
3013 // > .output foo_dump.sql | 3143 // > .output foo_dump.sql |
3014 // > .dump | 3144 // > .dump |
3015 // 5. Replace the timestamp columns with META_PROTO_TIMES(x) (or | 3145 // 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 | 3146 // LEGACY_META_PROTO_TIMES(x) if before Version 77). Use this dump to write |
3017 // a SetupVersionYDatabase method. | 3147 // a SetupVersionYDatabase method. |
3018 TEST_F(DirectoryBackingStoreTest, MigrateToLatestAndDump) { | 3148 TEST_F(DirectoryBackingStoreTest, MigrateToLatestAndDump) { |
3019 { | 3149 { |
3020 sql::Connection connection; | 3150 sql::Connection connection; |
3021 ASSERT_TRUE(connection.Open(GetDatabasePath())); | 3151 ASSERT_TRUE(connection.Open(GetDatabasePath())); |
3022 SetUpVersion85Database(&connection); // Update this. | 3152 SetUpVersion86Database(&connection); // Update this. |
3023 | 3153 |
3024 scoped_ptr<TestDirectoryBackingStore> dbs( | 3154 scoped_ptr<TestDirectoryBackingStore> dbs( |
3025 new TestDirectoryBackingStore(GetUsername(), &connection)); | 3155 new TestDirectoryBackingStore(GetUsername(), &connection)); |
3026 ASSERT_TRUE(dbs->MigrateVersion85To86()); // Update this. | 3156 ASSERT_TRUE(dbs->MigrateVersion86To87()); // Update this. |
3027 ASSERT_TRUE(LoadAndIgnoreReturnedData(dbs.get())); | 3157 ASSERT_TRUE(LoadAndIgnoreReturnedData(dbs.get())); |
3028 EXPECT_EQ(86, dbs->GetVersion()); // Update this. | 3158 EXPECT_EQ(87, dbs->GetVersion()); // Update this. |
3029 ASSERT_FALSE(dbs->needs_column_refresh_); | 3159 ASSERT_FALSE(dbs->needs_column_refresh_); |
3030 } | 3160 } |
3031 // Set breakpoint here. | 3161 // Set breakpoint here. |
3032 } | 3162 } |
3033 | 3163 |
3034 TEST_F(DirectoryBackingStoreTest, DetectInvalidPosition) { | 3164 TEST_F(DirectoryBackingStoreTest, DetectInvalidPosition) { |
3035 sql::Connection connection; | 3165 sql::Connection connection; |
3036 ASSERT_TRUE(connection.OpenInMemory()); | 3166 ASSERT_TRUE(connection.OpenInMemory()); |
3037 SetUpVersion86Database(&connection); | 3167 SetUpVersion86Database(&connection); |
3038 | 3168 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3114 break; | 3244 break; |
3115 case 84: | 3245 case 84: |
3116 SetUpVersion84Database(&connection); | 3246 SetUpVersion84Database(&connection); |
3117 break; | 3247 break; |
3118 case 85: | 3248 case 85: |
3119 SetUpVersion85Database(&connection); | 3249 SetUpVersion85Database(&connection); |
3120 break; | 3250 break; |
3121 case 86: | 3251 case 86: |
3122 SetUpVersion86Database(&connection); | 3252 SetUpVersion86Database(&connection); |
3123 break; | 3253 break; |
| 3254 case 87: |
| 3255 SetUpVersion87Database(&connection); |
| 3256 break; |
3124 default: | 3257 default: |
3125 // If you see this error, it may mean that you've increased the | 3258 // 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 | 3259 // database version number but you haven't finished adding unit tests |
3127 // for the database migration code. You need to need to supply a | 3260 // for the database migration code. You need to need to supply a |
3128 // SetUpVersionYDatabase function with a dump of the test database | 3261 // SetUpVersionYDatabase function with a dump of the test database |
3129 // at the new schema. See the MigrateToLatestAndDump test case. | 3262 // at the new schema. See the MigrateToLatestAndDump test case. |
3130 FAIL() << "Need to supply database dump for version " << GetParam(); | 3263 FAIL() << "Need to supply database dump for version " << GetParam(); |
3131 } | 3264 } |
3132 | 3265 |
3133 syncable::Directory::KernelLoadInfo dir_info; | 3266 syncable::Directory::KernelLoadInfo dir_info; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3200 ASSERT_TRUE(connection.DoesTableExist("deleted_metas")); | 3333 ASSERT_TRUE(connection.DoesTableExist("deleted_metas")); |
3201 | 3334 |
3202 // Column removed in version 85. | 3335 // Column removed in version 85. |
3203 ASSERT_FALSE(connection.DoesColumnExist("models", "initial_sync_ended")); | 3336 ASSERT_FALSE(connection.DoesColumnExist("models", "initial_sync_ended")); |
3204 | 3337 |
3205 // Columns removed in version 86. | 3338 // Columns removed in version 86. |
3206 ASSERT_FALSE(connection.DoesColumnExist("metas", "next_id")); | 3339 ASSERT_FALSE(connection.DoesColumnExist("metas", "next_id")); |
3207 ASSERT_FALSE(connection.DoesColumnExist("metas", "prev_id")); | 3340 ASSERT_FALSE(connection.DoesColumnExist("metas", "prev_id")); |
3208 ASSERT_FALSE(connection.DoesColumnExist("metas", "server_ordinal_in_parent")); | 3341 ASSERT_FALSE(connection.DoesColumnExist("metas", "server_ordinal_in_parent")); |
3209 | 3342 |
| 3343 // Column added in version 87. |
| 3344 ASSERT_TRUE(connection.DoesColumnExist("metas", "attachment_metadata")); |
| 3345 |
3210 // Check download_progress state (v75 migration) | 3346 // Check download_progress state (v75 migration) |
3211 ASSERT_EQ(694, | 3347 ASSERT_EQ(694, |
3212 dir_info.kernel_info.download_progress[BOOKMARKS] | 3348 dir_info.kernel_info.download_progress[BOOKMARKS] |
3213 .timestamp_token_for_migration()); | 3349 .timestamp_token_for_migration()); |
3214 ASSERT_FALSE( | 3350 ASSERT_FALSE( |
3215 dir_info.kernel_info.download_progress[BOOKMARKS] | 3351 dir_info.kernel_info.download_progress[BOOKMARKS] |
3216 .has_token()); | 3352 .has_token()); |
3217 ASSERT_EQ(32904, | 3353 ASSERT_EQ(32904, |
3218 dir_info.kernel_info.download_progress[BOOKMARKS] | 3354 dir_info.kernel_info.download_progress[BOOKMARKS] |
3219 .data_type_id()); | 3355 .data_type_id()); |
(...skipping 15 matching lines...) Expand all Loading... |
3235 GetMetaProtoTimes(&connection)); | 3371 GetMetaProtoTimes(&connection)); |
3236 ExpectTimes(handles_map, GetExpectedMetaTimes()); | 3372 ExpectTimes(handles_map, GetExpectedMetaTimes()); |
3237 | 3373 |
3238 Directory::MetahandlesMap::iterator it = handles_map.find(1); | 3374 Directory::MetahandlesMap::iterator it = handles_map.find(1); |
3239 ASSERT_TRUE(it != handles_map.end()); | 3375 ASSERT_TRUE(it != handles_map.end()); |
3240 ASSERT_EQ(1, it->second->ref(META_HANDLE)); | 3376 ASSERT_EQ(1, it->second->ref(META_HANDLE)); |
3241 EXPECT_TRUE(it->second->ref(ID).IsRoot()); | 3377 EXPECT_TRUE(it->second->ref(ID).IsRoot()); |
3242 EXPECT_FALSE(it->second->ref(UNIQUE_POSITION).IsValid()); | 3378 EXPECT_FALSE(it->second->ref(UNIQUE_POSITION).IsValid()); |
3243 EXPECT_FALSE(it->second->ref(SERVER_UNIQUE_POSITION).IsValid()); | 3379 EXPECT_FALSE(it->second->ref(SERVER_UNIQUE_POSITION).IsValid()); |
3244 EXPECT_TRUE(it->second->ref(UNIQUE_BOOKMARK_TAG).empty()); | 3380 EXPECT_TRUE(it->second->ref(UNIQUE_BOOKMARK_TAG).empty()); |
| 3381 EXPECT_TRUE(it->second->ref(ATTACHMENT_METADATA).IsInitialized()); |
3245 | 3382 |
3246 // Items 2, 4, and 5 were deleted. | 3383 // Items 2, 4, and 5 were deleted. |
3247 it = handles_map.find(2); | 3384 it = handles_map.find(2); |
3248 ASSERT_TRUE(it == handles_map.end()); | 3385 ASSERT_TRUE(it == handles_map.end()); |
3249 it = handles_map.find(4); | 3386 it = handles_map.find(4); |
3250 ASSERT_TRUE(it == handles_map.end()); | 3387 ASSERT_TRUE(it == handles_map.end()); |
3251 it = handles_map.find(5); | 3388 it = handles_map.find(5); |
3252 ASSERT_TRUE(it == handles_map.end()); | 3389 ASSERT_TRUE(it == handles_map.end()); |
3253 | 3390 |
3254 it = handles_map.find(6); | 3391 it = handles_map.find(6); |
3255 ASSERT_EQ(6, it->second->ref(META_HANDLE)); | 3392 ASSERT_EQ(6, it->second->ref(META_HANDLE)); |
3256 EXPECT_TRUE(it->second->ref(IS_DIR)); | 3393 EXPECT_TRUE(it->second->ref(IS_DIR)); |
3257 EXPECT_TRUE(it->second->ref(SERVER_IS_DIR)); | 3394 EXPECT_TRUE(it->second->ref(SERVER_IS_DIR)); |
3258 EXPECT_FALSE(it->second->ref(SPECIFICS).bookmark().has_url()); | 3395 EXPECT_FALSE(it->second->ref(SPECIFICS).bookmark().has_url()); |
3259 EXPECT_FALSE(it->second->ref(SERVER_SPECIFICS).bookmark().has_url()); | 3396 EXPECT_FALSE(it->second->ref(SERVER_SPECIFICS).bookmark().has_url()); |
3260 EXPECT_FALSE(it->second->ref(SPECIFICS).bookmark().has_favicon()); | 3397 EXPECT_FALSE(it->second->ref(SPECIFICS).bookmark().has_favicon()); |
3261 EXPECT_FALSE(it->second->ref(SERVER_SPECIFICS).bookmark().has_favicon()); | 3398 EXPECT_FALSE(it->second->ref(SERVER_SPECIFICS).bookmark().has_favicon()); |
3262 EXPECT_TRUE(it->second->ref(UNIQUE_POSITION).IsValid()); | 3399 EXPECT_TRUE(it->second->ref(UNIQUE_POSITION).IsValid()); |
3263 EXPECT_TRUE(it->second->ref(SERVER_UNIQUE_POSITION).IsValid()); | 3400 EXPECT_TRUE(it->second->ref(SERVER_UNIQUE_POSITION).IsValid()); |
3264 EXPECT_EQ(UniquePosition::kSuffixLength, | 3401 EXPECT_EQ(UniquePosition::kSuffixLength, |
3265 it->second->ref(UNIQUE_BOOKMARK_TAG).length()); | 3402 it->second->ref(UNIQUE_BOOKMARK_TAG).length()); |
| 3403 EXPECT_TRUE(it->second->ref(ATTACHMENT_METADATA).IsInitialized()); |
3266 | 3404 |
3267 it = handles_map.find(7); | 3405 it = handles_map.find(7); |
3268 ASSERT_EQ(7, it->second->ref(META_HANDLE)); | 3406 ASSERT_EQ(7, it->second->ref(META_HANDLE)); |
3269 EXPECT_EQ("google_chrome", it->second->ref(UNIQUE_SERVER_TAG)); | 3407 EXPECT_EQ("google_chrome", it->second->ref(UNIQUE_SERVER_TAG)); |
3270 EXPECT_FALSE(it->second->ref(SPECIFICS).has_bookmark()); | 3408 EXPECT_FALSE(it->second->ref(SPECIFICS).has_bookmark()); |
3271 EXPECT_FALSE(it->second->ref(SERVER_SPECIFICS).has_bookmark()); | 3409 EXPECT_FALSE(it->second->ref(SERVER_SPECIFICS).has_bookmark()); |
3272 // Make sure we didn't assign positions to google_chrome. | 3410 // Make sure we didn't assign positions to google_chrome. |
3273 EXPECT_FALSE(it->second->ref(UNIQUE_POSITION).IsValid()); | 3411 EXPECT_FALSE(it->second->ref(UNIQUE_POSITION).IsValid()); |
3274 EXPECT_FALSE(it->second->ref(SERVER_UNIQUE_POSITION).IsValid()); | 3412 EXPECT_FALSE(it->second->ref(SERVER_UNIQUE_POSITION).IsValid()); |
3275 EXPECT_TRUE(it->second->ref(UNIQUE_BOOKMARK_TAG).empty()); | 3413 EXPECT_TRUE(it->second->ref(UNIQUE_BOOKMARK_TAG).empty()); |
| 3414 EXPECT_TRUE(it->second->ref(ATTACHMENT_METADATA).IsInitialized()); |
3276 | 3415 |
3277 it = handles_map.find(8); | 3416 it = handles_map.find(8); |
3278 ASSERT_EQ(8, it->second->ref(META_HANDLE)); | 3417 ASSERT_EQ(8, it->second->ref(META_HANDLE)); |
3279 EXPECT_EQ("google_chrome_bookmarks", it->second->ref(UNIQUE_SERVER_TAG)); | 3418 EXPECT_EQ("google_chrome_bookmarks", it->second->ref(UNIQUE_SERVER_TAG)); |
3280 EXPECT_TRUE(it->second->ref(SPECIFICS).has_bookmark()); | 3419 EXPECT_TRUE(it->second->ref(SPECIFICS).has_bookmark()); |
3281 EXPECT_TRUE(it->second->ref(SERVER_SPECIFICS).has_bookmark()); | 3420 EXPECT_TRUE(it->second->ref(SERVER_SPECIFICS).has_bookmark()); |
3282 ASSERT_EQ(it->second->ref(ID).value(), "s_ID_8"); | 3421 ASSERT_EQ(it->second->ref(ID).value(), "s_ID_8"); |
3283 // Make sure we didn't mistake the bookmark root node for a real bookmark. | 3422 // Make sure we didn't mistake the bookmark root node for a real bookmark. |
3284 EXPECT_FALSE(it->second->ref(UNIQUE_POSITION).IsValid()); | 3423 EXPECT_FALSE(it->second->ref(UNIQUE_POSITION).IsValid()); |
3285 EXPECT_FALSE(it->second->ref(SERVER_UNIQUE_POSITION).IsValid()); | 3424 EXPECT_FALSE(it->second->ref(SERVER_UNIQUE_POSITION).IsValid()); |
3286 EXPECT_TRUE(it->second->ref(UNIQUE_BOOKMARK_TAG).empty()); | 3425 EXPECT_TRUE(it->second->ref(UNIQUE_BOOKMARK_TAG).empty()); |
| 3426 EXPECT_TRUE(it->second->ref(ATTACHMENT_METADATA).IsInitialized()); |
3287 | 3427 |
3288 it = handles_map.find(9); | 3428 it = handles_map.find(9); |
3289 ASSERT_EQ(9, it->second->ref(META_HANDLE)); | 3429 ASSERT_EQ(9, it->second->ref(META_HANDLE)); |
3290 EXPECT_EQ("bookmark_bar", it->second->ref(UNIQUE_SERVER_TAG)); | 3430 EXPECT_EQ("bookmark_bar", it->second->ref(UNIQUE_SERVER_TAG)); |
3291 EXPECT_TRUE(it->second->ref(SPECIFICS).has_bookmark()); | 3431 EXPECT_TRUE(it->second->ref(SPECIFICS).has_bookmark()); |
3292 EXPECT_TRUE(it->second->ref(SERVER_SPECIFICS).has_bookmark()); | 3432 EXPECT_TRUE(it->second->ref(SERVER_SPECIFICS).has_bookmark()); |
3293 // Make sure we didn't assign positions to bookmark_bar. | 3433 // Make sure we didn't assign positions to bookmark_bar. |
3294 EXPECT_FALSE(it->second->ref(UNIQUE_POSITION).IsValid()); | 3434 EXPECT_FALSE(it->second->ref(UNIQUE_POSITION).IsValid()); |
3295 EXPECT_FALSE(it->second->ref(SERVER_UNIQUE_POSITION).IsValid()); | 3435 EXPECT_FALSE(it->second->ref(SERVER_UNIQUE_POSITION).IsValid()); |
3296 EXPECT_TRUE(it->second->ref(UNIQUE_BOOKMARK_TAG).empty()); | 3436 EXPECT_TRUE(it->second->ref(UNIQUE_BOOKMARK_TAG).empty()); |
| 3437 EXPECT_TRUE(it->second->ref(ATTACHMENT_METADATA).IsInitialized()); |
3297 | 3438 |
3298 it = handles_map.find(10); | 3439 it = handles_map.find(10); |
3299 ASSERT_EQ(10, it->second->ref(META_HANDLE)); | 3440 ASSERT_EQ(10, it->second->ref(META_HANDLE)); |
3300 EXPECT_FALSE(it->second->ref(IS_DEL)); | 3441 EXPECT_FALSE(it->second->ref(IS_DEL)); |
3301 EXPECT_TRUE(it->second->ref(SPECIFICS).has_bookmark()); | 3442 EXPECT_TRUE(it->second->ref(SPECIFICS).has_bookmark()); |
3302 EXPECT_TRUE(it->second->ref(SERVER_SPECIFICS).has_bookmark()); | 3443 EXPECT_TRUE(it->second->ref(SERVER_SPECIFICS).has_bookmark()); |
3303 EXPECT_FALSE(it->second->ref(SPECIFICS).bookmark().has_url()); | 3444 EXPECT_FALSE(it->second->ref(SPECIFICS).bookmark().has_url()); |
3304 EXPECT_FALSE(it->second->ref(SPECIFICS).bookmark().has_favicon()); | 3445 EXPECT_FALSE(it->second->ref(SPECIFICS).bookmark().has_favicon()); |
3305 EXPECT_FALSE(it->second->ref(SERVER_SPECIFICS).bookmark().has_url()); | 3446 EXPECT_FALSE(it->second->ref(SERVER_SPECIFICS).bookmark().has_url()); |
3306 EXPECT_FALSE(it->second->ref(SERVER_SPECIFICS).bookmark().has_favicon()); | 3447 EXPECT_FALSE(it->second->ref(SERVER_SPECIFICS).bookmark().has_favicon()); |
3307 EXPECT_EQ("other_bookmarks", it->second->ref(UNIQUE_SERVER_TAG)); | 3448 EXPECT_EQ("other_bookmarks", it->second->ref(UNIQUE_SERVER_TAG)); |
3308 EXPECT_EQ("Other Bookmarks", it->second->ref(NON_UNIQUE_NAME)); | 3449 EXPECT_EQ("Other Bookmarks", it->second->ref(NON_UNIQUE_NAME)); |
3309 EXPECT_EQ("Other Bookmarks", it->second->ref(SERVER_NON_UNIQUE_NAME)); | 3450 EXPECT_EQ("Other Bookmarks", it->second->ref(SERVER_NON_UNIQUE_NAME)); |
3310 ASSERT_EQ(it->second->ref(ID).value(), "s_ID_10"); | 3451 ASSERT_EQ(it->second->ref(ID).value(), "s_ID_10"); |
| 3452 EXPECT_TRUE(it->second->ref(ATTACHMENT_METADATA).IsInitialized()); |
3311 // Make sure we didn't assign positions to server-created folders, either. | 3453 // Make sure we didn't assign positions to server-created folders, either. |
3312 EXPECT_FALSE(it->second->ref(UNIQUE_POSITION).IsValid()); | 3454 EXPECT_FALSE(it->second->ref(UNIQUE_POSITION).IsValid()); |
3313 EXPECT_FALSE(it->second->ref(SERVER_UNIQUE_POSITION).IsValid()); | 3455 EXPECT_FALSE(it->second->ref(SERVER_UNIQUE_POSITION).IsValid()); |
3314 EXPECT_TRUE(it->second->ref(UNIQUE_BOOKMARK_TAG).empty()); | 3456 EXPECT_TRUE(it->second->ref(UNIQUE_BOOKMARK_TAG).empty()); |
| 3457 EXPECT_TRUE(it->second->ref(ATTACHMENT_METADATA).IsInitialized()); |
3315 | 3458 |
3316 it = handles_map.find(11); | 3459 it = handles_map.find(11); |
3317 ASSERT_EQ(11, it->second->ref(META_HANDLE)); | 3460 ASSERT_EQ(11, it->second->ref(META_HANDLE)); |
3318 EXPECT_FALSE(it->second->ref(IS_DEL)); | 3461 EXPECT_FALSE(it->second->ref(IS_DEL)); |
3319 EXPECT_FALSE(it->second->ref(IS_DIR)); | 3462 EXPECT_FALSE(it->second->ref(IS_DIR)); |
3320 EXPECT_TRUE(it->second->ref(SPECIFICS).has_bookmark()); | 3463 EXPECT_TRUE(it->second->ref(SPECIFICS).has_bookmark()); |
3321 EXPECT_TRUE(it->second->ref(SERVER_SPECIFICS).has_bookmark()); | 3464 EXPECT_TRUE(it->second->ref(SERVER_SPECIFICS).has_bookmark()); |
3322 EXPECT_EQ("http://dev.chromium.org/", | 3465 EXPECT_EQ("http://dev.chromium.org/", |
3323 it->second->ref(SPECIFICS).bookmark().url()); | 3466 it->second->ref(SPECIFICS).bookmark().url()); |
3324 EXPECT_EQ("AGATWA", it->second->ref(SPECIFICS).bookmark().favicon()); | 3467 EXPECT_EQ("AGATWA", it->second->ref(SPECIFICS).bookmark().favicon()); |
3325 EXPECT_EQ("http://dev.chromium.org/other", | 3468 EXPECT_EQ("http://dev.chromium.org/other", |
3326 it->second->ref(SERVER_SPECIFICS).bookmark().url()); | 3469 it->second->ref(SERVER_SPECIFICS).bookmark().url()); |
3327 EXPECT_EQ("AFAGVASF", it->second->ref(SERVER_SPECIFICS).bookmark().favicon()); | 3470 EXPECT_EQ("AFAGVASF", it->second->ref(SERVER_SPECIFICS).bookmark().favicon()); |
3328 EXPECT_EQ("", it->second->ref(UNIQUE_SERVER_TAG)); | 3471 EXPECT_EQ("", it->second->ref(UNIQUE_SERVER_TAG)); |
3329 EXPECT_EQ("Home (The Chromium Projects)", it->second->ref(NON_UNIQUE_NAME)); | 3472 EXPECT_EQ("Home (The Chromium Projects)", it->second->ref(NON_UNIQUE_NAME)); |
3330 EXPECT_EQ("Home (The Chromium Projects)", | 3473 EXPECT_EQ("Home (The Chromium Projects)", |
3331 it->second->ref(SERVER_NON_UNIQUE_NAME)); | 3474 it->second->ref(SERVER_NON_UNIQUE_NAME)); |
3332 EXPECT_TRUE(it->second->ref(UNIQUE_POSITION).IsValid()); | 3475 EXPECT_TRUE(it->second->ref(UNIQUE_POSITION).IsValid()); |
3333 EXPECT_TRUE(it->second->ref(SERVER_UNIQUE_POSITION).IsValid()); | 3476 EXPECT_TRUE(it->second->ref(SERVER_UNIQUE_POSITION).IsValid()); |
3334 EXPECT_EQ(UniquePosition::kSuffixLength, | 3477 EXPECT_EQ(UniquePosition::kSuffixLength, |
3335 it->second->ref(UNIQUE_BOOKMARK_TAG).length()); | 3478 it->second->ref(UNIQUE_BOOKMARK_TAG).length()); |
| 3479 EXPECT_TRUE(it->second->ref(ATTACHMENT_METADATA).IsInitialized()); |
3336 | 3480 |
3337 it = handles_map.find(12); | 3481 it = handles_map.find(12); |
3338 ASSERT_EQ(12, it->second->ref(META_HANDLE)); | 3482 ASSERT_EQ(12, it->second->ref(META_HANDLE)); |
3339 EXPECT_FALSE(it->second->ref(IS_DEL)); | 3483 EXPECT_FALSE(it->second->ref(IS_DEL)); |
3340 EXPECT_TRUE(it->second->ref(IS_DIR)); | 3484 EXPECT_TRUE(it->second->ref(IS_DIR)); |
3341 EXPECT_EQ("Extra Bookmarks", it->second->ref(NON_UNIQUE_NAME)); | 3485 EXPECT_EQ("Extra Bookmarks", it->second->ref(NON_UNIQUE_NAME)); |
3342 EXPECT_EQ("Extra Bookmarks", it->second->ref(SERVER_NON_UNIQUE_NAME)); | 3486 EXPECT_EQ("Extra Bookmarks", it->second->ref(SERVER_NON_UNIQUE_NAME)); |
3343 EXPECT_TRUE(it->second->ref(SPECIFICS).has_bookmark()); | 3487 EXPECT_TRUE(it->second->ref(SPECIFICS).has_bookmark()); |
3344 EXPECT_TRUE(it->second->ref(SERVER_SPECIFICS).has_bookmark()); | 3488 EXPECT_TRUE(it->second->ref(SERVER_SPECIFICS).has_bookmark()); |
3345 EXPECT_FALSE(it->second->ref(SPECIFICS).bookmark().has_url()); | 3489 EXPECT_FALSE(it->second->ref(SPECIFICS).bookmark().has_url()); |
3346 EXPECT_FALSE(it->second->ref(SERVER_SPECIFICS).bookmark().has_url()); | 3490 EXPECT_FALSE(it->second->ref(SERVER_SPECIFICS).bookmark().has_url()); |
3347 EXPECT_FALSE(it->second->ref(SPECIFICS).bookmark().has_favicon()); | 3491 EXPECT_FALSE(it->second->ref(SPECIFICS).bookmark().has_favicon()); |
3348 EXPECT_FALSE(it->second->ref(SERVER_SPECIFICS).bookmark().has_favicon()); | 3492 EXPECT_FALSE(it->second->ref(SERVER_SPECIFICS).bookmark().has_favicon()); |
3349 EXPECT_TRUE(it->second->ref(UNIQUE_POSITION).IsValid()); | 3493 EXPECT_TRUE(it->second->ref(UNIQUE_POSITION).IsValid()); |
3350 EXPECT_TRUE(it->second->ref(SERVER_UNIQUE_POSITION).IsValid()); | 3494 EXPECT_TRUE(it->second->ref(SERVER_UNIQUE_POSITION).IsValid()); |
3351 EXPECT_EQ(UniquePosition::kSuffixLength, | 3495 EXPECT_EQ(UniquePosition::kSuffixLength, |
3352 it->second->ref(UNIQUE_BOOKMARK_TAG).length()); | 3496 it->second->ref(UNIQUE_BOOKMARK_TAG).length()); |
| 3497 EXPECT_TRUE(it->second->ref(ATTACHMENT_METADATA).IsInitialized()); |
3353 | 3498 |
3354 it = handles_map.find(13); | 3499 it = handles_map.find(13); |
3355 ASSERT_EQ(13, it->second->ref(META_HANDLE)); | 3500 ASSERT_EQ(13, it->second->ref(META_HANDLE)); |
3356 EXPECT_TRUE(it->second->ref(UNIQUE_POSITION).IsValid()); | 3501 EXPECT_TRUE(it->second->ref(UNIQUE_POSITION).IsValid()); |
3357 EXPECT_TRUE(it->second->ref(SERVER_UNIQUE_POSITION).IsValid()); | 3502 EXPECT_TRUE(it->second->ref(SERVER_UNIQUE_POSITION).IsValid()); |
3358 EXPECT_EQ(UniquePosition::kSuffixLength, | 3503 EXPECT_EQ(UniquePosition::kSuffixLength, |
3359 it->second->ref(UNIQUE_BOOKMARK_TAG).length()); | 3504 it->second->ref(UNIQUE_BOOKMARK_TAG).length()); |
| 3505 EXPECT_TRUE(it->second->ref(ATTACHMENT_METADATA).IsInitialized()); |
3360 | 3506 |
3361 it = handles_map.find(14); | 3507 it = handles_map.find(14); |
3362 ASSERT_EQ(14, it->second->ref(META_HANDLE)); | 3508 ASSERT_EQ(14, it->second->ref(META_HANDLE)); |
3363 EXPECT_TRUE(it->second->ref(UNIQUE_POSITION).IsValid()); | 3509 EXPECT_TRUE(it->second->ref(UNIQUE_POSITION).IsValid()); |
3364 EXPECT_TRUE(it->second->ref(SERVER_UNIQUE_POSITION).IsValid()); | 3510 EXPECT_TRUE(it->second->ref(SERVER_UNIQUE_POSITION).IsValid()); |
3365 EXPECT_EQ(UniquePosition::kSuffixLength, | 3511 EXPECT_EQ(UniquePosition::kSuffixLength, |
3366 it->second->ref(UNIQUE_BOOKMARK_TAG).length()); | 3512 it->second->ref(UNIQUE_BOOKMARK_TAG).length()); |
| 3513 EXPECT_TRUE(it->second->ref(ATTACHMENT_METADATA).IsInitialized()); |
3367 | 3514 |
3368 ASSERT_EQ(static_cast<size_t>(10), handles_map.size()); | 3515 ASSERT_EQ(static_cast<size_t>(10), handles_map.size()); |
3369 | 3516 |
3370 // Make sure that the syncable::Directory and the migration code agree on | 3517 // Make sure that the syncable::Directory and the migration code agree on |
3371 // which items should or should not have unique position values. This test | 3518 // which items should or should not have unique position values. This test |
3372 // may become obsolete if the directory's definition of that function | 3519 // may become obsolete if the directory's definition of that function |
3373 // changes, but, until then, this is a useful test. | 3520 // changes, but, until then, this is a useful test. |
3374 for (it = handles_map.begin(); it != handles_map.end(); it++) { | 3521 for (it = handles_map.begin(); it != handles_map.end(); it++) { |
3375 SCOPED_TRACE(it->second->ref(ID)); | 3522 SCOPED_TRACE(it->second->ref(ID)); |
3376 if (it->second->ShouldMaintainPosition()) { | 3523 if (it->second->ShouldMaintainPosition()) { |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3520 const std::string& guid2 = TestDirectoryBackingStore::GenerateCacheGUID(); | 3667 const std::string& guid2 = TestDirectoryBackingStore::GenerateCacheGUID(); |
3521 EXPECT_EQ(24U, guid1.size()); | 3668 EXPECT_EQ(24U, guid1.size()); |
3522 EXPECT_EQ(24U, guid2.size()); | 3669 EXPECT_EQ(24U, guid2.size()); |
3523 // In theory this test can fail, but it won't before the universe | 3670 // In theory this test can fail, but it won't before the universe |
3524 // dies of heat death. | 3671 // dies of heat death. |
3525 EXPECT_NE(guid1, guid2); | 3672 EXPECT_NE(guid1, guid2); |
3526 } | 3673 } |
3527 | 3674 |
3528 } // namespace syncable | 3675 } // namespace syncable |
3529 } // namespace syncer | 3676 } // namespace syncer |
OLD | NEW |