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

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

Issue 2394303003: Don't prompt for download location on Android (Closed)
Patch Set: disable "save as" tests on android 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 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 ChromeDownloadManagerDelegateTest::download_manager() { 329 ChromeDownloadManagerDelegateTest::download_manager() {
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.
340 #if !BUILDFLAG(ANDROID_JAVA_UI)
339 TEST_F(ChromeDownloadManagerDelegateTest, StartDownload_LastSavePath) { 341 TEST_F(ChromeDownloadManagerDelegateTest, StartDownload_LastSavePath) {
340 GURL download_url("http://example.com/foo.txt"); 342 GURL download_url("http://example.com/foo.txt");
341 343
342 std::unique_ptr<content::MockDownloadItem> save_as_download = 344 std::unique_ptr<content::MockDownloadItem> save_as_download =
343 CreateActiveDownloadItem(0); 345 CreateActiveDownloadItem(0);
344 EXPECT_CALL(*save_as_download, GetURL()) 346 EXPECT_CALL(*save_as_download, GetURL())
345 .Times(::testing::AnyNumber()) 347 .Times(::testing::AnyNumber())
346 .WillRepeatedly(ReturnRef(download_url)); 348 .WillRepeatedly(ReturnRef(download_url));
347 EXPECT_CALL(*save_as_download, GetTargetDisposition()) 349 EXPECT_CALL(*save_as_download, GetTargetDisposition())
348 .Times(::testing::AnyNumber()) 350 .Times(::testing::AnyNumber())
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 DownloadTargetInfo result; 403 DownloadTargetInfo result;
402 base::FilePath expected_prompt_path(GetPathInDownloadDir("foo.txt")); 404 base::FilePath expected_prompt_path(GetPathInDownloadDir("foo.txt"));
403 EXPECT_CALL(*delegate(), 405 EXPECT_CALL(*delegate(),
404 MockPromptUserForDownloadPath(save_as_download.get(), 406 MockPromptUserForDownloadPath(save_as_download.get(),
405 expected_prompt_path, _)) 407 expected_prompt_path, _))
406 .WillOnce(Return(base::FilePath())); 408 .WillOnce(Return(base::FilePath()));
407 DetermineDownloadTarget(save_as_download.get(), &result); 409 DetermineDownloadTarget(save_as_download.get(), &result);
408 VerifyAndClearExpectations(); 410 VerifyAndClearExpectations();
409 } 411 }
410 } 412 }
413 #endif // !BUILDFLAG(ANDROID_JAVA_UI)
411 414
412 TEST_F(ChromeDownloadManagerDelegateTest, MaybeDangerousContent) { 415 TEST_F(ChromeDownloadManagerDelegateTest, MaybeDangerousContent) {
413 #if !defined(OS_ANDROID) 416 #if !defined(OS_ANDROID)
414 content::PluginService::GetInstance()->Init(); 417 content::PluginService::GetInstance()->Init();
415 #endif 418 #endif
416 419
417 GURL url("http://example.com/foo"); 420 GURL url("http://example.com/foo");
418 421
419 std::unique_ptr<content::MockDownloadItem> download_item = 422 std::unique_ptr<content::MockDownloadItem> download_item =
420 CreateActiveDownloadItem(0); 423 CreateActiveDownloadItem(0);
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 EXPECT_CALL(*download_item, OnContentCheckCompleted(_)).Times(0); 678 EXPECT_CALL(*download_item, OnContentCheckCompleted(_)).Times(0);
676 } 679 }
677 680
678 base::RunLoop run_loop; 681 base::RunLoop run_loop;
679 ASSERT_FALSE(delegate()->ShouldCompleteDownload(download_item.get(), 682 ASSERT_FALSE(delegate()->ShouldCompleteDownload(download_item.get(),
680 run_loop.QuitClosure())); 683 run_loop.QuitClosure()));
681 run_loop.Run(); 684 run_loop.Run();
682 } 685 }
683 686
684 #endif // FULL_SAFE_BROWSING 687 #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