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

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

Issue 20136004: Allow partial update for notification update API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add more tests per feedback Created 7 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 unified diff | Download patch | Annotate | Revision Log
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/strings/utf_string_conversions.h" 8 #include "base/strings/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"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 // Adds a notification to be displayed. Virtual for unit test override. 58 // Adds a notification to be displayed. Virtual for unit test override.
59 virtual void Add(const Notification& notification, Profile* profile) 59 virtual void Add(const Notification& notification, Profile* profile)
60 OVERRIDE { 60 OVERRIDE {
61 // Make a deep copy of the notification that we can inspect. 61 // Make a deep copy of the notification that we can inspect.
62 notification_ = notification; 62 notification_ = notification;
63 profile_ = profile; 63 profile_ = profile;
64 } 64 }
65 65
66 // Returns true if any notifications match the supplied ID, either currently 66 // Returns true if any notifications match the supplied ID, either currently
67 // displayed or in the queue. 67 // displayed or in the queue.
68 virtual bool DoesIdExist(const std::string& id) OVERRIDE { 68 virtual const Notification* FindById(const std::string& id) const OVERRIDE {
69 return true; 69 return (notification_.id() == id) ? &notification_ : NULL;
70 } 70 }
71 71
72 // Removes any notifications matching the supplied ID, either currently 72 // Removes any notifications matching the supplied ID, either currently
73 // displayed or in the queue. Returns true if anything was removed. 73 // displayed or in the queue. Returns true if anything was removed.
74 virtual bool CancelById(const std::string& notification_id) OVERRIDE { 74 virtual bool CancelById(const std::string& notification_id) OVERRIDE {
75 dismissed_id_ = notification_id; 75 dismissed_id_ = notification_id;
76 return true; 76 return true;
77 } 77 }
78 78
79 // Adds the notification_id for each outstanding notification to the set 79 // Adds the notification_id for each outstanding notification to the set
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 EXPECT_EQ(std::string(kTitle2), notification1->GetTitle()); 484 EXPECT_EQ(std::string(kTitle2), notification1->GetTitle());
485 485
486 // Ensure no new data will be sent to the remote store for notification1. 486 // Ensure no new data will be sent to the remote store for notification1.
487 EXPECT_EQ(0U, processor()->change_list_size()); 487 EXPECT_EQ(0U, processor()->change_list_size());
488 EXPECT_FALSE(processor()->ContainsId(kKey1)); 488 EXPECT_FALSE(processor()->ContainsId(kKey1));
489 } 489 }
490 490
491 // TODO(petewil): There are more tests to add, such as when we add an API 491 // TODO(petewil): There are more tests to add, such as when we add an API
492 // to allow data entry from the client, we might have a more up to date 492 // to allow data entry from the client, we might have a more up to date
493 // item on the client than the server, or we might have a merge conflict. 493 // item on the client than the server, or we might have a merge conflict.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698