From dd94f2f28165c2f2a72c82c0872255d881d5d052 Mon Sep 17 00:00:00 2001 From: "shess@chromium.org" Date: Wed, 22 Apr 2009 21:51:53 +0000 Subject: Run user_script_master_unittest.cc on Mac. Removed anonymous namespace, Mac's gcc won't allow friend to reach into anonymous namespaces. Noticed that UserScriptMasterTest.NoScripts hanged it DirectoryWatcher was not implemented. Added a timeout event so that now it fails slowly. Then I disabled that test for non-Windows. Other tests pass, lets get those in the system! Review URL: http://codereview.chromium.org/88075 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14252 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/extensions/user_script_master_unittest.cc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'chrome/browser') diff --git a/chrome/browser/extensions/user_script_master_unittest.cc b/chrome/browser/extensions/user_script_master_unittest.cc index b9945bd..8413847 100644 --- a/chrome/browser/extensions/user_script_master_unittest.cc +++ b/chrome/browser/extensions/user_script_master_unittest.cc @@ -14,8 +14,6 @@ #include "chrome/common/notification_service.h" #include "testing/gtest/include/gtest/gtest.h" -namespace { - // Test bringing up a master on a specific directory, putting a script // in there, etc. @@ -72,8 +70,6 @@ class UserScriptMasterTest : public testing::Test, base::SharedMemory* shared_memory_; }; -} // namespace - // Test that we *don't* get spurious notifications. TEST_F(UserScriptMasterTest, NoScripts) { // Set shared_memory_ to something non-NULL, so we can check it became NULL. @@ -90,6 +86,9 @@ TEST_F(UserScriptMasterTest, NoScripts) { ASSERT_EQ(NULL, shared_memory_); } +// TODO(shess): Disabled on Mac and Linux because of missing +// DirectoryWatcher. +#if defined(OS_WIN) // Test that we get notified about new scripts after they're added. TEST_F(UserScriptMasterTest, NewScripts) { scoped_refptr master( @@ -101,10 +100,15 @@ TEST_F(UserScriptMasterTest, NewScripts) { size_t written = file_util::WriteFile(path, content, sizeof(content)); ASSERT_EQ(written, sizeof(content)); + // Post a delayed task so that we fail rather than hanging if things + // don't work. + message_loop_.PostDelayedTask(FROM_HERE, new MessageLoop::QuitTask, 5000); + message_loop_.Run(); ASSERT_TRUE(shared_memory_ != NULL); } +#endif // Test that we get notified about scripts if they're already in the test dir. TEST_F(UserScriptMasterTest, ExistingScripts) { -- cgit v1.1