OLD | NEW |
---|---|
1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/directory_watcher.h" | 5 #include "base/directory_watcher.h" |
6 | 6 |
7 #include <fstream> | 7 #include <fstream> |
8 | 8 |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 | 10 |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
177 Deleter deleter(watcher); // Takes ownership of watcher. | 177 Deleter deleter(watcher); // Takes ownership of watcher. |
178 ASSERT_TRUE(watcher->Watch(test_dir_, &deleter)); | 178 ASSERT_TRUE(watcher->Watch(test_dir_, &deleter)); |
179 | 179 |
180 WriteTestDirFile(FILE_PATH_LITERAL("test_file"), "some content"); | 180 WriteTestDirFile(FILE_PATH_LITERAL("test_file"), "some content"); |
181 LoopUntilModsEqual(2); | 181 LoopUntilModsEqual(2); |
182 | 182 |
183 // We win if we haven't crashed yet. | 183 // We win if we haven't crashed yet. |
184 // Might as well double-check it got deleted, too. | 184 // Might as well double-check it got deleted, too. |
185 ASSERT_TRUE(deleter.watcher_.get() == NULL); | 185 ASSERT_TRUE(deleter.watcher_.get() == NULL); |
186 } | 186 } |
187 | |
188 // Verify that watching a directory that doesn't exist fails, but doesn't | |
189 // asssert. | |
190 // Basic test: add a file and verify we notice it. | |
191 TEST_F(DirectoryWatcherTest, NonExistantDirectory) { | |
Evan Martin
2009/01/07 18:47:57
s/Existant/Existent/
| |
192 DirectoryWatcher watcher; | |
193 ASSERT_FALSE(watcher.Watch( | |
194 test_dir_.Append(FILE_PATH_LITERAL("does-not-exist")), this)); | |
195 } | |
OLD | NEW |