Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: chrome/browser/download/chrome_download_manager_delegate_unittest.cc

Issue 2402053002: Don't prompt for download location on Android (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/download/download_target_determiner.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 ChromeDownloadManagerDelegateTest::download_manager() { 324 ChromeDownloadManagerDelegateTest::download_manager() {
325 return download_manager_.get(); 325 return download_manager_.get();
326 } 326 }
327 327
328 DownloadPrefs* ChromeDownloadManagerDelegateTest::download_prefs() { 328 DownloadPrefs* ChromeDownloadManagerDelegateTest::download_prefs() {
329 return delegate_->download_prefs(); 329 return delegate_->download_prefs();
330 } 330 }
331 331
332 } // namespace 332 } // namespace
333 333
334 // There is no "save as" context menu option on Android.
335 #if !BUILDFLAG(ANDROID_JAVA_UI)
334 TEST_F(ChromeDownloadManagerDelegateTest, StartDownload_LastSavePath) { 336 TEST_F(ChromeDownloadManagerDelegateTest, StartDownload_LastSavePath) {
335 GURL download_url("http://example.com/foo.txt"); 337 GURL download_url("http://example.com/foo.txt");
336 338
337 std::unique_ptr<content::MockDownloadItem> save_as_download = 339 std::unique_ptr<content::MockDownloadItem> save_as_download =
338 CreateActiveDownloadItem(0); 340 CreateActiveDownloadItem(0);
339 EXPECT_CALL(*save_as_download, GetURL()) 341 EXPECT_CALL(*save_as_download, GetURL())
340 .Times(::testing::AnyNumber()) 342 .Times(::testing::AnyNumber())
341 .WillRepeatedly(ReturnRef(download_url)); 343 .WillRepeatedly(ReturnRef(download_url));
342 EXPECT_CALL(*save_as_download, GetTargetDisposition()) 344 EXPECT_CALL(*save_as_download, GetTargetDisposition())
343 .Times(::testing::AnyNumber()) 345 .Times(::testing::AnyNumber())
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 DownloadTargetInfo result; 398 DownloadTargetInfo result;
397 base::FilePath expected_prompt_path(GetPathInDownloadDir("foo.txt")); 399 base::FilePath expected_prompt_path(GetPathInDownloadDir("foo.txt"));
398 EXPECT_CALL(*delegate(), 400 EXPECT_CALL(*delegate(),
399 MockPromptUserForDownloadPath(save_as_download.get(), 401 MockPromptUserForDownloadPath(save_as_download.get(),
400 expected_prompt_path, _)) 402 expected_prompt_path, _))
401 .WillOnce(Return(base::FilePath())); 403 .WillOnce(Return(base::FilePath()));
402 DetermineDownloadTarget(save_as_download.get(), &result); 404 DetermineDownloadTarget(save_as_download.get(), &result);
403 VerifyAndClearExpectations(); 405 VerifyAndClearExpectations();
404 } 406 }
405 } 407 }
408 #endif // !BUILDFLAG(ANDROID_JAVA_UI)
406 409
407 TEST_F(ChromeDownloadManagerDelegateTest, MaybeDangerousContent) { 410 TEST_F(ChromeDownloadManagerDelegateTest, MaybeDangerousContent) {
408 GURL url("http://example.com/foo"); 411 GURL url("http://example.com/foo");
409 412
410 std::unique_ptr<content::MockDownloadItem> download_item = 413 std::unique_ptr<content::MockDownloadItem> download_item =
411 CreateActiveDownloadItem(0); 414 CreateActiveDownloadItem(0);
412 EXPECT_CALL(*download_item, GetURL()).WillRepeatedly(ReturnRef(url)); 415 EXPECT_CALL(*download_item, GetURL()).WillRepeatedly(ReturnRef(url));
413 EXPECT_CALL(*download_item, GetTargetDisposition()) 416 EXPECT_CALL(*download_item, GetTargetDisposition())
414 .WillRepeatedly(Return(DownloadItem::TARGET_DISPOSITION_OVERWRITE)); 417 .WillRepeatedly(Return(DownloadItem::TARGET_DISPOSITION_OVERWRITE));
415 EXPECT_CALL(*delegate(), MockCheckDownloadUrl(_, _)) 418 EXPECT_CALL(*delegate(), MockCheckDownloadUrl(_, _))
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
666 EXPECT_CALL(*download_item, OnContentCheckCompleted(_)).Times(0); 669 EXPECT_CALL(*download_item, OnContentCheckCompleted(_)).Times(0);
667 } 670 }
668 671
669 base::RunLoop run_loop; 672 base::RunLoop run_loop;
670 ASSERT_FALSE(delegate()->ShouldCompleteDownload(download_item.get(), 673 ASSERT_FALSE(delegate()->ShouldCompleteDownload(download_item.get(),
671 run_loop.QuitClosure())); 674 run_loop.QuitClosure()));
672 run_loop.Run(); 675 run_loop.Run();
673 } 676 }
674 677
675 #endif // FULL_SAFE_BROWSING 678 #endif // FULL_SAFE_BROWSING
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/download/download_target_determiner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698