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

Side by Side Diff: content/public/test/test_notification_tracker.cc

Issue 13533007: Test extension reloading behavior. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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) 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 "content/public/test/test_notification_tracker.h" 5 #include "content/public/test/test_notification_tracker.h"
6 6
7 #include "content/public/browser/notification_service.h" 7 #include "content/public/browser/notification_service.h"
8 #include "content/public/browser/notification_types.h" 8 #include "content/public/browser/notification_types.h"
9 9
10 namespace content { 10 namespace content {
(...skipping 16 matching lines...) Expand all
27 27
28 TestNotificationTracker::~TestNotificationTracker() { 28 TestNotificationTracker::~TestNotificationTracker() {
29 } 29 }
30 30
31 void TestNotificationTracker::ListenFor( 31 void TestNotificationTracker::ListenFor(
32 int type, 32 int type,
33 const NotificationSource& source) { 33 const NotificationSource& source) {
34 registrar_.Add(this, type, source); 34 registrar_.Add(this, type, source);
35 } 35 }
36 36
37 void TestNotificationTracker::ListenForAll(
38 int type) {
39 registrar_.Add(this, type,
40 NotificationService::AllBrowserContextsAndSources());
41 }
42
37 void TestNotificationTracker::Reset() { 43 void TestNotificationTracker::Reset() {
38 events_.clear(); 44 events_.clear();
39 } 45 }
40 46
41 bool TestNotificationTracker::Check1AndReset(int type) { 47 bool TestNotificationTracker::Check1AndReset(int type) {
42 if (size() != 1) { 48 if (size() != 1) {
43 Reset(); 49 Reset();
44 return false; 50 return false;
45 } 51 }
46 bool success = events_[0].type == type; 52 bool success = events_[0].type == type;
(...skipping 19 matching lines...) Expand all
66 Reset(); 72 Reset();
67 return false; 73 return false;
68 } 74 }
69 bool success = events_[0].type == type1 && 75 bool success = events_[0].type == type1 &&
70 events_[1].type == type2 && 76 events_[1].type == type2 &&
71 events_[2].type == type3; 77 events_[2].type == type3;
72 Reset(); 78 Reset();
73 return success; 79 return success;
74 } 80 }
75 81
82 std::vector<int> TestNotificationTracker::GetTypes() const {
83 std::vector<int> types;
84 for (size_t i = 0; i < size(); ++i)
85 types.push_back(at(i).type);
86 return types;
87 }
88
76 void TestNotificationTracker::Observe( 89 void TestNotificationTracker::Observe(
77 int type, 90 int type,
78 const NotificationSource& source, 91 const NotificationSource& source,
79 const NotificationDetails& details) { 92 const NotificationDetails& details) {
80 events_.push_back(Event(type, source, details)); 93 events_.push_back(Event(type, source, details));
81 } 94 }
82 95
83 } // namespace content 96 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698