Commit be760560 authored by garykac@chromium.org's avatar garykac@chromium.org

Multi process notifications on linux (dbus)

BUG=none
TEST=unittests

Review URL: http://codereview.chromium.org/6320011

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@72645 0039d316-1c4b-4281-b951-d872f2087c98
parent e3afb0e3
...@@ -15,9 +15,9 @@ ...@@ -15,9 +15,9 @@
#include "base/time.h" #include "base/time.h"
#include "testing/multiprocess_func_list.h" #include "testing/multiprocess_func_list.h"
#if defined(OS_MACOSX) #if defined(OS_POSIX)
// TODO(dmaclach): Remove defined(OS_MACOSX) once // TODO(ajwong): Remove defined(OS_POSIX) restriction once
// MultiProcessNotification is implemented on Win/Linux. // MultiProcessNotification is implemented on Win.
namespace { namespace {
...@@ -244,33 +244,46 @@ void MultiProcessNotificationTest::CrossPostNotificationTest( ...@@ -244,33 +244,46 @@ void MultiProcessNotificationTest::CrossPostNotificationTest(
TEST_F(MultiProcessNotificationTest, BasicCreationTest) { TEST_F(MultiProcessNotificationTest, BasicCreationTest) {
QuitterDelegate quitter; QuitterDelegate quitter;
MessageLoop* message_loop = IOMessageLoop();
multi_process_notification::Listener profile_listener(
"BasicCreationTest", multi_process_notification::ProfileDomain, &quitter);
ASSERT_TRUE(profile_listener.Start(message_loop));
SpinRunLoop(TestTimeouts::action_max_timeout_ms());
ASSERT_TRUE(quitter.WasStartedReceived());
multi_process_notification::Listener local_listener( multi_process_notification::Listener local_listener(
"BasicCreationTest", multi_process_notification::UserDomain, &quitter); "BasicCreationTest", multi_process_notification::UserDomain, &quitter);
MessageLoop* message_loop = IOMessageLoop();
ASSERT_TRUE(local_listener.Start(message_loop)); ASSERT_TRUE(local_listener.Start(message_loop));
SpinRunLoop(TestTimeouts::action_max_timeout_ms()); SpinRunLoop(TestTimeouts::action_max_timeout_ms());
ASSERT_TRUE(quitter.WasStartedReceived()); ASSERT_TRUE(quitter.WasStartedReceived());
multi_process_notification::Listener system_listener( multi_process_notification::Listener system_listener(
"BasicCreationTest", multi_process_notification::SystemDomain, &quitter); "BasicCreationTest", multi_process_notification::SystemDomain, &quitter);
ASSERT_TRUE(system_listener.Start(message_loop)); ASSERT_TRUE(system_listener.Start(message_loop));
SpinRunLoop(TestTimeouts::action_max_timeout_ms()); SpinRunLoop(TestTimeouts::action_max_timeout_ms());
ASSERT_TRUE(quitter.WasStartedReceived()); ASSERT_TRUE(quitter.WasStartedReceived());
}
multi_process_notification::Listener local_listener2( TEST_F(MultiProcessNotificationTest, ListenOnNonIoThread) {
"BasicCreationTest", multi_process_notification::UserDomain, &quitter); QuitterDelegate quitter;
multi_process_notification::Listener local_listener(
"ListenOnNonIoThread", multi_process_notification::UserDomain, &quitter);
// Should fail because current message loop should not be an IOMessageLoop. // Should fail because current message loop should not be an IOMessageLoop.
ASSERT_FALSE(local_listener2.Start(MessageLoop::current())); ASSERT_FALSE(local_listener.Start(MessageLoop::current()));
} }
TEST_F(MultiProcessNotificationTest, PostInProcessNotification) { TEST_F(MultiProcessNotificationTest, PostInProcessNotification) {
std::string local_notification("QuitLocalNotification"); std::string local_notification("QuitLocalNotification");
QuitterDelegate quitter; QuitterDelegate quitter;
MessageLoop* message_loop = IOMessageLoop();
multi_process_notification::Listener listener( multi_process_notification::Listener listener(
local_notification, multi_process_notification::UserDomain, &quitter); local_notification, multi_process_notification::UserDomain, &quitter);
MessageLoop* message_loop = IOMessageLoop();
ASSERT_TRUE(listener.Start(message_loop)); ASSERT_TRUE(listener.Start(message_loop));
SpinRunLoop(TestTimeouts::action_max_timeout_ms()); SpinRunLoop(TestTimeouts::action_max_timeout_ms());
ASSERT_TRUE(quitter.WasStartedReceived()); ASSERT_TRUE(quitter.WasStartedReceived());
ASSERT_TRUE(multi_process_notification::Post( ASSERT_TRUE(multi_process_notification::Post(
local_notification, multi_process_notification::UserDomain)); local_notification, multi_process_notification::UserDomain));
SpinRunLoop(TestTimeouts::action_max_timeout_ms()); SpinRunLoop(TestTimeouts::action_max_timeout_ms());
...@@ -351,4 +364,4 @@ MULTIPROCESS_TEST_MAIN(MultiProcessSystemNotificationMain) { ...@@ -351,4 +364,4 @@ MULTIPROCESS_TEST_MAIN(MultiProcessSystemNotificationMain) {
return MultiProcessNotificationMain(multi_process_notification::SystemDomain); return MultiProcessNotificationMain(multi_process_notification::SystemDomain);
} }
#endif // defined(OS_MACOSX) #endif // defined(OS_POSIX)
...@@ -393,6 +393,7 @@ ...@@ -393,6 +393,7 @@
'conditions': [ 'conditions': [
['OS=="linux" or OS=="freebsd" or OS=="openbsd"', { ['OS=="linux" or OS=="freebsd" or OS=="openbsd"', {
'dependencies': [ 'dependencies': [
'../build/linux/system.gyp:dbus-glib',
'../build/linux/system.gyp:gtk', '../build/linux/system.gyp:gtk',
], ],
'export_dependent_settings': [ 'export_dependent_settings': [
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment