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

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

Issue 10830036: Moved the AppNotification system into extensions namespace (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Latest master for cq Created 8 years, 4 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) 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
11 using base::IntToString; 11 using base::IntToString;
12 using extensions::AppNotification;
13 using extensions::AppNotificationList;
12 14
13 namespace app_notification_test_util { 15 namespace app_notification_test_util {
14 16
15 void ExpectListsEqual(const AppNotificationList& one, 17 void ExpectListsEqual(const AppNotificationList& one,
16 const AppNotificationList& two) { 18 const AppNotificationList& two) {
17 ASSERT_EQ(one.size(), two.size()); 19 ASSERT_EQ(one.size(), two.size());
18 for (size_t i = 0; i < one.size(); i++) { 20 for (size_t i = 0; i < one.size(); i++) {
19 ASSERT_TRUE(one[i]->Equals(*two[i])); 21 ASSERT_TRUE(one[i]->Equals(*two[i]));
20 } 22 }
21 } 23 }
22 24
23 void AddNotifications(AppNotificationList* list, 25 void AddNotifications(AppNotificationList* list,
24 const std::string& extension_id, 26 const std::string& extension_id,
25 int count, 27 int count,
26 const std::string& prefix) { 28 const std::string& prefix) {
27 for (int i = 0; i < count; i++) { 29 for (int i = 0; i < count; i++) {
28 std::string guid = prefix + "_guid_" + IntToString(i); 30 std::string guid = prefix + "_guid_" + IntToString(i);
29 std::string title = prefix + "_title_" + IntToString(i); 31 std::string title = prefix + "_title_" + IntToString(i);
30 std::string body = prefix + "_body_" + IntToString(i); 32 std::string body = prefix + "_body_" + IntToString(i);
31 AppNotification* item = new AppNotification( 33 AppNotification* item = new AppNotification(
32 true, base::Time::Now(), guid, extension_id, title, body); 34 true, base::Time::Now(), guid, extension_id, title, body);
33 if (i % 2 == 0) { 35 if (i % 2 == 0) {
34 item->set_link_url(GURL("http://www.example.com/" + prefix)); 36 item->set_link_url(GURL("http://www.example.com/" + prefix));
35 item->set_link_text(prefix + "_link_" + IntToString(i)); 37 item->set_link_text(prefix + "_link_" + IntToString(i));
36 } 38 }
37 list->push_back(linked_ptr<AppNotification>(item)); 39 list->push_back(linked_ptr<AppNotification>(item));
38 } 40 }
39 } 41 }
40 42
41 bool AddCopiesFromList(AppNotificationManager* manager, 43 bool AddCopiesFromList(extensions::AppNotificationManager* manager,
42 const AppNotificationList& list) { 44 const AppNotificationList& list) {
43 bool result = true; 45 bool result = true;
44 for (AppNotificationList::const_iterator i = list.begin(); 46 for (AppNotificationList::const_iterator i = list.begin();
45 i != list.end(); 47 i != list.end();
46 ++i) { 48 ++i) {
47 result = result && manager->Add((*i)->Copy()); 49 result = result && manager->Add((*i)->Copy());
48 } 50 }
49 return result; 51 return result;
50 } 52 }
51 53
52 } // namespace app_notification_test_util 54 } // namespace app_notification_test_util
OLDNEW
« no previous file with comments | « chrome/browser/extensions/app_notification_test_util.h ('k') | chrome/browser/extensions/app_notify_channel_setup.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698