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

Unified Diff: extensions/browser/event_listener_map_unittest.cc

Issue 598173003: Run clang-modernize -use-nullptr over src/extensions/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: extensions/browser/event_listener_map_unittest.cc
diff --git a/extensions/browser/event_listener_map_unittest.cc b/extensions/browser/event_listener_map_unittest.cc
index 3a45c682fdef5e75bde1182276e081469a8c7434..2af5f23bab38700af73b13bfd5934ff6cd3803f3 100644
--- a/extensions/browser/event_listener_map_unittest.cc
+++ b/extensions/browser/event_listener_map_unittest.cc
@@ -66,8 +66,11 @@ class EventListenerMapTest : public testing::Test {
EventFilteringInfo info;
info.SetURL(url);
scoped_ptr<Event> result(new Event(event_name,
- make_scoped_ptr(new ListValue()), NULL, GURL(),
- EventRouter::USER_GESTURE_UNKNOWN, info));
+ make_scoped_ptr(new ListValue()),
+ nullptr,
+ GURL(),
+ EventRouter::USER_GESTURE_UNKNOWN,
+ info));
return result.Pass();
}
@@ -107,7 +110,7 @@ scoped_ptr<EventListener> CreateEventListenerForURL(
void EventListenerMapTest::TestUnfilteredEventsGoToAllListeners(
const EventListenerConstructor& constructor) {
listeners_->AddListener(
- constructor.Run(kEvent1Name, NULL, new DictionaryValue()));
+ constructor.Run(kEvent1Name, nullptr, new DictionaryValue()));
scoped_ptr<Event> event(CreateNamedEvent(kEvent1Name));
ASSERT_EQ(1u, listeners_->GetEventListeners(*event).size());
}
@@ -124,11 +127,11 @@ TEST_F(EventListenerMapTest, UnfilteredEventsGoToAllListenersForURLs) {
TEST_F(EventListenerMapTest, FilteredEventsGoToAllMatchingListeners) {
listeners_->AddListener(EventListener::ForExtension(
- kEvent1Name, kExt1Id, NULL, CreateHostSuffixFilter("google.com")));
+ kEvent1Name, kExt1Id, nullptr, CreateHostSuffixFilter("google.com")));
listeners_->AddListener(EventListener::ForExtension(
kEvent1Name,
kExt1Id,
- NULL,
+ nullptr,
scoped_ptr<DictionaryValue>(new DictionaryValue)));
scoped_ptr<Event> event(CreateNamedEvent(kEvent1Name));
@@ -139,9 +142,9 @@ TEST_F(EventListenerMapTest, FilteredEventsGoToAllMatchingListeners) {
TEST_F(EventListenerMapTest, FilteredEventsOnlyGoToMatchingListeners) {
listeners_->AddListener(EventListener::ForExtension(
- kEvent1Name, kExt1Id, NULL, CreateHostSuffixFilter("google.com")));
+ kEvent1Name, kExt1Id, nullptr, CreateHostSuffixFilter("google.com")));
listeners_->AddListener(EventListener::ForExtension(
- kEvent1Name, kExt1Id, NULL, CreateHostSuffixFilter("yahoo.com")));
+ kEvent1Name, kExt1Id, nullptr, CreateHostSuffixFilter("yahoo.com")));
scoped_ptr<Event> event(CreateNamedEvent(kEvent1Name));
event->filter_info.SetURL(GURL("http://www.google.com"));
@@ -151,7 +154,7 @@ TEST_F(EventListenerMapTest, FilteredEventsOnlyGoToMatchingListeners) {
TEST_F(EventListenerMapTest, LazyAndUnlazyListenersGetReturned) {
listeners_->AddListener(EventListener::ForExtension(
- kEvent1Name, kExt1Id, NULL, CreateHostSuffixFilter("google.com")));
+ kEvent1Name, kExt1Id, nullptr, CreateHostSuffixFilter("google.com")));
listeners_->AddListener(
EventListener::ForExtension(kEvent1Name,
@@ -168,7 +171,7 @@ TEST_F(EventListenerMapTest, LazyAndUnlazyListenersGetReturned) {
void EventListenerMapTest::TestRemovingByProcess(
const EventListenerConstructor& constructor) {
listeners_->AddListener(constructor.Run(
- kEvent1Name, NULL, CreateHostSuffixFilter("google.com").release()));
+ kEvent1Name, nullptr, CreateHostSuffixFilter("google.com").release()));
listeners_->AddListener(
constructor.Run(kEvent1Name,
@@ -193,7 +196,7 @@ TEST_F(EventListenerMapTest, TestRemovingByProcessForURL) {
void EventListenerMapTest::TestRemovingByListener(
const EventListenerConstructor& constructor) {
listeners_->AddListener(constructor.Run(
- kEvent1Name, NULL, CreateHostSuffixFilter("google.com").release()));
+ kEvent1Name, nullptr, CreateHostSuffixFilter("google.com").release()));
listeners_->AddListener(
constructor.Run(kEvent1Name,
@@ -221,12 +224,12 @@ TEST_F(EventListenerMapTest, TestRemovingByListenerForURL) {
TEST_F(EventListenerMapTest, TestLazyDoubleAddIsUndoneByRemove) {
listeners_->AddListener(EventListener::ForExtension(
- kEvent1Name, kExt1Id, NULL, CreateHostSuffixFilter("google.com")));
+ kEvent1Name, kExt1Id, nullptr, CreateHostSuffixFilter("google.com")));
listeners_->AddListener(EventListener::ForExtension(
- kEvent1Name, kExt1Id, NULL, CreateHostSuffixFilter("google.com")));
+ kEvent1Name, kExt1Id, nullptr, CreateHostSuffixFilter("google.com")));
scoped_ptr<EventListener> listener(EventListener::ForExtension(
- kEvent1Name, kExt1Id, NULL, CreateHostSuffixFilter("google.com")));
+ kEvent1Name, kExt1Id, nullptr, CreateHostSuffixFilter("google.com")));
listeners_->RemoveListener(listener.get());
scoped_ptr<Event> event(CreateNamedEvent(kEvent1Name));
@@ -243,9 +246,9 @@ TEST_F(EventListenerMapTest, HostSuffixFilterEquality) {
TEST_F(EventListenerMapTest, RemoveLazyListeners) {
listeners_->AddListener(EventListener::ForExtension(
- kEvent1Name, kExt1Id, NULL, CreateHostSuffixFilter("google.com")));
+ kEvent1Name, kExt1Id, nullptr, CreateHostSuffixFilter("google.com")));
listeners_->AddListener(EventListener::ForExtension(
- kEvent2Name, kExt1Id, NULL, CreateHostSuffixFilter("google.com")));
+ kEvent2Name, kExt1Id, nullptr, CreateHostSuffixFilter("google.com")));
listeners_->RemoveLazyListenersForExtension(kExt1Id);
@@ -261,9 +264,9 @@ TEST_F(EventListenerMapTest, RemoveLazyListeners) {
TEST_F(EventListenerMapTest, AddExistingFilteredListener) {
bool first_new = listeners_->AddListener(EventListener::ForExtension(
- kEvent1Name, kExt1Id, NULL, CreateHostSuffixFilter("google.com")));
+ kEvent1Name, kExt1Id, nullptr, CreateHostSuffixFilter("google.com")));
bool second_new = listeners_->AddListener(EventListener::ForExtension(
- kEvent1Name, kExt1Id, NULL, CreateHostSuffixFilter("google.com")));
+ kEvent1Name, kExt1Id, nullptr, CreateHostSuffixFilter("google.com")));
ASSERT_TRUE(first_new);
ASSERT_FALSE(second_new);
@@ -272,12 +275,12 @@ TEST_F(EventListenerMapTest, AddExistingFilteredListener) {
void EventListenerMapTest::TestAddExistingUnfilteredListener(
const EventListenerConstructor& constructor) {
bool first_add = listeners_->AddListener(
- constructor.Run(kEvent1Name, NULL, new DictionaryValue()));
+ constructor.Run(kEvent1Name, nullptr, new DictionaryValue()));
bool second_add = listeners_->AddListener(
- constructor.Run(kEvent1Name, NULL, new DictionaryValue()));
+ constructor.Run(kEvent1Name, nullptr, new DictionaryValue()));
scoped_ptr<EventListener> listener(
- constructor.Run(kEvent1Name, NULL, new DictionaryValue()));
+ constructor.Run(kEvent1Name, nullptr, new DictionaryValue()));
bool first_remove = listeners_->RemoveListener(listener.get());
bool second_remove = listeners_->RemoveListener(listener.get());
@@ -336,7 +339,7 @@ TEST_F(EventListenerMapTest, HasListenerForExtension) {
kEvent1Name, kExt1Id, process_.get(), scoped_ptr<DictionaryValue>()));
// Lazy listener.
listeners_->AddListener(EventListener::ForExtension(
- kEvent1Name, kExt1Id, NULL, scoped_ptr<DictionaryValue>()));
+ kEvent1Name, kExt1Id, nullptr, scoped_ptr<DictionaryValue>()));
ASSERT_FALSE(listeners_->HasListenerForExtension(kExt1Id, kEvent2Name));
ASSERT_TRUE(listeners_->HasListenerForExtension(kExt1Id, kEvent1Name));
@@ -365,7 +368,7 @@ TEST_F(EventListenerMapTest, AddLazyListenersFromPreferences) {
std::set<const EventListener*> targets(listeners_->GetEventListeners(*event));
ASSERT_EQ(1u, targets.size());
scoped_ptr<EventListener> listener(EventListener::ForExtension(
- kEvent1Name, kExt1Id, NULL, CreateHostSuffixFilter("google.com")));
+ kEvent1Name, kExt1Id, nullptr, CreateHostSuffixFilter("google.com")));
ASSERT_TRUE((*targets.begin())->Equals(listener.get()));
}

Powered by Google App Engine
This is Rietveld 408576698