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

Side by Side Diff: chrome/browser/notifications/sync_notifier/chrome_notifier_service_unittest.cc

Issue 14631005: Enable users of NotificationUIManager to specify binary images. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase for relanding. Created 7 years, 6 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include <map> 5 #include <map>
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chrome/browser/notifications/notification.h" 10 #include "chrome/browser/notifications/notification.h"
11 #include "chrome/browser/notifications/notification_test_util.h"
11 #include "chrome/browser/notifications/notification_ui_manager.h" 12 #include "chrome/browser/notifications/notification_ui_manager.h"
12 #include "chrome/browser/notifications/sync_notifier/chrome_notifier_service.h" 13 #include "chrome/browser/notifications/sync_notifier/chrome_notifier_service.h"
13 #include "chrome/browser/notifications/sync_notifier/synced_notification.h" 14 #include "chrome/browser/notifications/sync_notifier/synced_notification.h"
14 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
15 #include "sync/api/sync_change.h" 16 #include "sync/api/sync_change.h"
16 #include "sync/api/sync_change_processor.h" 17 #include "sync/api/sync_change_processor.h"
17 #include "sync/api/sync_error_factory.h" 18 #include "sync/api/sync_error_factory.h"
18 #include "sync/api/sync_error_factory_mock.h" 19 #include "sync/api/sync_error_factory_mock.h"
19 #include "sync/protocol/sync.pb.h" 20 #include "sync/protocol/sync.pb.h"
20 #include "sync/protocol/synced_notification_specifics.pb.h" 21 #include "sync/protocol/synced_notification_specifics.pb.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 std::string GetNotificationId(const SyncData& sync_data) { 108 std::string GetNotificationId(const SyncData& sync_data) {
108 SyncedNotificationSpecifics specifics = sync_data.GetSpecifics(). 109 SyncedNotificationSpecifics specifics = sync_data.GetSpecifics().
109 synced_notification(); 110 synced_notification();
110 111
111 return specifics.coalesced_notification().key(); 112 return specifics.coalesced_notification().key();
112 } 113 }
113 114
114 // Stub out the NotificationUIManager for unit testing. 115 // Stub out the NotificationUIManager for unit testing.
115 class StubNotificationUIManager : public NotificationUIManager { 116 class StubNotificationUIManager : public NotificationUIManager {
116 public: 117 public:
117 StubNotificationUIManager() : notification_(GURL(), GURL(), string16(), 118 StubNotificationUIManager()
118 string16(), NULL) {} 119 : notification_(GURL(),
120 GURL(),
121 string16(),
122 string16(),
123 new MockNotificationDelegate("stub")) {}
119 virtual ~StubNotificationUIManager() {} 124 virtual ~StubNotificationUIManager() {}
120 125
121 // Adds a notification to be displayed. Virtual for unit test override. 126 // Adds a notification to be displayed. Virtual for unit test override.
122 virtual void Add(const Notification& notification, Profile* profile) 127 virtual void Add(const Notification& notification, Profile* profile)
123 OVERRIDE { 128 OVERRIDE {
124 // Make a deep copy of the notification that we can inspect. 129 // Make a deep copy of the notification that we can inspect.
125 notification_ = notification; 130 notification_ = notification;
126 profile_ = profile; 131 profile_ = profile;
127 } 132 }
128 133
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
769 EXPECT_EQ(kTitle2, notification1->GetTitle()); 774 EXPECT_EQ(kTitle2, notification1->GetTitle());
770 775
771 // Ensure no new data will be sent to the remote store for notification1. 776 // Ensure no new data will be sent to the remote store for notification1.
772 EXPECT_EQ(0U, processor()->change_list_size()); 777 EXPECT_EQ(0U, processor()->change_list_size());
773 EXPECT_FALSE(processor()->ContainsId(kKey1)); 778 EXPECT_FALSE(processor()->ContainsId(kKey1));
774 } 779 }
775 780
776 // TODO(petewil): There are more tests to add, such as when we add an API 781 // TODO(petewil): There are more tests to add, such as when we add an API
777 // to allow data entry from the client, we might have a more up to date 782 // to allow data entry from the client, we might have a more up to date
778 // item on the client than the server, or we might have a merge conflict. 783 // item on the client than the server, or we might have a merge conflict.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698