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

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

Powered by Google App Engine
This is Rietveld 408576698