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

Side by Side Diff: chrome/browser/extensions/app_notification_test_util.cc

Issue 8567018: Limit number of notifications that can be received by the client. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 9 years, 1 month 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) 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
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, count, guid, extension_id, title, body);
asargent_no_longer_on_chrome 2011/11/17 23:40:14 does this still compile with the switch to Time? M
elvin 2011/11/18 00:10:18 Done.
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698