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

Unified Diff: chrome/browser/extensions/api/synced_notifications_private/synced_notifications_shim_unittest.cc

Issue 411463003: [Sync] Trigger refresh for synced notifications on context change (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Self review Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/synced_notifications_private/synced_notifications_shim_unittest.cc
diff --git a/chrome/browser/extensions/api/synced_notifications_private/synced_notifications_shim_unittest.cc b/chrome/browser/extensions/api/synced_notifications_private/synced_notifications_shim_unittest.cc
index 3a635c7af7a850514735504fbc35066355d808a8..5f776552de0880f96a96626087ce0215863afe2c 100644
--- a/chrome/browser/extensions/api/synced_notifications_private/synced_notifications_shim_unittest.cc
+++ b/chrome/browser/extensions/api/synced_notifications_private/synced_notifications_shim_unittest.cc
@@ -81,6 +81,9 @@ class SyncedNotificationsShimTest : public testing::Test {
// Transfers ownership of the last event received.
scoped_ptr<Event> GetLastEvent();
+ // Records that a refresh has been requested.
+ void RequestRefresh();
+
SyncedNotificationsShim* shim() { return &shim_; }
syncer::FakeSyncChangeProcessor* notification_processor() {
return notification_processor_;
@@ -88,6 +91,7 @@ class SyncedNotificationsShimTest : public testing::Test {
syncer::FakeSyncChangeProcessor* app_info_processor() {
return app_info_processor_;
}
+ bool refresh_requested() const { return refresh_requested_; }
private:
void EventCallback(scoped_ptr<Event> event);
@@ -100,13 +104,19 @@ class SyncedNotificationsShimTest : public testing::Test {
// The last event fired by the shim.
scoped_ptr<Event> last_event_fired_;
+
+ // Whether a refresh has been requested;
+ bool refresh_requested_;
};
SyncedNotificationsShimTest::SyncedNotificationsShimTest()
: shim_(base::Bind(&SyncedNotificationsShimTest::EventCallback,
+ base::Unretained(this)),
+ base::Bind(&SyncedNotificationsShimTest::RequestRefresh,
base::Unretained(this))),
notification_processor_(NULL),
- app_info_processor_(NULL) {}
+ app_info_processor_(NULL),
+ refresh_requested_(false) {}
SyncedNotificationsShimTest::~SyncedNotificationsShimTest() {}
@@ -115,6 +125,11 @@ void SyncedNotificationsShimTest::EventCallback(scoped_ptr<Event> event) {
last_event_fired_ = event.Pass();
}
+void SyncedNotificationsShimTest::RequestRefresh() {
+ ASSERT_FALSE(refresh_requested_);
+ refresh_requested_ = true;
+}
+
scoped_ptr<Event> SyncedNotificationsShimTest::GetLastEvent() {
return last_event_fired_.Pass();
}
@@ -320,12 +335,14 @@ TEST_F(SyncedNotificationsShimTest, SetRenderContext) {
const std::string kContext = "context";
EXPECT_FALSE(shim()->SetRenderContext(
synced_notifications_private::REFRESH_REQUEST_REFRESH_NEEDED, kContext));
+ EXPECT_FALSE(refresh_requested());
StartSync();
EXPECT_TRUE(shim()->SetRenderContext(
synced_notifications_private::REFRESH_REQUEST_REFRESH_NEEDED, kContext));
EXPECT_EQ(kContext, notification_processor()->context());
+ EXPECT_TRUE(refresh_requested());
}
} // namespace

Powered by Google App Engine
This is Rietveld 408576698