| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/file_path.h" | 5 #include "base/file_path.h" |
| 6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
| 7 #include "base/files/scoped_temp_dir.h" |
| 7 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
| 8 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 9 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
| 10 #include "base/scoped_temp_dir.h" | |
| 11 #include "base/test/test_file_util.h" | 11 #include "base/test/test_file_util.h" |
| 12 #include "chrome/browser/download/download_path_reservation_tracker.h" | 12 #include "chrome/browser/download/download_path_reservation_tracker.h" |
| 13 #include "chrome/browser/download/download_util.h" | 13 #include "chrome/browser/download/download_util.h" |
| 14 #include "content/public/test/mock_download_item.h" | 14 #include "content/public/test/mock_download_item.h" |
| 15 #include "content/public/test/test_browser_thread.h" | 15 #include "content/public/test/test_browser_thread.h" |
| 16 #include "testing/gmock/include/gmock/gmock.h" | 16 #include "testing/gmock/include/gmock/gmock.h" |
| 17 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
| 18 | 18 |
| 19 using content::BrowserThread; | 19 using content::BrowserThread; |
| 20 using content::DownloadId; | 20 using content::DownloadId; |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 FilePath* return_path, bool* return_verified); | 77 FilePath* return_path, bool* return_verified); |
| 78 | 78 |
| 79 const FilePath& default_download_path() const { | 79 const FilePath& default_download_path() const { |
| 80 return default_download_path_; | 80 return default_download_path_; |
| 81 } | 81 } |
| 82 void set_default_download_path(const FilePath& path) { | 82 void set_default_download_path(const FilePath& path) { |
| 83 default_download_path_ = path; | 83 default_download_path_ = path; |
| 84 } | 84 } |
| 85 | 85 |
| 86 protected: | 86 protected: |
| 87 ScopedTempDir test_download_dir_; | 87 base::ScopedTempDir test_download_dir_; |
| 88 FilePath default_download_path_; | 88 FilePath default_download_path_; |
| 89 MessageLoopForUI message_loop_; | 89 MessageLoopForUI message_loop_; |
| 90 content::TestBrowserThread ui_thread_; | 90 content::TestBrowserThread ui_thread_; |
| 91 content::TestBrowserThread file_thread_; | 91 content::TestBrowserThread file_thread_; |
| 92 | 92 |
| 93 private: | 93 private: |
| 94 void TestReservedPathCallback(FilePath* return_path, bool* return_verified, | 94 void TestReservedPathCallback(FilePath* return_path, bool* return_verified, |
| 95 bool* did_run_callback, | 95 bool* did_run_callback, |
| 96 const FilePath& path, bool verified); | 96 const FilePath& path, bool verified); |
| 97 }; | 97 }; |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 item->UpdateObservers(); | 417 item->UpdateObservers(); |
| 418 message_loop_.RunAllPending(); | 418 message_loop_.RunAllPending(); |
| 419 EXPECT_FALSE(IsPathInUse(path)); | 419 EXPECT_FALSE(IsPathInUse(path)); |
| 420 EXPECT_TRUE(IsPathInUse(new_target_path)); | 420 EXPECT_TRUE(IsPathInUse(new_target_path)); |
| 421 | 421 |
| 422 // Destroying the item should release the reservation. | 422 // Destroying the item should release the reservation. |
| 423 item.reset(); | 423 item.reset(); |
| 424 message_loop_.RunAllPending(); | 424 message_loop_.RunAllPending(); |
| 425 EXPECT_FALSE(IsPathInUse(new_target_path)); | 425 EXPECT_FALSE(IsPathInUse(new_target_path)); |
| 426 } | 426 } |
| OLD | NEW |