summaryrefslogtreecommitdiffstats
path: root/content/browser/notification_service_impl_unittest.cc
diff options
context:
space:
mode:
authortfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-25 18:44:52 +0000
committertfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-25 18:44:52 +0000
commit7a91c555f3e057f8be9010a4e5385678ce822c28 (patch)
treeedb8a4384b09b3ce70b6b58a17afe5470eb5e039 /content/browser/notification_service_impl_unittest.cc
parente2e22a7ab44c2f49d856a9f840893c5462f52679 (diff)
downloadchromium_src-7a91c555f3e057f8be9010a4e5385678ce822c28.zip
chromium_src-7a91c555f3e057f8be9010a4e5385678ce822c28.tar.gz
chromium_src-7a91c555f3e057f8be9010a4e5385678ce822c28.tar.bz2
content/browser: Move more files into the content namespace.
Fixed most of the files found with the following command line: $ git grep --files-without-match --name-only "namespace content {" -- content/browser/{*.cc,*.h.*.mm} R=jam@chromium.org Review URL: https://codereview.chromium.org/11274038 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@164120 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/notification_service_impl_unittest.cc')
-rw-r--r--content/browser/notification_service_impl_unittest.cc127
1 files changed, 64 insertions, 63 deletions
diff --git a/content/browser/notification_service_impl_unittest.cc b/content/browser/notification_service_impl_unittest.cc
index 62a0e51..b63b843 100644
--- a/content/browser/notification_service_impl_unittest.cc
+++ b/content/browser/notification_service_impl_unittest.cc
@@ -8,33 +8,34 @@
#include "content/public/browser/notification_types.h"
#include "testing/gtest/include/gtest/gtest.h"
+namespace content {
+
namespace {
// Bogus class to act as a NotificationSource for the messages.
class TestSource {};
-class TestObserver : public content::NotificationObserver {
-public:
+class TestObserver : public NotificationObserver {
+ public:
TestObserver() : notification_count_(0) {}
int notification_count() { return notification_count_; }
- void Observe(int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) {
+ virtual void Observe(int type,
+ const NotificationSource& source,
+ const NotificationDetails& details) OVERRIDE {
++notification_count_;
}
-private:
+ private:
int notification_count_;
};
} // namespace
-
class NotificationServiceImplTest : public testing::Test {
protected:
- content::NotificationRegistrar registrar_;
+ NotificationRegistrar registrar_;
};
TEST_F(NotificationServiceImplTest, Basic) {
@@ -42,10 +43,10 @@ TEST_F(NotificationServiceImplTest, Basic) {
TestSource other_source;
// Check the equality operators defined for NotificationSource
- EXPECT_TRUE(content::Source<TestSource>(&test_source) ==
- content::Source<TestSource>(&test_source));
- EXPECT_TRUE(content::Source<TestSource>(&test_source) !=
- content::Source<TestSource>(&other_source));
+ EXPECT_TRUE(Source<TestSource>(&test_source) ==
+ Source<TestSource>(&test_source));
+ EXPECT_TRUE(Source<TestSource>(&test_source) !=
+ Source<TestSource>(&other_source));
TestObserver all_types_all_sources;
TestObserver idle_all_sources;
@@ -53,56 +54,55 @@ TEST_F(NotificationServiceImplTest, Basic) {
TestObserver idle_test_source;
// Make sure it doesn't freak out when there are no observers.
- content::NotificationService* service =
- content::NotificationService::current();
- service->Notify(content::NOTIFICATION_IDLE,
- content::Source<TestSource>(&test_source),
- content::NotificationService::NoDetails());
-
- registrar_.Add(&all_types_all_sources, content::NOTIFICATION_ALL,
- content::NotificationService::AllSources());
- registrar_.Add(&idle_all_sources, content::NOTIFICATION_IDLE,
- content::NotificationService::AllSources());
- registrar_.Add(&all_types_test_source, content::NOTIFICATION_ALL,
- content::Source<TestSource>(&test_source));
- registrar_.Add(&idle_test_source, content::NOTIFICATION_IDLE,
- content::Source<TestSource>(&test_source));
+ NotificationService* service = NotificationService::current();
+ service->Notify(NOTIFICATION_IDLE,
+ Source<TestSource>(&test_source),
+ NotificationService::NoDetails());
+
+ registrar_.Add(&all_types_all_sources, NOTIFICATION_ALL,
+ NotificationService::AllSources());
+ registrar_.Add(&idle_all_sources, NOTIFICATION_IDLE,
+ NotificationService::AllSources());
+ registrar_.Add(&all_types_test_source, NOTIFICATION_ALL,
+ Source<TestSource>(&test_source));
+ registrar_.Add(&idle_test_source, NOTIFICATION_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(content::NOTIFICATION_IDLE,
- content::Source<TestSource>(&test_source),
- content::NotificationService::NoDetails());
+ service->Notify(NOTIFICATION_IDLE,
+ Source<TestSource>(&test_source),
+ NotificationService::NoDetails());
EXPECT_EQ(1, all_types_all_sources.notification_count());
EXPECT_EQ(1, idle_all_sources.notification_count());
EXPECT_EQ(1, all_types_test_source.notification_count());
EXPECT_EQ(1, idle_test_source.notification_count());
- service->Notify(content::NOTIFICATION_BUSY,
- content::Source<TestSource>(&test_source),
- content::NotificationService::NoDetails());
+ service->Notify(NOTIFICATION_BUSY,
+ Source<TestSource>(&test_source),
+ NotificationService::NoDetails());
EXPECT_EQ(2, all_types_all_sources.notification_count());
EXPECT_EQ(1, idle_all_sources.notification_count());
EXPECT_EQ(2, all_types_test_source.notification_count());
EXPECT_EQ(1, idle_test_source.notification_count());
- service->Notify(content::NOTIFICATION_IDLE,
- content::Source<TestSource>(&other_source),
- content::NotificationService::NoDetails());
+ service->Notify(NOTIFICATION_IDLE,
+ Source<TestSource>(&other_source),
+ NotificationService::NoDetails());
EXPECT_EQ(3, all_types_all_sources.notification_count());
EXPECT_EQ(2, idle_all_sources.notification_count());
EXPECT_EQ(2, all_types_test_source.notification_count());
EXPECT_EQ(1, idle_test_source.notification_count());
- service->Notify(content::NOTIFICATION_BUSY,
- content::Source<TestSource>(&other_source),
- content::NotificationService::NoDetails());
+ service->Notify(NOTIFICATION_BUSY,
+ Source<TestSource>(&other_source),
+ NotificationService::NoDetails());
EXPECT_EQ(4, all_types_all_sources.notification_count());
EXPECT_EQ(2, idle_all_sources.notification_count());
@@ -110,9 +110,9 @@ TEST_F(NotificationServiceImplTest, Basic) {
EXPECT_EQ(1, idle_test_source.notification_count());
// Try send with NULL source.
- service->Notify(content::NOTIFICATION_IDLE,
- content::NotificationService::AllSources(),
- content::NotificationService::NoDetails());
+ service->Notify(NOTIFICATION_IDLE,
+ NotificationService::AllSources(),
+ NotificationService::NoDetails());
EXPECT_EQ(5, all_types_all_sources.notification_count());
EXPECT_EQ(3, idle_all_sources.notification_count());
@@ -121,9 +121,9 @@ TEST_F(NotificationServiceImplTest, Basic) {
registrar_.RemoveAll();
- service->Notify(content::NOTIFICATION_IDLE,
- content::Source<TestSource>(&test_source),
- content::NotificationService::NoDetails());
+ service->Notify(NOTIFICATION_IDLE,
+ Source<TestSource>(&test_source),
+ NotificationService::NoDetails());
EXPECT_EQ(5, all_types_all_sources.notification_count());
EXPECT_EQ(3, idle_all_sources.notification_count());
@@ -136,32 +136,33 @@ TEST_F(NotificationServiceImplTest, MultipleRegistration) {
TestObserver idle_test_source;
- content::NotificationService* service =
- content::NotificationService::current();
+ NotificationService* service = NotificationService::current();
- registrar_.Add(&idle_test_source, content::NOTIFICATION_IDLE,
- content::Source<TestSource>(&test_source));
- registrar_.Add(&idle_test_source, content::NOTIFICATION_ALL,
- content::Source<TestSource>(&test_source));
+ registrar_.Add(&idle_test_source, NOTIFICATION_IDLE,
+ Source<TestSource>(&test_source));
+ registrar_.Add(&idle_test_source, NOTIFICATION_ALL,
+ Source<TestSource>(&test_source));
- service->Notify(content::NOTIFICATION_IDLE,
- content::Source<TestSource>(&test_source),
- content::NotificationService::NoDetails());
+ service->Notify(NOTIFICATION_IDLE,
+ Source<TestSource>(&test_source),
+ NotificationService::NoDetails());
EXPECT_EQ(2, idle_test_source.notification_count());
- registrar_.Remove(&idle_test_source, content::NOTIFICATION_IDLE,
- content::Source<TestSource>(&test_source));
+ registrar_.Remove(&idle_test_source, NOTIFICATION_IDLE,
+ Source<TestSource>(&test_source));
- service->Notify(content::NOTIFICATION_IDLE,
- content::Source<TestSource>(&test_source),
- content::NotificationService::NoDetails());
+ service->Notify(NOTIFICATION_IDLE,
+ Source<TestSource>(&test_source),
+ NotificationService::NoDetails());
EXPECT_EQ(3, idle_test_source.notification_count());
- registrar_.Remove(&idle_test_source, content::NOTIFICATION_ALL,
- content::Source<TestSource>(&test_source));
+ registrar_.Remove(&idle_test_source, NOTIFICATION_ALL,
+ Source<TestSource>(&test_source));
- service->Notify(content::NOTIFICATION_IDLE,
- content::Source<TestSource>(&test_source),
- content::NotificationService::NoDetails());
+ service->Notify(NOTIFICATION_IDLE,
+ Source<TestSource>(&test_source),
+ NotificationService::NoDetails());
EXPECT_EQ(3, idle_test_source.notification_count());
}
+
+} // namespace content