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

Side by Side Diff: base/directory_watcher_unittest.cc

Issue 155022: Fix few trivial Coverity issues, mainly PASS_BY_VALUE. (Closed)
Patch Set: Created 11 years, 5 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/file_path.cc » ('j') | no next file with comments »
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 <limits> 7 #include <limits>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/file_path.h" 10 #include "base/file_path.h"
11 #include "base/file_util.h" 11 #include "base/file_util.h"
12 #include "base/message_loop.h" 12 #include "base/message_loop.h"
13 #include "base/path_service.h" 13 #include "base/path_service.h"
14 #include "base/platform_thread.h" 14 #include "base/platform_thread.h"
15 #include "base/string_util.h" 15 #include "base/string_util.h"
16 #include "base/thread.h" 16 #include "base/thread.h"
17 #if defined(OS_WIN) 17 #if defined(OS_WIN)
18 #include "base/win_util.h" 18 #include "base/win_util.h"
19 #endif // defined(OS_WIN) 19 #endif // defined(OS_WIN)
20 #include "testing/gtest/include/gtest/gtest.h" 20 #include "testing/gtest/include/gtest/gtest.h"
21 21
22 namespace { 22 namespace {
23 23
24 // For tests where we wait a bit to verify nothing happened 24 // For tests where we wait a bit to verify nothing happened
25 const int kWaitForEventTime = 1000; 25 const int kWaitForEventTime = 1000;
26 26
27 class DirectoryWatcherTest : public testing::Test { 27 class DirectoryWatcherTest : public testing::Test {
28 public: 28 public:
29 // Implementation of DirectoryWatcher on Mac requires UI loop. 29 // Implementation of DirectoryWatcher on Mac requires UI loop.
30 DirectoryWatcherTest() : loop_(MessageLoop::TYPE_UI) { 30 DirectoryWatcherTest()
31 : loop_(MessageLoop::TYPE_UI),
32 notified_delegates_(0),
33 expected_notified_delegates_(0) {
31 } 34 }
32 35
33 void OnTestDelegateFirstNotification(const FilePath& path) { 36 void OnTestDelegateFirstNotification(const FilePath& path) {
34 notified_delegates_++; 37 notified_delegates_++;
35 if (notified_delegates_ >= expected_notified_delegates_) 38 if (notified_delegates_ >= expected_notified_delegates_)
36 MessageLoop::current()->Quit(); 39 MessageLoop::current()->Quit();
37 } 40 }
38 41
39 protected: 42 protected:
40 virtual void SetUp() { 43 virtual void SetUp() {
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 // Verify that watching a directory that doesn't exist fails, but doesn't 405 // Verify that watching a directory that doesn't exist fails, but doesn't
403 // asssert. 406 // asssert.
404 // Basic test: add a file and verify we notice it. 407 // Basic test: add a file and verify we notice it.
405 TEST_F(DirectoryWatcherTest, NonExistentDirectory) { 408 TEST_F(DirectoryWatcherTest, NonExistentDirectory) {
406 DirectoryWatcher watcher; 409 DirectoryWatcher watcher;
407 ASSERT_FALSE(watcher.Watch(test_dir_.AppendASCII("does-not-exist"), 410 ASSERT_FALSE(watcher.Watch(test_dir_.AppendASCII("does-not-exist"),
408 NULL, NULL, false)); 411 NULL, NULL, false));
409 } 412 }
410 413
411 } // namespace 414 } // namespace
OLDNEW
« no previous file with comments | « no previous file | base/file_path.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698