diff options
author | munjal@chromium.org <munjal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-18 20:11:42 +0000 |
---|---|---|
committer | munjal@chromium.org <munjal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-18 20:11:42 +0000 |
commit | 851881b6addae55ecb2f2c02383962f2ca1baab4 (patch) | |
tree | 117bc357c78906fdff5fb81358a08305bf92f4fa /chrome/browser/extensions/app_notification_manager_unittest.cc | |
parent | 8866f623dfd914c9f4c26ab96f90aecf4a372ef9 (diff) | |
download | chromium_src-851881b6addae55ecb2f2c02383962f2ca1baab4.zip chromium_src-851881b6addae55ecb2f2c02383962f2ca1baab4.tar.gz chromium_src-851881b6addae55ecb2f2c02383962f2ca1baab4.tar.bz2 |
Implement SyncableService in AppNotificationsManager:
- Implement all methods of SyncableService
- Modify existing methods that change the model (Add and ClearAll) to push changes to sync.
- Add some extra properties to AppNotification: guid and extension id
- Disallow operations on model until storage is loaded.
- Ton of unit tests for sync methods
There is anotehr part for the full notifications sync to work that will be done in a separate CL.
Review URL: http://codereview.chromium.org/8263002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@106110 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/app_notification_manager_unittest.cc')
-rw-r--r-- | chrome/browser/extensions/app_notification_manager_unittest.cc | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/chrome/browser/extensions/app_notification_manager_unittest.cc b/chrome/browser/extensions/app_notification_manager_unittest.cc index 37aa6c6..cdc2ea0 100644 --- a/chrome/browser/extensions/app_notification_manager_unittest.cc +++ b/chrome/browser/extensions/app_notification_manager_unittest.cc @@ -71,14 +71,18 @@ class AppNotificationManagerTest : public testing::Test { TEST_F(AppNotificationManagerTest, Simple) { std::string id = extension_test_util::MakeId("whatever"); AppNotificationList list; - util::AddNotifications(&list, 2, "foo"); - util::AddCopiesFromList(mgr_.get(), id, list); + util::AddNotifications(&list, id, 2, "foo"); + EXPECT_TRUE(util::AddCopiesFromList(mgr_.get(), list)); // Cause |mgr_| to be recreated, re-reading from its storage. InitializeManager(); const AppNotification* tmp = mgr_->GetLast(id); - EXPECT_TRUE(tmp && list[1]->Equals(*tmp)); + ASSERT_TRUE(tmp); + EXPECT_EQ(list[1]->guid(), tmp->guid()); + EXPECT_EQ(list[1]->extension_id(), tmp->extension_id()); + EXPECT_EQ(list[1]->is_local(), tmp->is_local()); + EXPECT_TRUE(list[1]->Equals(*tmp)); const AppNotificationList* tmp_list = mgr_->GetAll(id); ASSERT_TRUE(tmp_list != NULL); util::ExpectListsEqual(list, *tmp_list); @@ -101,10 +105,10 @@ TEST_F(AppNotificationManagerTest, MAYBE_ExtensionUninstall) { std::string id2 = extension_test_util::MakeId("id2"); AppNotificationList list1; AppNotificationList list2; - util::AddNotifications(&list1, 5, "foo1"); - util::AddNotifications(&list2, 3, "foo2"); - util::AddCopiesFromList(mgr_.get(), id1, list1); - util::AddCopiesFromList(mgr_.get(), id2, list2); + util::AddNotifications(&list1, id1, 5, "foo1"); + util::AddNotifications(&list2, id2, 3, "foo2"); + util::AddCopiesFromList(mgr_.get(), list1); + util::AddCopiesFromList(mgr_.get(), list2); util::ExpectListsEqual(list1, *mgr_->GetAll(id1)); util::ExpectListsEqual(list2, *mgr_->GetAll(id2)); |