OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "chrome/browser/chromeos/drive/download_handler.h" | 5 #include "chrome/browser/chromeos/drive/download_handler.h" |
6 | 6 |
7 #include "base/files/scoped_temp_dir.h" | 7 #include "base/files/scoped_temp_dir.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "chrome/browser/chromeos/drive/file_system_util.h" | 9 #include "chrome/browser/chromeos/drive/file_system_util.h" |
10 #include "chrome/browser/chromeos/drive/file_write_helper.h" | 10 #include "chrome/browser/chromeos/drive/file_write_helper.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 | 53 |
54 // Set expectations for file system to save argument callbacks. | 54 // Set expectations for file system to save argument callbacks. |
55 EXPECT_CALL(file_system_, GetResourceEntryByPath(_, _)) | 55 EXPECT_CALL(file_system_, GetResourceEntryByPath(_, _)) |
56 .WillRepeatedly(SaveArg<1>(&get_entry_info_callback_)); | 56 .WillRepeatedly(SaveArg<1>(&get_entry_info_callback_)); |
57 EXPECT_CALL(file_system_, CreateDirectory(_, _, _, _)) | 57 EXPECT_CALL(file_system_, CreateDirectory(_, _, _, _)) |
58 .WillRepeatedly(SaveArg<3>(&create_directory_callback_)); | 58 .WillRepeatedly(SaveArg<3>(&create_directory_callback_)); |
59 | 59 |
60 file_write_helper_.reset(new FileWriteHelper(&file_system_)); | 60 file_write_helper_.reset(new FileWriteHelper(&file_system_)); |
61 download_handler_.reset( | 61 download_handler_.reset( |
62 new DownloadHandler(file_write_helper_.get(), &file_system_)); | 62 new DownloadHandler(file_write_helper_.get(), &file_system_)); |
63 download_handler_->Initialize(download_manager_, temp_dir_.path()); | 63 download_handler_->Initialize(download_manager_.get(), temp_dir_.path()); |
64 } | 64 } |
65 | 65 |
66 virtual void TearDown() OVERRIDE { | 66 virtual void TearDown() OVERRIDE { |
67 } | 67 } |
68 | 68 |
69 protected: | 69 protected: |
70 base::ScopedTempDir temp_dir_; | 70 base::ScopedTempDir temp_dir_; |
71 MessageLoopForUI message_loop_; | 71 MessageLoopForUI message_loop_; |
72 content::TestBrowserThread ui_thread_; | 72 content::TestBrowserThread ui_thread_; |
73 scoped_refptr<content::MockDownloadManager> download_manager_; | 73 scoped_ptr<content::MockDownloadManager> download_manager_; |
74 MockFileSystem file_system_; | 74 MockFileSystem file_system_; |
75 scoped_ptr<FileWriteHelper> file_write_helper_; | 75 scoped_ptr<FileWriteHelper> file_write_helper_; |
76 scoped_ptr<DownloadHandler> download_handler_; | 76 scoped_ptr<DownloadHandler> download_handler_; |
77 content::MockDownloadItem download_item_; | 77 content::MockDownloadItem download_item_; |
78 | 78 |
79 // Argument callbacks passed to the file system. | 79 // Argument callbacks passed to the file system. |
80 GetResourceEntryCallback get_entry_info_callback_; | 80 GetResourceEntryCallback get_entry_info_callback_; |
81 FileOperationCallback create_directory_callback_; | 81 FileOperationCallback create_directory_callback_; |
82 }; | 82 }; |
83 | 83 |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 ASSERT_FALSE(get_entry_info_callback_.is_null()); | 275 ASSERT_FALSE(get_entry_info_callback_.is_null()); |
276 get_entry_info_callback_.Run(FILE_ERROR_NOT_FOUND, | 276 get_entry_info_callback_.Run(FILE_ERROR_NOT_FOUND, |
277 scoped_ptr<ResourceEntry>()); | 277 scoped_ptr<ResourceEntry>()); |
278 google_apis::test_util::RunBlockingPoolTask(); | 278 google_apis::test_util::RunBlockingPoolTask(); |
279 | 279 |
280 // Check the result. | 280 // Check the result. |
281 EXPECT_FALSE(file_exists); | 281 EXPECT_FALSE(file_exists); |
282 } | 282 } |
283 | 283 |
284 } // namespace drive | 284 } // namespace drive |
OLD | NEW |