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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #ifndef CHROME_BROWSER_NOTIFICATIONS_SYNC_NOTIFIER_SYNC_NOTIFIER_TEST_UTILS_H_ 5 #ifndef CHROME_BROWSER_NOTIFICATIONS_SYNC_NOTIFIER_SYNC_NOTIFIER_TEST_UTILS_H_
6 #define CHROME_BROWSER_NOTIFICATIONS_SYNC_NOTIFIER_SYNC_NOTIFIER_TEST_UTILS_H_ 6 #define CHROME_BROWSER_NOTIFICATIONS_SYNC_NOTIFIER_SYNC_NOTIFIER_TEST_UTILS_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "chrome/browser/notifications/sync_notifier/synced_notification_app_inf o_service.h"
11 #include "sync/api/sync_data.h" 12 #include "sync/api/sync_data.h"
12 #include "sync/protocol/sync.pb.h" 13 #include "sync/protocol/sync.pb.h"
13 #include "sync/protocol/synced_notification_specifics.pb.h" 14 #include "sync/protocol/synced_notification_specifics.pb.h"
14 15
16 // Test data for App Info structures.
17 extern const char kSendingService1Name[];
18 extern const char kSendingService2Name[];
19 extern const char kSendingService3Name[];
20 extern const char kTestIconUrl[];
15 21
16 // Fake data for creating a SyncedNotification. 22 // Fake data for creating a SyncedNotification.
17 extern const char kAppId1[]; 23 extern const char kAppId1[];
18 extern const char kAppId2[]; 24 extern const char kAppId2[];
19 extern const char kAppId3[]; 25 extern const char kAppId3[];
20 extern const char kAppId4[]; 26 extern const char kAppId4[];
21 extern const char kAppId5[]; 27 extern const char kAppId5[];
22 extern const char kAppId6[]; 28 extern const char kAppId6[];
23 extern const char kAppId7[]; 29 extern const char kAppId7[];
24 extern const char kKey1[]; 30 extern const char kKey1[];
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 // notification. 94 // notification.
89 syncer::SyncData CreateSyncData( 95 syncer::SyncData CreateSyncData(
90 const std::string& title, 96 const std::string& title,
91 const std::string& text, 97 const std::string& text,
92 const std::string& app_icon_url, 98 const std::string& app_icon_url,
93 const std::string& image_url, 99 const std::string& image_url,
94 const std::string& app_id, 100 const std::string& app_id,
95 const std::string& key, 101 const std::string& key,
96 const sync_pb::CoalescedSyncedNotification_ReadState read_state); 102 const sync_pb::CoalescedSyncedNotification_ReadState read_state);
97 103
104 namespace notifier {
105
106 // Stub out the SyncedNotificationAppInfoService. This is used to
107 // 1. Verify that when bitmaps are fetched, the OnFetchComplete causes a call to
108 // OnBitmapFetchesDone.
109 // 2. Provide the app info for our first sending service.
110 class StubSyncedNotificationAppInfoService
111 : public SyncedNotificationAppInfoService {
112 public:
113 // Interface functions from SyncedNotificationAppInfoService
114 explicit StubSyncedNotificationAppInfoService(Profile* profile);
115 virtual ~StubSyncedNotificationAppInfoService();
116 virtual void Shutdown() OVERRIDE{}
117 virtual syncer::SyncMergeResult MergeDataAndStartSyncing(
118 syncer::ModelType type,
119 const syncer::SyncDataList& initial_sync_data,
120 scoped_ptr<syncer::SyncChangeProcessor> sync_processor,
121 scoped_ptr<syncer::SyncErrorFactory> error_handler) OVERRIDE;
122 virtual void StopSyncing(syncer::ModelType type) OVERRIDE{}
123 virtual syncer::SyncError ProcessSyncChanges(
124 const tracked_objects::Location& from_here,
125 const syncer::SyncChangeList& change_list) OVERRIDE;
126 virtual syncer::SyncDataList GetAllSyncData(syncer::ModelType type) const
127 OVERRIDE;
128 void ProcessIncomingAppInfoProtobuf(
129 const sync_pb::SyncedNotificationAppInfo& app_info) {}
130 void ProcessRemovedAppInfoProtobuf(
131 const sync_pb::SyncedNotificationAppInfo& app_info) {}
132 // Remember the arguments we saw in the most recent call.
133 virtual void OnBitmapFetchesDone(std::vector<std::string> added_app_ids,
134 std::vector<std::string> removed_app_ids)
135 OVERRIDE;
136 scoped_ptr<SyncedNotificationAppInfo>
137 CreateSyncedNotificationAppInfoFromProtobuf(
138 const sync_pb::SyncedNotificationAppInfo& app_info);
139 SyncedNotificationAppInfo* FindSyncedNotificationAppInfoByName(
140 const std::string& name);
141 SyncedNotificationAppInfo* FindSyncedNotificationAppInfoByAppId(
142 const std::string& app_id);
143 std::string FindSendingServiceNameFromAppId(const std::string app_id);
144 std::vector<std::string> GetAllSendingServiceNames();
145 void AddForTest(
146 scoped_ptr<notifier::SyncedNotificationAppInfo> sending_service_info) {}
147 static void set_avoid_bitmap_fetching_for_test(bool avoid) {}
148
149 // Probe functions to return data.
150 std::vector<std::string> added_app_ids();
151 std::vector<std::string> removed_app_ids();
152 bool on_bitmap_fetches_done_called();
153
154 private:
155 std::vector<std::string> added_app_ids_;
156 std::vector<std::string> removed_app_ids_;
157 bool on_bitmap_fetches_done_called_;
158 };
159
160 } // namespace notifier
161
98 #endif // CHROME_BROWSER_NOTIFICATIONS_SYNC_NOTIFIER_SYNC_NOTIFIER_TEST_UTILS_H _ 162 #endif // CHROME_BROWSER_NOTIFICATIONS_SYNC_NOTIFIER_SYNC_NOTIFIER_TEST_UTILS_H _
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698