summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorakalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-11 18:14:41 +0000
committerakalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-11 18:14:41 +0000
commit89d5718f6ad37a02fc254b6759a32d86d0d557a6 (patch)
tree2dcc7bdfbd9130580ec11ec4c7a849c911fa9b7b /chrome/browser
parent833c2bfa05ac052c64a2ca59991a4a285a82d86d (diff)
downloadchromium_src-89d5718f6ad37a02fc254b6759a32d86d0d557a6.zip
chromium_src-89d5718f6ad37a02fc254b6759a32d86d0d557a6.tar.gz
chromium_src-89d5718f6ad37a02fc254b6759a32d86d0d557a6.tar.bz2
[Sync] Added notifications_state field to PersistentKernelInfo
Also added accessors. BUG=58556 TEST=DirectoryBackingStore tests Review URL: http://codereview.chromium.org/3664002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62161 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/sync/syncable/directory_backing_store.cc50
-rw-r--r--chrome/browser/sync/syncable/directory_backing_store.h8
-rw-r--r--chrome/browser/sync/syncable/directory_backing_store_unittest.cc139
-rw-r--r--chrome/browser/sync/syncable/syncable.cc20
-rw-r--r--chrome/browser/sync/syncable/syncable.h6
-rw-r--r--chrome/browser/sync/syncable/syncable_unittest.cc9
6 files changed, 221 insertions, 11 deletions
diff --git a/chrome/browser/sync/syncable/directory_backing_store.cc b/chrome/browser/sync/syncable/directory_backing_store.cc
index 62b8faa..9d738fd 100644
--- a/chrome/browser/sync/syncable/directory_backing_store.cc
+++ b/chrome/browser/sync/syncable/directory_backing_store.cc
@@ -44,7 +44,7 @@ static const string::size_type kUpdateStatementBufferSize = 2048;
// Increment this version whenever updating DB tables.
extern const int32 kCurrentDBVersion; // Global visibility for our unittest.
-const int32 kCurrentDBVersion = 72;
+const int32 kCurrentDBVersion = 73;
namespace {
@@ -378,9 +378,12 @@ bool DirectoryBackingStore::SaveChanges(
SQLStatement update;
update.prepare(dbhandle, "UPDATE share_info "
"SET store_birthday = ?, "
- "next_id = ?");
+ "next_id = ?, "
+ "notification_state = ?");
update.bind_string(0, info.store_birthday);
update.bind_int64(1, info.next_id);
+ update.bind_blob(2, info.notification_state.data(),
+ info.notification_state.size());
if (!(SQLITE_DONE == update.step() &&
SQLITE_OK == update.reset() &&
@@ -447,6 +450,12 @@ DirOpenResult DirectoryBackingStore::InitializeTables() {
version_on_disk = 72;
}
+ // Version 73 added a field for notification state.
+ if (version_on_disk == 72) {
+ if (MigrateVersion72To73())
+ version_on_disk = 73;
+ }
+
// If one of the migrations requested it, drop columns that aren't current.
// It's only safe to do this after migrating all the way to the current
// version.
@@ -546,13 +555,14 @@ bool DirectoryBackingStore::LoadInfo(Directory::KernelLoadInfo* info) {
{
SQLStatement query;
query.prepare(load_dbhandle_,
- "SELECT store_birthday, next_id, cache_guid "
- "FROM share_info");
+ "SELECT store_birthday, next_id, cache_guid, "
+ "notification_state FROM share_info");
if (SQLITE_ROW != query.step())
return false;
info->kernel_info.store_birthday = query.column_string(0);
info->kernel_info.next_id = query.column_int64(1);
info->cache_guid = query.column_string(2);
+ query.column_blob_as_string(3, &info->kernel_info.notification_state);
}
{
SQLStatement query;
@@ -879,7 +889,9 @@ bool DirectoryBackingStore::MigrateVersion70To71() {
// Drop the columns from the old share_info table via a temp table.
const bool kCreateAsTempShareInfo = true;
- int result = CreateShareInfoTable(kCreateAsTempShareInfo);
+ const bool kWithNotificationState = false;
+ int result =
+ CreateShareInfoTable(kCreateAsTempShareInfo, kWithNotificationState);
if (result != SQLITE_DONE)
return false;
ExecQuery(load_dbhandle_,
@@ -904,6 +916,16 @@ bool DirectoryBackingStore::MigrateVersion71To72() {
return true;
}
+bool DirectoryBackingStore::MigrateVersion72To73() {
+ int result =
+ ExecQuery(load_dbhandle_,
+ "ALTER TABLE share_info ADD COLUMN notification_state BLOB");
+ if (result != SQLITE_DONE)
+ return false;
+ SetVersion(73);
+ return true;
+}
+
int DirectoryBackingStore::CreateTables() {
LOG(INFO) << "First run, creating tables";
// Create two little tables share_version and share_info
@@ -922,7 +944,10 @@ int DirectoryBackingStore::CreateTables() {
if (result != SQLITE_DONE)
return result;
- result = CreateShareInfoTable(false);
+ const bool kCreateAsTempShareInfo = false;
+ const bool kWithNotificationState = true;
+ result =
+ CreateShareInfoTable(kCreateAsTempShareInfo, kWithNotificationState);
if (result != SQLITE_DONE)
return result;
{
@@ -934,13 +959,15 @@ int DirectoryBackingStore::CreateTables() {
"?, " // db_create_version
"?, " // db_create_time
"-2, " // next_id
- "?)"); // cache_guid);
+ "?, " // cache_guid
+ "?);"); // notification_state
statement.bind_string(0, dir_name_); // id
statement.bind_string(1, dir_name_); // name
statement.bind_string(2, ""); // store_birthday
statement.bind_string(3, SYNC_ENGINE_VERSION_STRING); // db_create_version
statement.bind_int(4, static_cast<int32>(time(0))); // db_create_time
statement.bind_string(5, GenerateCacheGUID()); // cache_guid
+ statement.bind_blob(6, NULL, 0); // notification_state
result = statement.step();
}
if (result != SQLITE_DONE)
@@ -998,7 +1025,8 @@ int DirectoryBackingStore::CreateModelsTable() {
"initial_sync_ended BOOLEAN default 0)");
}
-int DirectoryBackingStore::CreateShareInfoTable(bool is_temporary) {
+int DirectoryBackingStore::CreateShareInfoTable(
+ bool is_temporary, bool with_notification_state) {
const char* name = is_temporary ? "temp_share_info" : "share_info";
string query = "CREATE TABLE ";
query.append(name);
@@ -1012,7 +1040,11 @@ int DirectoryBackingStore::CreateShareInfoTable(bool is_temporary) {
"db_create_version TEXT, "
"db_create_time INT, "
"next_id INT default -2, "
- "cache_guid TEXT)");
+ "cache_guid TEXT");
+ if (with_notification_state) {
+ query.append(", notification_state BLOB");
+ }
+ query.append(")");
return ExecQuery(load_dbhandle_, query.c_str());
}
diff --git a/chrome/browser/sync/syncable/directory_backing_store.h b/chrome/browser/sync/syncable/directory_backing_store.h
index cadd7d3..f1a09dd 100644
--- a/chrome/browser/sync/syncable/directory_backing_store.h
+++ b/chrome/browser/sync/syncable/directory_backing_store.h
@@ -79,6 +79,7 @@ class DirectoryBackingStore {
FRIEND_TEST_ALL_PREFIXES(DirectoryBackingStoreTest, MigrateVersion69To70);
FRIEND_TEST_ALL_PREFIXES(DirectoryBackingStoreTest, MigrateVersion70To71);
FRIEND_TEST_ALL_PREFIXES(DirectoryBackingStoreTest, MigrateVersion71To72);
+ FRIEND_TEST_ALL_PREFIXES(DirectoryBackingStoreTest, MigrateVersion72To73);
FRIEND_TEST_ALL_PREFIXES(DirectoryBackingStoreTest, ModelTypeIds);
FRIEND_TEST_ALL_PREFIXES(DirectoryBackingStoreTest, Corruption);
FRIEND_TEST_ALL_PREFIXES(DirectoryBackingStoreTest, DeleteEntries);
@@ -91,8 +92,10 @@ class DirectoryBackingStore {
int CreateTables();
// Create 'share_info' or 'temp_share_info' depending on value of
- // is_temporary. Returns an sqlite return code, SQLITE_DONE on success.
- int CreateShareInfoTable(bool is_temporary);
+ // is_temporary. If with_notification_state is true, creates the
+ // table with the notification_state column. Returns an sqlite
+ // return code, SQLITE_DONE on success.
+ int CreateShareInfoTable(bool is_temporary, bool with_notification_state);
// Create 'metas' or 'temp_metas' depending on value of is_temporary.
// Returns an sqlite return code, SQLITE_DONE on success.
int CreateMetasTable(bool is_temporary);
@@ -168,6 +171,7 @@ class DirectoryBackingStore {
bool MigrateVersion69To70();
bool MigrateVersion70To71();
bool MigrateVersion71To72();
+ bool MigrateVersion72To73();
// The handle to our sqlite on-disk store for initialization and loading, and
// for saving changes periodically via SaveChanges, respectively.
diff --git a/chrome/browser/sync/syncable/directory_backing_store_unittest.cc b/chrome/browser/sync/syncable/directory_backing_store_unittest.cc
index c158f9a..214690c 100644
--- a/chrome/browser/sync/syncable/directory_backing_store_unittest.cc
+++ b/chrome/browser/sync/syncable/directory_backing_store_unittest.cc
@@ -47,6 +47,7 @@ class MigrationTest : public testing::TestWithParam<int> {
void SetUpVersion69Database();
void SetUpVersion70Database();
void SetUpVersion71Database();
+ void SetUpVersion72Database();
void SetUpCurrentDatabaseAndCheckVersion() {
SetUpVersion70Database(); // Prepopulates data.
@@ -635,6 +636,111 @@ void MigrationTest::SetUpVersion71Database() {
"'9010788312004066376x-6609234393368420856x');"));
ASSERT_TRUE(connection.CommitTransaction());
}
+
+void MigrationTest::SetUpVersion72Database() {
+ sql::Connection connection;
+ ASSERT_TRUE(connection.Open(GetDatabasePath()));
+ ASSERT_TRUE(connection.BeginTransaction());
+ ASSERT_TRUE(connection.Execute(
+ "CREATE TABLE share_version (id VARCHAR(128) primary key, data INT);"
+ "INSERT INTO 'share_version' VALUES('nick@chromium.org',71);"
+ "CREATE TABLE metas(metahandle bigint primary key ON CONFLICT FAIL,"
+ "base_version bigint default -1,server_version bigint default 0,"
+ "mtime bigint default 0,server_mtime bigint default 0,ctime bigint "
+ "default 0,server_ctime bigint default 0,server_position_in_parent "
+ "bigint default 0,local_external_id bigint default 0,id varchar(255) "
+ "default 'r',parent_id varchar(255) default 'r',server_parent_id "
+ "varchar(255) default 'r',prev_id varchar(255) default 'r',next_id "
+ "varchar(255) default 'r',is_unsynced bit default 0,"
+ "is_unapplied_update bit default 0,is_del bit default 0,is_dir bit "
+ "default 0,server_is_dir bit default 0,server_is_del bit default 0,"
+ "non_unique_name varchar,server_non_unique_name varchar(255),"
+ "unique_server_tag varchar,unique_client_tag varchar,specifics blob,"
+ "server_specifics blob);"
+ "INSERT INTO 'metas' VALUES(1,-1,0,129079956640320000,0,"
+ "129079956640320000,0,0,0,'r','r','r','r','r',0,0,0,1,0,0,NULL,NULL,"
+ "NULL,NULL,X'',X'');"
+ "INSERT INTO 'metas' VALUES(2,669,669,128976886618480000,"
+ "128976886618480000,128976886618480000,128976886618480000,-2097152,4,"
+ "'s_ID_2','s_ID_9','s_ID_9','s_ID_2','s_ID_2',0,0,1,0,0,1,"
+ "'Deleted Item','Deleted Item',NULL,NULL,X'C28810220A16687474703A2F2F"
+ "7777772E676F6F676C652E636F6D2F12084141534741534741',X'C28810260A1768"
+ "7474703A2F2F7777772E676F6F676C652E636F6D2F32120B41534144474144474144"
+ "47');"
+ "INSERT INTO 'metas' VALUES(4,681,681,129002163642690000,"
+ "129002163642690000,129002163642690000,129002163642690000,-3145728,3,"
+ "'s_ID_4','s_ID_9','s_ID_9','s_ID_4','s_ID_4',0,0,1,0,0,1,"
+ "'Welcome to Chromium','Welcome to Chromium',NULL,NULL,X'C28810350A31"
+ "687474703A2F2F7777772E676F6F676C652E636F6D2F6368726F6D652F696E746C2F"
+ "656E2F77656C636F6D652E68746D6C1200',X'C28810350A31687474703A2F2F7777"
+ "772E676F6F676C652E636F6D2F6368726F6D652F696E746C2F656E2F77656C636F6D"
+ "652E68746D6C1200');"
+ "INSERT INTO 'metas' VALUES(5,677,677,129001555500000000,"
+ "129001555500000000,129001555500000000,129001555500000000,1048576,7,"
+ "'s_ID_5','s_ID_9','s_ID_9','s_ID_5','s_ID_5',0,0,1,0,0,1,'Google',"
+ "'Google',NULL,NULL,X'C28810220A16687474703A2F2F7777772E676F6F676C652"
+ "E636F6D2F12084147415347415347',X'C28810220A16687474703A2F2F7777772E6"
+ "76F6F676C652E636F6D2F12084147464447415347');"
+ "INSERT INTO 'metas' VALUES(6,694,694,129053976170000000,"
+ "129053976170000000,129053976170000000,129053976170000000,-4194304,6,"
+ "'s_ID_6','s_ID_9','s_ID_9','r','r',0,0,0,1,1,0,'The Internet',"
+ "'The Internet',NULL,NULL,X'C2881000',X'C2881000');"
+ "INSERT INTO 'metas' VALUES(7,663,663,128976864758480000,"
+ "128976864758480000,128976864758480000,128976864758480000,1048576,0,"
+ "'s_ID_7','r','r','r','r',0,0,0,1,1,0,'Google Chrome','Google Chrome'"
+ ",'google_chrome',NULL,NULL,NULL);"
+ "INSERT INTO 'metas' VALUES(8,664,664,128976864758480000,"
+ "128976864758480000,128976864758480000,128976864758480000,1048576,0,"
+ "'s_ID_8','s_ID_7','s_ID_7','r','r',0,0,0,1,1,0,'Bookmarks',"
+ "'Bookmarks','google_chrome_bookmarks',NULL,X'C2881000',X'C2881000');"
+ "INSERT INTO 'metas' VALUES(9,665,665,128976864758480000,"
+ "128976864758480000,128976864758480000,128976864758480000,1048576,1,"
+ "'s_ID_9','s_ID_8','s_ID_8','r','s_ID_10',0,0,0,1,1,0,'Bookmark Bar',"
+ "'Bookmark Bar','bookmark_bar',NULL,X'C2881000',X'C2881000');"
+ "INSERT INTO 'metas' VALUES(10,666,666,128976864758480000,"
+ "128976864758480000,128976864758480000,128976864758480000,2097152,2,"
+ "'s_ID_10','s_ID_8','s_ID_8','s_ID_9','r',0,0,0,1,1,0,"
+ "'Other Bookmarks','Other Bookmarks','other_bookmarks',NULL,"
+ "X'C2881000',X'C2881000');"
+ "INSERT INTO 'metas' VALUES(11,683,683,129079956948440000,"
+ "129079956948440000,129079956948440000,129079956948440000,-1048576,8,"
+ "'s_ID_11','s_ID_6','s_ID_6','r','s_ID_13',0,0,0,0,0,0,"
+ "'Home (The Chromium Projects)','Home (The Chromium Projects)',NULL,"
+ "NULL,X'C28810220A18687474703A2F2F6465762E6368726F6D69756D2E6F72672F1"
+ "206414741545741',X'C28810290A1D687474703A2F2F6465762E6368726F6D69756"
+ "D2E6F72672F6F7468657212084146414756415346');"
+ "INSERT INTO 'metas' VALUES(12,685,685,129079957513650000,"
+ "129079957513650000,129079957513650000,129079957513650000,0,9,"
+ "'s_ID_12','s_ID_6','s_ID_6','s_ID_13','s_ID_14',0,0,0,1,1,0,"
+ "'Extra Bookmarks','Extra Bookmarks',NULL,NULL,X'C2881000',"
+ "X'C2881000');"
+ "INSERT INTO 'metas' VALUES(13,687,687,129079957985300000,"
+ "129079957985300000,129079957985300000,129079957985300000,-917504,10,"
+ "'s_ID_13','s_ID_6','s_ID_6','s_ID_11','s_ID_12',0,0,0,0,0,0,"
+ "'ICANN | Internet Corporation for Assigned Names and Numbers',"
+ "'ICANN | Internet Corporation for Assigned Names and Numbers',NULL,"
+ "NULL,X'C28810240A15687474703A2F2F7777772E6963616E6E2E636F6D2F120B504"
+ "E474158463041414646',X'C28810200A15687474703A2F2F7777772E6963616E6E2"
+ "E636F6D2F120744414146415346');"
+ "INSERT INTO 'metas' VALUES(14,692,692,129079958383000000,"
+ "129079958383000000,129079958383000000,129079958383000000,1048576,11,"
+ "'s_ID_14','s_ID_6','s_ID_6','s_ID_12','r',0,0,0,0,0,0,"
+ "'The WebKit Open Source Project','The WebKit Open Source Project',"
+ "NULL,NULL,""X'C288101A0A12687474703A2F2F7765626B69742E6F72672F120450"
+ "4E4758',X'C288101C0A13687474703A2F2F7765626B69742E6F72672F781205504E"
+ "473259');"
+ "CREATE TABLE models (model_id BLOB primary key, "
+ "last_download_timestamp INT, initial_sync_ended BOOLEAN default 0);"
+ "INSERT INTO 'models' VALUES(X'C2881000',694,1);"
+ "CREATE TABLE 'share_info' (id TEXT primary key, name TEXT, "
+ "store_birthday TEXT, db_create_version TEXT, db_create_time INT, "
+ "next_id INT default -2, cache_guid TEXT);"
+ "INSERT INTO 'share_info' VALUES('nick@chromium.org','nick@chromium.org',"
+ "'c27e9f59-08ca-46f8-b0cc-f16a2ed778bb','Unknown',1263522064,-65542,"
+ "'9010788312004066376x-6609234393368420856x');"));
+ ASSERT_TRUE(connection.CommitTransaction());
+}
+
TEST_F(DirectoryBackingStoreTest, MigrateVersion67To68) {
SetUpVersion67Database();
@@ -805,6 +911,32 @@ TEST_F(DirectoryBackingStoreTest, MigrateVersion71To72) {
ASSERT_FALSE(connection.DoesTableExist("extended_attributes"));
}
+TEST_F(DirectoryBackingStoreTest, MigrateVersion72To73) {
+ SetUpVersion72Database();
+
+ {
+ sql::Connection connection;
+ ASSERT_TRUE(connection.Open(GetDatabasePath()));
+ ASSERT_FALSE(
+ connection.DoesColumnExist("share_info", "notification_state"));
+ }
+
+ scoped_ptr<DirectoryBackingStore> dbs(
+ new DirectoryBackingStore(GetUsername(), GetDatabasePath()));
+
+ dbs->BeginLoad();
+ ASSERT_FALSE(dbs->needs_column_refresh_);
+ ASSERT_TRUE(dbs->MigrateVersion72To73());
+ ASSERT_EQ(73, dbs->GetVersion());
+ dbs->EndLoad();
+ ASSERT_FALSE(dbs->needs_column_refresh_);
+
+ sql::Connection connection;
+ ASSERT_TRUE(connection.Open(GetDatabasePath()));
+ ASSERT_TRUE(
+ connection.DoesColumnExist("share_info", "notification_state"));
+}
+
TEST_P(MigrationTest, ToCurrentVersion) {
switch (GetParam()) {
case 67:
@@ -822,6 +954,9 @@ TEST_P(MigrationTest, ToCurrentVersion) {
case 71:
SetUpVersion71Database();
break;
+ case 72:
+ SetUpVersion72Database();
+ break;
default:
// If you see this error, it may mean that you've increased the
// database version number but you haven't finished adding unit tests
@@ -876,6 +1011,10 @@ TEST_P(MigrationTest, ToCurrentVersion) {
// Removed extended attributes in Version 72.
ASSERT_FALSE(connection.DoesTableExist("extended_attributes"));
+
+ // Columns added in Version 73.
+ ASSERT_TRUE(connection.DoesColumnExist(
+ "share_info", "notification_state"));
}
MetahandlesIndex index;
diff --git a/chrome/browser/sync/syncable/syncable.cc b/chrome/browser/sync/syncable/syncable.cc
index 8803859..5545589 100644
--- a/chrome/browser/sync/syncable/syncable.cc
+++ b/chrome/browser/sync/syncable/syncable.cc
@@ -739,6 +739,14 @@ void Directory::set_last_download_timestamp_unsafe(ModelType model_type,
kernel_->info_status = KERNEL_SHARE_INFO_DIRTY;
}
+void Directory::SetNotificationStateUnsafe(
+ const std::string& notification_state) {
+ if (notification_state == kernel_->persisted_info.notification_state)
+ return;
+ kernel_->persisted_info.notification_state = notification_state;
+ kernel_->info_status = KERNEL_SHARE_INFO_DIRTY;
+}
+
string Directory::store_birthday() const {
ScopedKernelLock lock(this);
return kernel_->persisted_info.store_birthday;
@@ -752,6 +760,18 @@ void Directory::set_store_birthday(string store_birthday) {
kernel_->info_status = KERNEL_SHARE_INFO_DIRTY;
}
+std::string Directory::GetAndClearNotificationState() {
+ ScopedKernelLock lock(this);
+ std::string notification_state = kernel_->persisted_info.notification_state;
+ SetNotificationStateUnsafe(std::string());
+ return notification_state;
+}
+
+void Directory::SetNotificationState(const std::string& notification_state) {
+ ScopedKernelLock lock(this);
+ SetNotificationStateUnsafe(notification_state);
+}
+
string Directory::cache_guid() const {
// No need to lock since nothing ever writes to it after load.
return kernel_->cache_guid;
diff --git a/chrome/browser/sync/syncable/syncable.h b/chrome/browser/sync/syncable/syncable.h
index a3c2212..c26232f7 100644
--- a/chrome/browser/sync/syncable/syncable.h
+++ b/chrome/browser/sync/syncable/syncable.h
@@ -672,6 +672,8 @@ class Directory {
std::string store_birthday;
// The next local ID that has not been used with this cache-GUID.
int64 next_id;
+ // The persisted notification state.
+ std::string notification_state;
};
// What the Directory needs on initialization to create itself and its Kernel.
@@ -761,6 +763,9 @@ class Directory {
std::string store_birthday() const;
void set_store_birthday(std::string store_birthday);
+ std::string GetAndClearNotificationState();
+ void SetNotificationState(const std::string& notification_state);
+
// Unique to each account / client pair.
std::string cache_guid() const;
@@ -913,6 +918,7 @@ class Directory {
// a ScopedKernelLock.
void set_initial_sync_ended_for_type_unsafe(ModelType type, bool x);
void set_last_download_timestamp_unsafe(ModelType model_type, int64 x);
+ void SetNotificationStateUnsafe(const std::string& notification_state);
Directory& operator = (const Directory&);
diff --git a/chrome/browser/sync/syncable/syncable_unittest.cc b/chrome/browser/sync/syncable/syncable_unittest.cc
index 885fd25..e586da3 100644
--- a/chrome/browser/sync/syncable/syncable_unittest.cc
+++ b/chrome/browser/sync/syncable/syncable_unittest.cc
@@ -1004,6 +1004,7 @@ TEST_F(SyncableDirectoryTest, TestShareInfo) {
dir_->set_last_download_timestamp(BOOKMARKS, 1000);
dir_->set_initial_sync_ended_for_type(AUTOFILL, true);
dir_->set_store_birthday("Jan 31st");
+ dir_->SetNotificationState("notification_state");
{
ReadTransaction trans(dir_.get(), __FILE__, __LINE__);
EXPECT_EQ(100, dir_->last_download_timestamp(AUTOFILL));
@@ -1011,9 +1012,12 @@ TEST_F(SyncableDirectoryTest, TestShareInfo) {
EXPECT_TRUE(dir_->initial_sync_ended_for_type(AUTOFILL));
EXPECT_FALSE(dir_->initial_sync_ended_for_type(BOOKMARKS));
EXPECT_EQ("Jan 31st", dir_->store_birthday());
+ EXPECT_EQ("notification_state", dir_->GetAndClearNotificationState());
+ EXPECT_EQ("", dir_->GetAndClearNotificationState());
}
dir_->set_last_download_timestamp(AUTOFILL, 200);
dir_->set_store_birthday("April 10th");
+ dir_->SetNotificationState("notification_state2");
dir_->SaveChanges();
{
ReadTransaction trans(dir_.get(), __FILE__, __LINE__);
@@ -1022,7 +1026,10 @@ TEST_F(SyncableDirectoryTest, TestShareInfo) {
EXPECT_TRUE(dir_->initial_sync_ended_for_type(AUTOFILL));
EXPECT_FALSE(dir_->initial_sync_ended_for_type(BOOKMARKS));
EXPECT_EQ("April 10th", dir_->store_birthday());
+ EXPECT_EQ("notification_state2", dir_->GetAndClearNotificationState());
+ EXPECT_EQ("", dir_->GetAndClearNotificationState());
}
+ dir_->SetNotificationState("notification_state2");
// Restore the directory from disk. Make sure that nothing's changed.
SaveAndReloadDir();
{
@@ -1032,6 +1039,8 @@ TEST_F(SyncableDirectoryTest, TestShareInfo) {
EXPECT_TRUE(dir_->initial_sync_ended_for_type(AUTOFILL));
EXPECT_FALSE(dir_->initial_sync_ended_for_type(BOOKMARKS));
EXPECT_EQ("April 10th", dir_->store_birthday());
+ EXPECT_EQ("notification_state2", dir_->GetAndClearNotificationState());
+ EXPECT_EQ("", dir_->GetAndClearNotificationState());
}
}