| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/drive/file_write_watcher.h" | 5 #include "components/drive/file_write_watcher.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 // | 61 // |
| 62 // By using the IO_MAINLOOP test thread bundle, the main thread is used | 62 // By using the IO_MAINLOOP test thread bundle, the main thread is used |
| 63 // both as UI and FILE thread, with TYPE_IO message loop. | 63 // both as UI and FILE thread, with TYPE_IO message loop. |
| 64 FileWriteWatcherTest() | 64 FileWriteWatcherTest() |
| 65 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP) { | 65 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP) { |
| 66 } | 66 } |
| 67 | 67 |
| 68 void SetUp() override { ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); } | 68 void SetUp() override { ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); } |
| 69 | 69 |
| 70 base::FilePath GetTempPath(const std::string& name) { | 70 base::FilePath GetTempPath(const std::string& name) { |
| 71 return temp_dir_.path().Append(name); | 71 return temp_dir_.GetPath().Append(name); |
| 72 } | 72 } |
| 73 | 73 |
| 74 private: | 74 private: |
| 75 content::TestBrowserThreadBundle thread_bundle_; | 75 content::TestBrowserThreadBundle thread_bundle_; |
| 76 base::ScopedTempDir temp_dir_; | 76 base::ScopedTempDir temp_dir_; |
| 77 }; | 77 }; |
| 78 | 78 |
| 79 } // namespace | 79 } // namespace |
| 80 | 80 |
| 81 TEST_F(FileWriteWatcherTest, WatchThreeFiles) { | 81 TEST_F(FileWriteWatcherTest, WatchThreeFiles) { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 | 114 |
| 115 // Unwatched write. It shouldn't be notified. | 115 // Unwatched write. It shouldn't be notified. |
| 116 WriteSomethingAfterStartWatch(path4, true); | 116 WriteSomethingAfterStartWatch(path4, true); |
| 117 | 117 |
| 118 // The loop should quit if all the three paths are notified to be written. | 118 // The loop should quit if all the three paths are notified to be written. |
| 119 loop.Run(); | 119 loop.Run(); |
| 120 } | 120 } |
| 121 | 121 |
| 122 } // namespace internal | 122 } // namespace internal |
| 123 } // namespace drive | 123 } // namespace drive |
| OLD | NEW |