| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/string_number_conversions.h" | 5 #include "base/string_number_conversions.h" |
| 6 #include "chrome/browser/extensions/app_notification_manager.h" | 6 #include "chrome/browser/extensions/app_notification_manager.h" |
| 7 #include "chrome/browser/extensions/app_notification_test_util.h" | 7 #include "chrome/browser/extensions/app_notification_test_util.h" |
| 8 #include "chrome/common/extensions/extension.h" | 8 #include "chrome/common/extensions/extension.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 void AddNotifications(AppNotificationList* list, | 23 void AddNotifications(AppNotificationList* list, |
| 24 const std::string& extension_id, | 24 const std::string& extension_id, |
| 25 int count, | 25 int count, |
| 26 const std::string& prefix) { | 26 const std::string& prefix) { |
| 27 for (int i = 0; i < count; i++) { | 27 for (int i = 0; i < count; i++) { |
| 28 std::string guid = prefix + "_guid_" + IntToString(i); | 28 std::string guid = prefix + "_guid_" + IntToString(i); |
| 29 std::string title = prefix + "_title_" + IntToString(i); | 29 std::string title = prefix + "_title_" + IntToString(i); |
| 30 std::string body = prefix + "_body_" + IntToString(i); | 30 std::string body = prefix + "_body_" + IntToString(i); |
| 31 AppNotification* item = new AppNotification( | 31 AppNotification* item = new AppNotification( |
| 32 true, guid, extension_id, title, body); | 32 true, base::Time::Now(), guid, extension_id, title, body); |
| 33 if (i % 2 == 0) { | 33 if (i % 2 == 0) { |
| 34 item->set_link_url(GURL("http://www.example.com/" + prefix)); | 34 item->set_link_url(GURL("http://www.example.com/" + prefix)); |
| 35 item->set_link_text(prefix + "_link_" + IntToString(i)); | 35 item->set_link_text(prefix + "_link_" + IntToString(i)); |
| 36 } | 36 } |
| 37 list->push_back(linked_ptr<AppNotification>(item)); | 37 list->push_back(linked_ptr<AppNotification>(item)); |
| 38 } | 38 } |
| 39 } | 39 } |
| 40 | 40 |
| 41 bool AddCopiesFromList(AppNotificationManager* manager, | 41 bool AddCopiesFromList(AppNotificationManager* manager, |
| 42 const AppNotificationList& list) { | 42 const AppNotificationList& list) { |
| 43 bool result = true; | 43 bool result = true; |
| 44 for (AppNotificationList::const_iterator i = list.begin(); | 44 for (AppNotificationList::const_iterator i = list.begin(); |
| 45 i != list.end(); | 45 i != list.end(); |
| 46 ++i) { | 46 ++i) { |
| 47 result = result && manager->Add((*i)->Copy()); | 47 result = result && manager->Add((*i)->Copy()); |
| 48 } | 48 } |
| 49 return result; | 49 return result; |
| 50 } | 50 } |
| 51 | 51 |
| 52 } // namespace app_notification_test_util | 52 } // namespace app_notification_test_util |
| OLD | NEW |