Index: content/public/test/test_notification_tracker.h |
diff --git a/content/public/test/test_notification_tracker.h b/content/public/test/test_notification_tracker.h |
index f34fdae614da5b8acd16eea4985cab6c5b41bda9..13cebd64a967aa22f4313d6b2821afcf1aa6a4e0 100644 |
--- a/content/public/test/test_notification_tracker.h |
+++ b/content/public/test/test_notification_tracker.h |
@@ -45,6 +45,9 @@ class TestNotificationTracker : public NotificationObserver { |
// Clears the list of events. |
void Reset(); |
+ // TODO(jyasskin): Replace calls to Check*AndReset() with |
+ // EXPECT_THAT(GetTypesAndReset()). |
+ // |
// Given notifications type(sp, returns true if the list of notifications |
// were exactly those listed in the given arg(s), and in the same order. |
// |
@@ -61,6 +64,20 @@ class TestNotificationTracker : public NotificationObserver { |
int type2, |
int type3); |
+ // Returns the types of the received notifications in order. Usable |
+ // with EXPECT_THAT(ElementsAre): |
+ // EXPECT_THAT(tracker.GetTypesAndReset(), |
+ // testing::ElementsAre(content::NOTIFICATION_LOAD_START, ...)); |
+ std::vector<int> GetTypes() const; |
+ |
+ // Like GetTypes, but also calls Reset() so that the next call will |
+ // only check for new notifications. |
+ std::vector<int> GetTypesAndReset() { |
+ std::vector<int> result = GetTypes(); |
+ Reset(); |
+ return result; |
+ } |
+ |
// Returns the number of notifications received since the last reset. |
size_t size() const { return events_.size(); } |