Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(315)

Side by Side Diff: base/directory_watcher_unittest.cc

Issue 16580: Don't DCHECK if a watched directory doesn't exist. (Closed)
Patch Set: Created 11 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | base/directory_watcher_win.cc » ('j') | base/directory_watcher_win.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 }
OLDNEW
« no previous file with comments | « no previous file | base/directory_watcher_win.cc » ('j') | base/directory_watcher_win.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698