OLD | NEW |
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 #include "base/memory/scoped_vector.h" | 5 #include "base/memory/scoped_vector.h" |
6 #include "chrome/browser/chrome_notification_types.h" | 6 #include "chrome/browser/chrome_notification_types.h" |
7 #include "chrome/browser/notifications/sync_notifier/chrome_notifier_delegate.h" | 7 #include "chrome/browser/notifications/sync_notifier/chrome_notifier_delegate.h" |
8 #include "chrome/browser/notifications/sync_notifier/chrome_notifier_service.h" | 8 #include "chrome/browser/notifications/sync_notifier/chrome_notifier_service.h" |
9 #include "chrome/browser/notifications/sync_notifier/sync_notifier_test_utils.h" | 9 #include "chrome/browser/notifications/sync_notifier/sync_notifier_test_utils.h" |
10 #include "chrome/browser/notifications/sync_notifier/synced_notification.h" | 10 #include "chrome/browser/notifications/sync_notifier/synced_notification.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 const std::string& image_url, | 38 const std::string& image_url, |
39 const std::string& app_id, | 39 const std::string& app_id, |
40 const std::string& key, | 40 const std::string& key, |
41 sync_pb::CoalescedSyncedNotification_ReadState read_state) { | 41 sync_pb::CoalescedSyncedNotification_ReadState read_state) { |
42 syncer::SyncData sync_data = CreateSyncData(title, text, app_icon_url, | 42 syncer::SyncData sync_data = CreateSyncData(title, text, app_icon_url, |
43 image_url,app_id, key, | 43 image_url,app_id, key, |
44 read_state); | 44 read_state); |
45 // Set enough fields in sync_data, including specifics, for our tests | 45 // Set enough fields in sync_data, including specifics, for our tests |
46 // to pass. | 46 // to pass. |
47 notifier::SyncedNotification* notification = | 47 notifier::SyncedNotification* notification = |
48 new notifier::SyncedNotification(sync_data); | 48 new notifier::SyncedNotification(sync_data, this, NULL); |
49 // Retain ownership to avoid memory leaks in tests. | 49 // Retain ownership to avoid memory leaks in tests. |
50 owned_notifications_.push_back(notification); | 50 owned_notifications_.push_back(notification); |
51 return notification; | 51 return notification; |
52 } | 52 } |
53 | 53 |
54 // For testing, just return our test notification no matter what key the | 54 // For testing, just return our test notification no matter what key the |
55 // caller sends. | 55 // caller sends. |
56 virtual notifier::SyncedNotification* FindNotificationById( | 56 virtual notifier::SyncedNotification* FindNotificationById( |
57 const std::string& id) OVERRIDE { | 57 const std::string& id) OVERRIDE { |
58 return CreateNotification( | 58 return CreateNotification( |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 std::string id(kTestNotificationId); | 154 std::string id(kTestNotificationId); |
155 scoped_refptr<notifier::ChromeNotifierDelegate> delegate( | 155 scoped_refptr<notifier::ChromeNotifierDelegate> delegate( |
156 new notifier::ChromeNotifierDelegate(id, notifier())); | 156 new notifier::ChromeNotifierDelegate(id, notifier())); |
157 | 157 |
158 delegate->Close(false); | 158 delegate->Close(false); |
159 ASSERT_EQ("", notifier()->read_id()); | 159 ASSERT_EQ("", notifier()->read_id()); |
160 | 160 |
161 delegate->Close(true); | 161 delegate->Close(true); |
162 ASSERT_EQ(kTestNotificationId, notifier()->read_id()); | 162 ASSERT_EQ(kTestNotificationId, notifier()->read_id()); |
163 } | 163 } |
OLD | NEW |