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

Unified Diff: content/browser/notification_service_impl_unittest.cc

Issue 11273049: Revert 164120 - content/browser: Move more files into the content namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 2 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
===================================================================
--- content/browser/notification_service_impl_unittest.cc (revision 164121)
+++ content/browser/notification_service_impl_unittest.cc (working copy)
@@ -8,34 +8,33 @@
#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 NotificationObserver {
- public:
+class TestObserver : public content::NotificationObserver {
+public:
TestObserver() : notification_count_(0) {}
int notification_count() { return notification_count_; }
- virtual void Observe(int type,
- const NotificationSource& source,
- const NotificationDetails& details) OVERRIDE {
+ void Observe(int type,
+ const content::NotificationSource& source,
+ const content::NotificationDetails& details) {
++notification_count_;
}
- private:
+private:
int notification_count_;
};
} // namespace
+
class NotificationServiceImplTest : public testing::Test {
protected:
- NotificationRegistrar registrar_;
+ content::NotificationRegistrar registrar_;
};
TEST_F(NotificationServiceImplTest, Basic) {
@@ -43,10 +42,10 @@
TestSource other_source;
// Check the equality operators defined for NotificationSource
- EXPECT_TRUE(Source<TestSource>(&test_source) ==
- Source<TestSource>(&test_source));
- EXPECT_TRUE(Source<TestSource>(&test_source) !=
- Source<TestSource>(&other_source));
+ EXPECT_TRUE(content::Source<TestSource>(&test_source) ==
+ content::Source<TestSource>(&test_source));
+ EXPECT_TRUE(content::Source<TestSource>(&test_source) !=
+ content::Source<TestSource>(&other_source));
TestObserver all_types_all_sources;
TestObserver idle_all_sources;
@@ -54,55 +53,56 @@
TestObserver idle_test_source;
// Make sure it doesn't freak out when there are no observers.
- NotificationService* service = NotificationService::current();
- service->Notify(NOTIFICATION_IDLE,
- Source<TestSource>(&test_source),
- NotificationService::NoDetails());
+ 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, 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));
+ 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));
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(NOTIFICATION_IDLE,
- Source<TestSource>(&test_source),
- NotificationService::NoDetails());
+ service->Notify(content::NOTIFICATION_IDLE,
+ content::Source<TestSource>(&test_source),
+ content::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(NOTIFICATION_BUSY,
- Source<TestSource>(&test_source),
- NotificationService::NoDetails());
+ service->Notify(content::NOTIFICATION_BUSY,
+ content::Source<TestSource>(&test_source),
+ content::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(NOTIFICATION_IDLE,
- Source<TestSource>(&other_source),
- NotificationService::NoDetails());
+ service->Notify(content::NOTIFICATION_IDLE,
+ content::Source<TestSource>(&other_source),
+ content::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(NOTIFICATION_BUSY,
- Source<TestSource>(&other_source),
- NotificationService::NoDetails());
+ service->Notify(content::NOTIFICATION_BUSY,
+ content::Source<TestSource>(&other_source),
+ content::NotificationService::NoDetails());
EXPECT_EQ(4, all_types_all_sources.notification_count());
EXPECT_EQ(2, idle_all_sources.notification_count());
@@ -110,9 +110,9 @@
EXPECT_EQ(1, idle_test_source.notification_count());
// Try send with NULL source.
- service->Notify(NOTIFICATION_IDLE,
- NotificationService::AllSources(),
- NotificationService::NoDetails());
+ service->Notify(content::NOTIFICATION_IDLE,
+ content::NotificationService::AllSources(),
+ content::NotificationService::NoDetails());
EXPECT_EQ(5, all_types_all_sources.notification_count());
EXPECT_EQ(3, idle_all_sources.notification_count());
@@ -121,9 +121,9 @@
registrar_.RemoveAll();
- service->Notify(NOTIFICATION_IDLE,
- Source<TestSource>(&test_source),
- NotificationService::NoDetails());
+ service->Notify(content::NOTIFICATION_IDLE,
+ content::Source<TestSource>(&test_source),
+ content::NotificationService::NoDetails());
EXPECT_EQ(5, all_types_all_sources.notification_count());
EXPECT_EQ(3, idle_all_sources.notification_count());
@@ -136,33 +136,32 @@
TestObserver idle_test_source;
- NotificationService* service = NotificationService::current();
+ content::NotificationService* service =
+ content::NotificationService::current();
- registrar_.Add(&idle_test_source, NOTIFICATION_IDLE,
- Source<TestSource>(&test_source));
- registrar_.Add(&idle_test_source, NOTIFICATION_ALL,
- Source<TestSource>(&test_source));
+ 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));
- service->Notify(NOTIFICATION_IDLE,
- Source<TestSource>(&test_source),
- NotificationService::NoDetails());
+ service->Notify(content::NOTIFICATION_IDLE,
+ content::Source<TestSource>(&test_source),
+ content::NotificationService::NoDetails());
EXPECT_EQ(2, idle_test_source.notification_count());
- registrar_.Remove(&idle_test_source, NOTIFICATION_IDLE,
- Source<TestSource>(&test_source));
+ registrar_.Remove(&idle_test_source, content::NOTIFICATION_IDLE,
+ content::Source<TestSource>(&test_source));
- service->Notify(NOTIFICATION_IDLE,
- Source<TestSource>(&test_source),
- NotificationService::NoDetails());
+ service->Notify(content::NOTIFICATION_IDLE,
+ content::Source<TestSource>(&test_source),
+ content::NotificationService::NoDetails());
EXPECT_EQ(3, idle_test_source.notification_count());
- registrar_.Remove(&idle_test_source, NOTIFICATION_ALL,
- Source<TestSource>(&test_source));
+ registrar_.Remove(&idle_test_source, content::NOTIFICATION_ALL,
+ content::Source<TestSource>(&test_source));
- service->Notify(NOTIFICATION_IDLE,
- Source<TestSource>(&test_source),
- NotificationService::NoDetails());
+ service->Notify(content::NOTIFICATION_IDLE,
+ content::Source<TestSource>(&test_source),
+ content::NotificationService::NoDetails());
EXPECT_EQ(3, idle_test_source.notification_count());
}
-
-} // namespace content
« no previous file with comments | « content/browser/notification_service_impl.cc ('k') | content/browser/renderer_host/pepper/pepper_file_message_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698