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 <stddef.h> | 5 #include <stddef.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 | 7 |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 return download_manager_.get(); | 330 return download_manager_.get(); |
331 } | 331 } |
332 | 332 |
333 DownloadPrefs* ChromeDownloadManagerDelegateTest::download_prefs() { | 333 DownloadPrefs* ChromeDownloadManagerDelegateTest::download_prefs() { |
334 return delegate_->download_prefs(); | 334 return delegate_->download_prefs(); |
335 } | 335 } |
336 | 336 |
337 } // namespace | 337 } // namespace |
338 | 338 |
339 // There is no "save as" context menu option on Android. | 339 // There is no "save as" context menu option on Android. |
340 #if !BUILDFLAG(ANDROID_JAVA_UI) | 340 #if !defined(OS_ANDROID) |
341 TEST_F(ChromeDownloadManagerDelegateTest, StartDownload_LastSavePath) { | 341 TEST_F(ChromeDownloadManagerDelegateTest, StartDownload_LastSavePath) { |
342 GURL download_url("http://example.com/foo.txt"); | 342 GURL download_url("http://example.com/foo.txt"); |
343 | 343 |
344 std::unique_ptr<content::MockDownloadItem> save_as_download = | 344 std::unique_ptr<content::MockDownloadItem> save_as_download = |
345 CreateActiveDownloadItem(0); | 345 CreateActiveDownloadItem(0); |
346 EXPECT_CALL(*save_as_download, GetURL()) | 346 EXPECT_CALL(*save_as_download, GetURL()) |
347 .Times(::testing::AnyNumber()) | 347 .Times(::testing::AnyNumber()) |
348 .WillRepeatedly(ReturnRef(download_url)); | 348 .WillRepeatedly(ReturnRef(download_url)); |
349 EXPECT_CALL(*save_as_download, GetTargetDisposition()) | 349 EXPECT_CALL(*save_as_download, GetTargetDisposition()) |
350 .Times(::testing::AnyNumber()) | 350 .Times(::testing::AnyNumber()) |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 DownloadTargetInfo result; | 403 DownloadTargetInfo result; |
404 base::FilePath expected_prompt_path(GetPathInDownloadDir("foo.txt")); | 404 base::FilePath expected_prompt_path(GetPathInDownloadDir("foo.txt")); |
405 EXPECT_CALL(*delegate(), | 405 EXPECT_CALL(*delegate(), |
406 MockPromptUserForDownloadPath(save_as_download.get(), | 406 MockPromptUserForDownloadPath(save_as_download.get(), |
407 expected_prompt_path, _)) | 407 expected_prompt_path, _)) |
408 .WillOnce(Return(base::FilePath())); | 408 .WillOnce(Return(base::FilePath())); |
409 DetermineDownloadTarget(save_as_download.get(), &result); | 409 DetermineDownloadTarget(save_as_download.get(), &result); |
410 VerifyAndClearExpectations(); | 410 VerifyAndClearExpectations(); |
411 } | 411 } |
412 } | 412 } |
413 #endif // !BUILDFLAG(ANDROID_JAVA_UI) | 413 #endif // !defined(OS_ANDROID) |
414 | 414 |
415 TEST_F(ChromeDownloadManagerDelegateTest, MaybeDangerousContent) { | 415 TEST_F(ChromeDownloadManagerDelegateTest, MaybeDangerousContent) { |
416 #if !defined(OS_ANDROID) | 416 #if !defined(OS_ANDROID) |
417 content::PluginService::GetInstance()->Init(); | 417 content::PluginService::GetInstance()->Init(); |
418 #endif | 418 #endif |
419 | 419 |
420 GURL url("http://example.com/foo"); | 420 GURL url("http://example.com/foo"); |
421 | 421 |
422 std::unique_ptr<content::MockDownloadItem> download_item = | 422 std::unique_ptr<content::MockDownloadItem> download_item = |
423 CreateActiveDownloadItem(0); | 423 CreateActiveDownloadItem(0); |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
678 EXPECT_CALL(*download_item, OnContentCheckCompleted(_)).Times(0); | 678 EXPECT_CALL(*download_item, OnContentCheckCompleted(_)).Times(0); |
679 } | 679 } |
680 | 680 |
681 base::RunLoop run_loop; | 681 base::RunLoop run_loop; |
682 ASSERT_FALSE(delegate()->ShouldCompleteDownload(download_item.get(), | 682 ASSERT_FALSE(delegate()->ShouldCompleteDownload(download_item.get(), |
683 run_loop.QuitClosure())); | 683 run_loop.QuitClosure())); |
684 run_loop.Run(); | 684 run_loop.Run(); |
685 } | 685 } |
686 | 686 |
687 #endif // FULL_SAFE_BROWSING | 687 #endif // FULL_SAFE_BROWSING |
OLD | NEW |