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/files/file_path.h" | 5 #include "base/files/file_path.h" |
6 #include "base/files/file_util.h" | 6 #include "base/files/file_util.h" |
7 #include "base/files/scoped_temp_dir.h" | 7 #include "base/files/scoped_temp_dir.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 .WillByDefault(Return(id)); | 211 .WillByDefault(Return(id)); |
212 ON_CALL(*item, GetLastReason()) | 212 ON_CALL(*item, GetLastReason()) |
213 .WillByDefault(Return(content::DOWNLOAD_INTERRUPT_REASON_NONE)); | 213 .WillByDefault(Return(content::DOWNLOAD_INTERRUPT_REASON_NONE)); |
214 ON_CALL(*item, GetReferrerUrl()) | 214 ON_CALL(*item, GetReferrerUrl()) |
215 .WillByDefault(ReturnRefOfCopy(GURL())); | 215 .WillByDefault(ReturnRefOfCopy(GURL())); |
216 ON_CALL(*item, GetState()) | 216 ON_CALL(*item, GetState()) |
217 .WillByDefault(Return(DownloadItem::IN_PROGRESS)); | 217 .WillByDefault(Return(DownloadItem::IN_PROGRESS)); |
218 ON_CALL(*item, GetTargetFilePath()) | 218 ON_CALL(*item, GetTargetFilePath()) |
219 .WillByDefault(ReturnRefOfCopy(base::FilePath())); | 219 .WillByDefault(ReturnRefOfCopy(base::FilePath())); |
220 ON_CALL(*item, GetTransitionType()) | 220 ON_CALL(*item, GetTransitionType()) |
221 .WillByDefault(Return(content::PAGE_TRANSITION_LINK)); | 221 .WillByDefault(Return(ui::PAGE_TRANSITION_LINK)); |
222 ON_CALL(*item, GetWebContents()) | 222 ON_CALL(*item, GetWebContents()) |
223 .WillByDefault(Return(web_contents())); | 223 .WillByDefault(Return(web_contents())); |
224 ON_CALL(*item, HasUserGesture()) | 224 ON_CALL(*item, HasUserGesture()) |
225 .WillByDefault(Return(false)); | 225 .WillByDefault(Return(false)); |
226 ON_CALL(*item, IsDangerous()) | 226 ON_CALL(*item, IsDangerous()) |
227 .WillByDefault(Return(false)); | 227 .WillByDefault(Return(false)); |
228 ON_CALL(*item, IsTemporary()) | 228 ON_CALL(*item, IsTemporary()) |
229 .WillByDefault(Return(false)); | 229 .WillByDefault(Return(false)); |
230 EXPECT_CALL(*download_manager_, GetDownload(id)) | 230 EXPECT_CALL(*download_manager_, GetDownload(id)) |
231 .WillRepeatedly(Return(item)); | 231 .WillRepeatedly(Return(item)); |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 CreateActiveDownloadItem(1)); | 392 CreateActiveDownloadItem(1)); |
393 EXPECT_CALL(*download_item, GetTargetFilePath()) | 393 EXPECT_CALL(*download_item, GetTargetFilePath()) |
394 .WillRepeatedly(ReturnRef(existing_path)); | 394 .WillRepeatedly(ReturnRef(existing_path)); |
395 EXPECT_TRUE(CheckForFileExistence(download_item.get())); | 395 EXPECT_TRUE(CheckForFileExistence(download_item.get())); |
396 | 396 |
397 download_item.reset(CreateActiveDownloadItem(1)); | 397 download_item.reset(CreateActiveDownloadItem(1)); |
398 EXPECT_CALL(*download_item, GetTargetFilePath()) | 398 EXPECT_CALL(*download_item, GetTargetFilePath()) |
399 .WillRepeatedly(ReturnRef(non_existent_path)); | 399 .WillRepeatedly(ReturnRef(non_existent_path)); |
400 EXPECT_FALSE(CheckForFileExistence(download_item.get())); | 400 EXPECT_FALSE(CheckForFileExistence(download_item.get())); |
401 } | 401 } |
OLD | NEW |