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

Unified Diff: chrome/browser/notifications/sync_notifier/sync_notifier_test_utils.h

Issue 193773003: Turn on and use the AppInfo data. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Turn on app info: Refactoring the image holders Created 6 years, 9 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/notifications/sync_notifier/sync_notifier_test_utils.h
diff --git a/chrome/browser/notifications/sync_notifier/sync_notifier_test_utils.h b/chrome/browser/notifications/sync_notifier/sync_notifier_test_utils.h
index 4bd88975c53003358b2100814527d7a12723f15d..70b6ac47aa6d57096a862c22e6d9e870cdf3a70b 100644
--- a/chrome/browser/notifications/sync_notifier/sync_notifier_test_utils.h
+++ b/chrome/browser/notifications/sync_notifier/sync_notifier_test_utils.h
@@ -8,10 +8,16 @@
#include <string>
#include "base/basictypes.h"
+#include "chrome/browser/notifications/sync_notifier/synced_notification_app_info_service.h"
#include "sync/api/sync_data.h"
#include "sync/protocol/sync.pb.h"
#include "sync/protocol/synced_notification_specifics.pb.h"
+// Test data for App Info structures.
+extern const char kSendingService1Name[];
+extern const char kSendingService2Name[];
+extern const char kSendingService3Name[];
+extern const char kTestIconUrl[];
// Fake data for creating a SyncedNotification.
extern const char kAppId1[];
@@ -95,4 +101,62 @@ syncer::SyncData CreateSyncData(
const std::string& key,
const sync_pb::CoalescedSyncedNotification_ReadState read_state);
+namespace notifier {
+
+// Stub out the SyncedNotificationAppInfoService. This is used to
+// 1. Verify that when bitmaps are fetched, the OnFetchComplete causes a call to
+// OnBitmapFetchesDone.
+// 2. Provide the app info for our first sending service.
+class StubSyncedNotificationAppInfoService
+ : public SyncedNotificationAppInfoService {
+ public:
+ // Interface functions from SyncedNotificationAppInfoService
+ explicit StubSyncedNotificationAppInfoService(Profile* profile);
+ virtual ~StubSyncedNotificationAppInfoService();
+ virtual void Shutdown() OVERRIDE{}
+ virtual syncer::SyncMergeResult MergeDataAndStartSyncing(
+ syncer::ModelType type,
+ const syncer::SyncDataList& initial_sync_data,
+ scoped_ptr<syncer::SyncChangeProcessor> sync_processor,
+ scoped_ptr<syncer::SyncErrorFactory> error_handler) OVERRIDE;
+ virtual void StopSyncing(syncer::ModelType type) OVERRIDE{}
+ virtual syncer::SyncError ProcessSyncChanges(
+ const tracked_objects::Location& from_here,
+ const syncer::SyncChangeList& change_list) OVERRIDE;
+ virtual syncer::SyncDataList GetAllSyncData(syncer::ModelType type) const
+ OVERRIDE;
+ void ProcessIncomingAppInfoProtobuf(
+ const sync_pb::SyncedNotificationAppInfo& app_info) {}
+ void ProcessRemovedAppInfoProtobuf(
+ const sync_pb::SyncedNotificationAppInfo& app_info) {}
+ // Remember the arguments we saw in the most recent call.
+ virtual void OnBitmapFetchesDone(std::vector<std::string> added_app_ids,
+ std::vector<std::string> removed_app_ids)
+ OVERRIDE;
+ scoped_ptr<SyncedNotificationAppInfo>
+ CreateSyncedNotificationAppInfoFromProtobuf(
+ const sync_pb::SyncedNotificationAppInfo& app_info);
+ SyncedNotificationAppInfo* FindSyncedNotificationAppInfoByName(
+ const std::string& name);
+ SyncedNotificationAppInfo* FindSyncedNotificationAppInfoByAppId(
+ const std::string& app_id);
+ std::string FindSendingServiceNameFromAppId(const std::string app_id);
+ std::vector<std::string> GetAllSendingServiceNames();
+ void AddForTest(
+ scoped_ptr<notifier::SyncedNotificationAppInfo> sending_service_info) {}
+ static void set_avoid_bitmap_fetching_for_test(bool avoid) {}
+
+ // Probe functions to return data.
+ std::vector<std::string> added_app_ids();
+ std::vector<std::string> removed_app_ids();
+ bool on_bitmap_fetches_done_called();
+
+ private:
+ std::vector<std::string> added_app_ids_;
+ std::vector<std::string> removed_app_ids_;
+ bool on_bitmap_fetches_done_called_;
+};
+
+} // namespace notifier
+
#endif // CHROME_BROWSER_NOTIFICATIONS_SYNC_NOTIFIER_SYNC_NOTIFIER_TEST_UTILS_H_

Powered by Google App Engine
This is Rietveld 408576698