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

Unified Diff: content/browser/notification_service_impl_unittest.cc

Issue 12039079: content: convert user action notification to observer usage (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixes Created 7 years, 11 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: content/browser/notification_service_impl_unittest.cc
diff --git a/content/browser/notification_service_impl_unittest.cc b/content/browser/notification_service_impl_unittest.cc
index 2b9121624ed46d047628e540b0377967d5aa5dfd..1317e4a4e7eb1e080099da8b354a9b41c728a439 100644
--- a/content/browser/notification_service_impl_unittest.cc
+++ b/content/browser/notification_service_impl_unittest.cc
@@ -32,6 +32,9 @@ class TestObserver : public NotificationObserver {
int notification_count_;
};
+const int kNotification1 = 1;
+const int kNotification2 = 2;
+
} // namespace
@@ -57,17 +60,17 @@ TEST_F(NotificationServiceImplTest, Basic) {
// Make sure it doesn't freak out when there are no observers.
NotificationService* service = NotificationService::current();
- service->Notify(NOTIFICATION_IDLE,
+ service->Notify(kNotification1,
Source<TestSource>(&test_source),
NotificationService::NoDetails());
registrar_.Add(&all_types_all_sources, NOTIFICATION_ALL,
NotificationService::AllSources());
- registrar_.Add(&idle_all_sources, NOTIFICATION_IDLE,
+ registrar_.Add(&idle_all_sources, kNotification1,
NotificationService::AllSources());
registrar_.Add(&all_types_test_source, NOTIFICATION_ALL,
Source<TestSource>(&test_source));
- registrar_.Add(&idle_test_source, NOTIFICATION_IDLE,
+ registrar_.Add(&idle_test_source, kNotification1,
Source<TestSource>(&test_source));
EXPECT_EQ(0, all_types_all_sources.notification_count());
@@ -75,7 +78,7 @@ TEST_F(NotificationServiceImplTest, Basic) {
EXPECT_EQ(0, all_types_test_source.notification_count());
EXPECT_EQ(0, idle_test_source.notification_count());
- service->Notify(NOTIFICATION_IDLE,
+ service->Notify(kNotification1,
Source<TestSource>(&test_source),
NotificationService::NoDetails());
@@ -84,7 +87,7 @@ TEST_F(NotificationServiceImplTest, Basic) {
EXPECT_EQ(1, all_types_test_source.notification_count());
EXPECT_EQ(1, idle_test_source.notification_count());
- service->Notify(NOTIFICATION_BUSY,
+ service->Notify(kNotification2,
Source<TestSource>(&test_source),
NotificationService::NoDetails());
@@ -93,7 +96,7 @@ TEST_F(NotificationServiceImplTest, Basic) {
EXPECT_EQ(2, all_types_test_source.notification_count());
EXPECT_EQ(1, idle_test_source.notification_count());
- service->Notify(NOTIFICATION_IDLE,
+ service->Notify(kNotification1,
Source<TestSource>(&other_source),
NotificationService::NoDetails());
@@ -102,7 +105,7 @@ TEST_F(NotificationServiceImplTest, Basic) {
EXPECT_EQ(2, all_types_test_source.notification_count());
EXPECT_EQ(1, idle_test_source.notification_count());
- service->Notify(NOTIFICATION_BUSY,
+ service->Notify(kNotification2,
Source<TestSource>(&other_source),
NotificationService::NoDetails());
@@ -112,7 +115,7 @@ TEST_F(NotificationServiceImplTest, Basic) {
EXPECT_EQ(1, idle_test_source.notification_count());
// Try send with NULL source.
- service->Notify(NOTIFICATION_IDLE,
+ service->Notify(kNotification1,
NotificationService::AllSources(),
NotificationService::NoDetails());
@@ -123,7 +126,7 @@ TEST_F(NotificationServiceImplTest, Basic) {
registrar_.RemoveAll();
- service->Notify(NOTIFICATION_IDLE,
+ service->Notify(kNotification1,
Source<TestSource>(&test_source),
NotificationService::NoDetails());
@@ -140,20 +143,20 @@ TEST_F(NotificationServiceImplTest, MultipleRegistration) {
NotificationService* service = NotificationService::current();
- registrar_.Add(&idle_test_source, NOTIFICATION_IDLE,
+ registrar_.Add(&idle_test_source, kNotification1,
Source<TestSource>(&test_source));
registrar_.Add(&idle_test_source, NOTIFICATION_ALL,
Source<TestSource>(&test_source));
- service->Notify(NOTIFICATION_IDLE,
+ service->Notify(kNotification1,
Source<TestSource>(&test_source),
NotificationService::NoDetails());
EXPECT_EQ(2, idle_test_source.notification_count());
- registrar_.Remove(&idle_test_source, NOTIFICATION_IDLE,
+ registrar_.Remove(&idle_test_source, kNotification1,
Source<TestSource>(&test_source));
- service->Notify(NOTIFICATION_IDLE,
+ service->Notify(kNotification1,
Source<TestSource>(&test_source),
NotificationService::NoDetails());
EXPECT_EQ(3, idle_test_source.notification_count());
@@ -161,7 +164,7 @@ TEST_F(NotificationServiceImplTest, MultipleRegistration) {
registrar_.Remove(&idle_test_source, NOTIFICATION_ALL,
Source<TestSource>(&test_source));
- service->Notify(NOTIFICATION_IDLE,
+ service->Notify(kNotification1,
Source<TestSource>(&test_source),
NotificationService::NoDetails());
EXPECT_EQ(3, idle_test_source.notification_count());

Powered by Google App Engine
This is Rietveld 408576698