diff options
author | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-25 05:08:54 +0000 |
---|---|---|
committer | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-25 05:08:54 +0000 |
commit | bdbc87ca87fda52c3262240705d974030e9ed4b4 (patch) | |
tree | 6ca34f4c2ba9fe4b340075206846c115a5400d27 /base | |
parent | 1692ea885338dd799ae9f47151d2a7fd4d1b10c4 (diff) | |
download | chromium_src-bdbc87ca87fda52c3262240705d974030e9ed4b4.zip chromium_src-bdbc87ca87fda52c3262240705d974030e9ed4b4.tar.gz chromium_src-bdbc87ca87fda52c3262240705d974030e9ed4b4.tar.bz2 |
Add user script support to extensions.
This is implemented mostly by relying on the existing
user script code. But since extension user scripts are
declared, not discovered in a directory, I had to add
support for adding 'lone' user scripts to
UserScriptMaster. This led to a bit of refactoring.
Note that this CL relies on:
http://codereview.chromium.org/18352
Review URL: http://codereview.chromium.org/18198
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8614 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r-- | base/directory_watcher_unittest.cc | 19 | ||||
-rw-r--r-- | base/directory_watcher_win.cc | 4 |
2 files changed, 5 insertions, 18 deletions
diff --git a/base/directory_watcher_unittest.cc b/base/directory_watcher_unittest.cc index 23ae803..7280dff 100644 --- a/base/directory_watcher_unittest.cc +++ b/base/directory_watcher_unittest.cc @@ -128,15 +128,8 @@ TEST_F(DirectoryWatcherTest, Unregister) { ASSERT_EQ(directory_mods_, 0); } -// Verify that modifications to a subdirectory isn't noticed. +// Verify that modifications to a subdirectory are noticed. TEST_F(DirectoryWatcherTest, SubDir) { -#if defined(OS_WIN) - // Temporarily disabling test on Vista, see - // http://code.google.com/p/chromium/issues/detail?id=5072 - // TODO: Enable this test, quickly. - if (win_util::GetWinVersion() == win_util::WINVERSION_VISTA) - return; -#endif FilePath subdir(FILE_PATH_LITERAL("SubDir")); ASSERT_TRUE(file_util::CreateDirectory(test_dir_.Append(subdir))); @@ -145,15 +138,7 @@ TEST_F(DirectoryWatcherTest, SubDir) { // Write a file to the subdir. FilePath test_path = subdir.AppendASCII("test_file"); WriteTestDirFile(test_path.value(), "some content"); - - // We won't get a notification, so we just wait around a bit to verify - // that notification doesn't come. - loop_.PostDelayedTask(FROM_HERE, new MessageLoop::QuitTask, - kWaitForEventTime); - loop_.Run(); - - // We shouldn't have been notified and shouldn't have crashed. - ASSERT_EQ(0, directory_mods_); + LoopUntilModsEqual(2); } namespace { diff --git a/base/directory_watcher_win.cc b/base/directory_watcher_win.cc index 6fe6ba5..f978277 100644 --- a/base/directory_watcher_win.cc +++ b/base/directory_watcher_win.cc @@ -43,9 +43,11 @@ DirectoryWatcher::Impl::~Impl() { bool DirectoryWatcher::Impl::Watch(const FilePath& path) { DCHECK(path_.value().empty()); // Can only watch one path. + // NOTE: If you want to change this code to *not* watch subdirectories, have a + // look at http://code.google.com/p/chromium/issues/detail?id=5072 first. handle_ = FindFirstChangeNotification( path.value().c_str(), - FALSE, // Don't watch subtree. + TRUE, // Watch subtree. FILE_NOTIFY_CHANGE_FILE_NAME | FILE_NOTIFY_CHANGE_SIZE | FILE_NOTIFY_CHANGE_LAST_WRITE); if (handle_ == INVALID_HANDLE_VALUE) |