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 |
11 #include "base/file_path.h" | 11 #include "base/file_path.h" |
12 #include "base/file_util.h" | 12 #include "base/file_util.h" |
13 #include "base/logging.h" | |
14 #include "base/message_loop.h" | 13 #include "base/message_loop.h" |
15 #include "base/path_service.h" | 14 #include "base/path_service.h" |
16 #include "base/string_util.h" | 15 #include "base/string_util.h" |
17 #if defined(OS_WIN) | 16 #if defined(OS_WIN) |
18 #include "base/win_util.h" | 17 #include "base/win_util.h" |
19 #endif | 18 #endif |
20 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
21 | 20 |
22 // For tests where we wait a bit to verify nothing happened | 21 // For tests where we wait a bit to verify nothing happened |
23 namespace { | 22 namespace { |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 ASSERT_TRUE(deleter.watcher_.get() == NULL); | 169 ASSERT_TRUE(deleter.watcher_.get() == NULL); |
171 } | 170 } |
172 | 171 |
173 // Verify that watching a directory that doesn't exist fails, but doesn't | 172 // Verify that watching a directory that doesn't exist fails, but doesn't |
174 // asssert. | 173 // asssert. |
175 // Basic test: add a file and verify we notice it. | 174 // Basic test: add a file and verify we notice it. |
176 TEST_F(DirectoryWatcherTest, NonExistentDirectory) { | 175 TEST_F(DirectoryWatcherTest, NonExistentDirectory) { |
177 DirectoryWatcher watcher; | 176 DirectoryWatcher watcher; |
178 ASSERT_FALSE(watcher.Watch(test_dir_.AppendASCII("does-not-exist"), this)); | 177 ASSERT_FALSE(watcher.Watch(test_dir_.AppendASCII("does-not-exist"), this)); |
179 } | 178 } |
OLD | NEW |