diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-01 18:16:56 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-01 18:16:56 +0000 |
commit | bfd04a62ce610d7bb61dbb78811dccbed23589b7 (patch) | |
tree | 70bb228c0f00ba1c12c584efd569daccf96b4026 /chrome/common/notification_service_unittest.cc | |
parent | a814d863440f0a154a7299f2d8b440f405c7700e (diff) | |
download | chromium_src-bfd04a62ce610d7bb61dbb78811dccbed23589b7.zip chromium_src-bfd04a62ce610d7bb61dbb78811dccbed23589b7.tar.gz chromium_src-bfd04a62ce610d7bb61dbb78811dccbed23589b7.tar.bz2 |
Remove most header file dependencies on the notification type list. It is
really painful to add more types, since lots of headers include the
notification service to derive from the notification observer. This splits that
out, so much less of the project should end up including notification_types.h
---Paths modified but not in any changelist:
Review URL: http://codereview.chromium.org/19744
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9020 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/notification_service_unittest.cc')
-rw-r--r-- | chrome/common/notification_service_unittest.cc | 72 |
1 files changed, 40 insertions, 32 deletions
diff --git a/chrome/common/notification_service_unittest.cc b/chrome/common/notification_service_unittest.cc index fb79b33..db46356 100644 --- a/chrome/common/notification_service_unittest.cc +++ b/chrome/common/notification_service_unittest.cc @@ -50,25 +50,29 @@ TEST(NotificationServiceTest, Basic) { NotificationService* service = NotificationService::current(); // Make sure it doesn't freak out when there are no observers. - service->Notify(NOTIFY_IDLE, + service->Notify(NotificationType::IDLE, Source<TestSource>(&test_source), NotificationService::NoDetails()); - service->AddObserver( - &all_types_all_sources, NOTIFY_ALL, NotificationService::AllSources()); - service->AddObserver( - &idle_all_sources, NOTIFY_IDLE, NotificationService::AllSources()); - service->AddObserver( - &all_types_test_source, NOTIFY_ALL, Source<TestSource>(&test_source)); - service->AddObserver( - &idle_test_source, NOTIFY_IDLE, Source<TestSource>(&test_source)); + service->AddObserver(&all_types_all_sources, + NotificationType::ALL, + NotificationService::AllSources()); + service->AddObserver(&idle_all_sources, + NotificationType::IDLE, + NotificationService::AllSources()); + service->AddObserver(&all_types_test_source, + NotificationType::ALL, + Source<TestSource>(&test_source)); + service->AddObserver(&idle_test_source, + NotificationType::IDLE, + Source<TestSource>(&test_source)); EXPECT_EQ(0, all_types_all_sources.notification_count()); EXPECT_EQ(0, idle_all_sources.notification_count()); EXPECT_EQ(0, all_types_test_source.notification_count()); EXPECT_EQ(0, idle_test_source.notification_count()); - service->Notify(NOTIFY_IDLE, + service->Notify(NotificationType::IDLE, Source<TestSource>(&test_source), NotificationService::NoDetails()); @@ -77,7 +81,7 @@ TEST(NotificationServiceTest, Basic) { EXPECT_EQ(1, all_types_test_source.notification_count()); EXPECT_EQ(1, idle_test_source.notification_count()); - service->Notify(NOTIFY_BUSY, + service->Notify(NotificationType::BUSY, Source<TestSource>(&test_source), NotificationService::NoDetails()); @@ -86,7 +90,7 @@ TEST(NotificationServiceTest, Basic) { EXPECT_EQ(2, all_types_test_source.notification_count()); EXPECT_EQ(1, idle_test_source.notification_count()); - service->Notify(NOTIFY_IDLE, + service->Notify(NotificationType::IDLE, Source<TestSource>(&other_source), NotificationService::NoDetails()); @@ -95,7 +99,7 @@ TEST(NotificationServiceTest, Basic) { EXPECT_EQ(2, all_types_test_source.notification_count()); EXPECT_EQ(1, idle_test_source.notification_count()); - service->Notify(NOTIFY_BUSY, + service->Notify(NotificationType::BUSY, Source<TestSource>(&other_source), NotificationService::NoDetails()); @@ -105,7 +109,7 @@ TEST(NotificationServiceTest, Basic) { EXPECT_EQ(1, idle_test_source.notification_count()); // Try send with NULL source. - service->Notify(NOTIFY_IDLE, + service->Notify(NotificationType::IDLE, NotificationService::AllSources(), NotificationService::NoDetails()); @@ -114,16 +118,20 @@ TEST(NotificationServiceTest, Basic) { EXPECT_EQ(2, all_types_test_source.notification_count()); EXPECT_EQ(1, idle_test_source.notification_count()); - service->RemoveObserver( - &all_types_all_sources, NOTIFY_ALL, NotificationService::AllSources()); - service->RemoveObserver( - &idle_all_sources, NOTIFY_IDLE, NotificationService::AllSources()); - service->RemoveObserver( - &all_types_test_source, NOTIFY_ALL, Source<TestSource>(&test_source)); - service->RemoveObserver( - &idle_test_source, NOTIFY_IDLE, Source<TestSource>(&test_source)); - - service->Notify(NOTIFY_IDLE, + service->RemoveObserver(&all_types_all_sources, + NotificationType::ALL, + NotificationService::AllSources()); + service->RemoveObserver(&idle_all_sources, + NotificationType::IDLE, + NotificationService::AllSources()); + service->RemoveObserver(&all_types_test_source, + NotificationType::ALL, + Source<TestSource>(&test_source)); + service->RemoveObserver(&idle_test_source, + NotificationType::IDLE, + Source<TestSource>(&test_source)); + + service->Notify(NotificationType::IDLE, Source<TestSource>(&test_source), NotificationService::NoDetails()); @@ -134,7 +142,7 @@ TEST(NotificationServiceTest, Basic) { // Removing an observer that isn't there is a no-op, this should be fine. service->RemoveObserver( - &all_types_all_sources, NOTIFY_ALL, NotificationService::AllSources()); + &all_types_all_sources, NotificationType::ALL, NotificationService::AllSources()); } TEST(NotificationServiceTest, MultipleRegistration) { @@ -145,27 +153,27 @@ TEST(NotificationServiceTest, MultipleRegistration) { NotificationService* service = NotificationService::current(); service->AddObserver( - &idle_test_source, NOTIFY_IDLE, Source<TestSource>(&test_source)); + &idle_test_source, NotificationType::IDLE, Source<TestSource>(&test_source)); service->AddObserver( - &idle_test_source, NOTIFY_ALL, Source<TestSource>(&test_source)); + &idle_test_source, NotificationType::ALL, Source<TestSource>(&test_source)); - service->Notify(NOTIFY_IDLE, + service->Notify(NotificationType::IDLE, Source<TestSource>(&test_source), NotificationService::NoDetails()); EXPECT_EQ(2, idle_test_source.notification_count()); service->RemoveObserver( - &idle_test_source, NOTIFY_IDLE, Source<TestSource>(&test_source)); + &idle_test_source, NotificationType::IDLE, Source<TestSource>(&test_source)); - service->Notify(NOTIFY_IDLE, + service->Notify(NotificationType::IDLE, Source<TestSource>(&test_source), NotificationService::NoDetails()); EXPECT_EQ(3, idle_test_source.notification_count()); service->RemoveObserver( - &idle_test_source, NOTIFY_ALL, Source<TestSource>(&test_source)); + &idle_test_source, NotificationType::ALL, Source<TestSource>(&test_source)); - service->Notify(NOTIFY_IDLE, + service->Notify(NotificationType::IDLE, Source<TestSource>(&test_source), NotificationService::NoDetails()); EXPECT_EQ(3, idle_test_source.notification_count()); |