| Index: chrome/browser/download/download_target_determiner_unittest.cc
|
| diff --git a/chrome/browser/download/download_target_determiner_unittest.cc b/chrome/browser/download/download_target_determiner_unittest.cc
|
| index e443b2d3e400766dc7ce82ec60887943d37c77c6..e1849cfab44e92a11ec71e61685923871fdd9be5 100644
|
| --- a/chrome/browser/download/download_target_determiner_unittest.cc
|
| +++ b/chrome/browser/download/download_target_determiner_unittest.cc
|
| @@ -521,7 +521,7 @@ TEST_F(DownloadTargetDeterminerTest, Basic) {
|
|
|
| EXPECT_CRDOWNLOAD},
|
|
|
| -#if !BUILDFLAG(ANDROID_JAVA_UI)
|
| +#if !defined(OS_ANDROID)
|
| {// 1: Save_As Safe
|
| SAVE_AS, content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS,
|
| DownloadFileType::NOT_DANGEROUS, "http://example.com/foo.txt",
|
| @@ -530,7 +530,7 @@ TEST_F(DownloadTargetDeterminerTest, Basic) {
|
| FILE_PATH_LITERAL("foo.txt"), DownloadItem::TARGET_DISPOSITION_PROMPT,
|
|
|
| EXPECT_CRDOWNLOAD},
|
| -#endif // !BUILDFLAG(ANDROID_JAVA_UI)
|
| +#endif // !defined(OS_ANDROID)
|
|
|
| {// 2: Automatic Dangerous
|
| AUTOMATIC, content::DOWNLOAD_DANGER_TYPE_DANGEROUS_FILE,
|
| @@ -560,7 +560,7 @@ TEST_F(DownloadTargetDeterminerTest, Basic) {
|
| RunTestCasesWithActiveItem(kBasicTestCases, arraysize(kBasicTestCases));
|
| }
|
|
|
| -#if !BUILDFLAG(ANDROID_JAVA_UI)
|
| +#if !defined(OS_ANDROID)
|
| TEST_F(DownloadTargetDeterminerTest, CancelSaveAs) {
|
| const DownloadTestCase kCancelSaveAsTestCases[] = {
|
| {// 0: Save_As Safe, Cancelled.
|
| @@ -576,7 +576,7 @@ TEST_F(DownloadTargetDeterminerTest, CancelSaveAs) {
|
| RunTestCasesWithActiveItem(kCancelSaveAsTestCases,
|
| arraysize(kCancelSaveAsTestCases));
|
| }
|
| -#endif // !BUILDFLAG(ANDROID_JAVA_UI)
|
| +#endif // !defined(OS_ANDROID)
|
|
|
| // The SafeBrowsing check is performed early. Make sure that a download item
|
| // that has been marked as DANGEROUS_URL behaves correctly.
|
| @@ -591,7 +591,7 @@ TEST_F(DownloadTargetDeterminerTest, DangerousUrl) {
|
|
|
| EXPECT_UNCONFIRMED},
|
|
|
| -#if !BUILDFLAG(ANDROID_JAVA_UI)
|
| +#if !defined(OS_ANDROID)
|
| {// 1: Save As Dangerous URL
|
| SAVE_AS, content::DOWNLOAD_DANGER_TYPE_DANGEROUS_URL,
|
| DownloadFileType::NOT_DANGEROUS, "http://phishing.example.com/foo.txt",
|
| @@ -600,7 +600,7 @@ TEST_F(DownloadTargetDeterminerTest, DangerousUrl) {
|
| FILE_PATH_LITERAL("foo.txt"), DownloadItem::TARGET_DISPOSITION_PROMPT,
|
|
|
| EXPECT_UNCONFIRMED},
|
| -#endif // !BUILDFLAG(ANDROID_JAVA_UI)
|
| +#endif // !defined(OS_ANDROID)
|
|
|
| {// 2: Forced Dangerous URL
|
| FORCED, content::DOWNLOAD_DANGER_TYPE_DANGEROUS_URL,
|
| @@ -623,7 +623,7 @@ TEST_F(DownloadTargetDeterminerTest, DangerousUrl) {
|
|
|
| EXPECT_UNCONFIRMED},
|
|
|
| -#if !BUILDFLAG(ANDROID_JAVA_UI)
|
| +#if !defined(OS_ANDROID)
|
| {// 4: Save As Dangerous URL + Dangerous file
|
| SAVE_AS, content::DOWNLOAD_DANGER_TYPE_DANGEROUS_URL,
|
| DownloadFileType::NOT_DANGEROUS, "http://phishing.example.com/foo.html",
|
| @@ -632,7 +632,7 @@ TEST_F(DownloadTargetDeterminerTest, DangerousUrl) {
|
| FILE_PATH_LITERAL("foo.html"), DownloadItem::TARGET_DISPOSITION_PROMPT,
|
|
|
| EXPECT_UNCONFIRMED},
|
| -#endif // !BUILDFLAG(ANDROID_JAVA_UI)
|
| +#endif // !defined(OS_ANDROID)
|
|
|
| {// 5: Forced Dangerous URL + Dangerous file
|
| FORCED, content::DOWNLOAD_DANGER_TYPE_DANGEROUS_URL,
|
| @@ -675,7 +675,7 @@ TEST_F(DownloadTargetDeterminerTest, MaybeDangerousContent) {
|
| EXPECT_UNCONFIRMED},
|
|
|
|
|
| -#if !BUILDFLAG(ANDROID_JAVA_UI)
|
| +#if !defined(OS_ANDROID)
|
| {// 2: Save As Maybe dangerous content
|
| SAVE_AS, content::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT,
|
| DownloadFileType::NOT_DANGEROUS, "http://phishing.example.com/foo.crx",
|
| @@ -684,7 +684,7 @@ TEST_F(DownloadTargetDeterminerTest, MaybeDangerousContent) {
|
| FILE_PATH_LITERAL("foo.crx"), DownloadItem::TARGET_DISPOSITION_PROMPT,
|
|
|
| EXPECT_UNCONFIRMED},
|
| -#endif // !BUILDFLAG(ANDROID_JAVA_UI)
|
| +#endif // !defined(OS_ANDROID)
|
|
|
| {// 3: Forced Maybe dangerous content
|
| FORCED, content::DOWNLOAD_DANGER_TYPE_MAYBE_DANGEROUS_CONTENT,
|
| @@ -712,7 +712,7 @@ TEST_F(DownloadTargetDeterminerTest, MaybeDangerousContent) {
|
| arraysize(kSafeBrowsingTestCases));
|
| }
|
|
|
| -#if !BUILDFLAG(ANDROID_JAVA_UI)
|
| +#if !defined(OS_ANDROID)
|
| // Test whether the last saved directory is used for 'Save As' downloads.
|
| TEST_F(DownloadTargetDeterminerTest, LastSavePath) {
|
| const DownloadTestCase kLastSavePathTestCasesPre[] = {
|
| @@ -801,7 +801,7 @@ TEST_F(DownloadTargetDeterminerTest, LastSavePath) {
|
| arraysize(kLastSavePathTestCasesVirtual));
|
| }
|
| }
|
| -#endif // !BUILDFLAG(ANDROID_JAVA_UI)
|
| +#endif // !defined(OS_ANDROID)
|
|
|
| // These tests are run with the default downloads folder set to a virtual
|
| // directory.
|
| @@ -829,7 +829,7 @@ TEST_F(DownloadTargetDeterminerTest, DefaultVirtual) {
|
| RunTestCasesWithActiveItem(&kAutomaticDownloadToVirtualDir, 1);
|
| }
|
|
|
| -#if !BUILDFLAG(ANDROID_JAVA_UI)
|
| +#if !defined(OS_ANDROID)
|
| {
|
| SCOPED_TRACE(testing::Message() << "Save As to virtual directory");
|
| const DownloadTestCase kSaveAsToVirtualDir = {
|
| @@ -874,7 +874,7 @@ TEST_F(DownloadTargetDeterminerTest, DefaultVirtual) {
|
| GetPathInDownloadDir(FILE_PATH_LITERAL("foo-x.txt")))));
|
| RunTestCasesWithActiveItem(&kSaveAsToLocalDir, 1);
|
| }
|
| -#endif // !BUILDFLAG(ANDROID_JAVA_UI)
|
| +#endif // !defined(OS_ANDROID)
|
|
|
| {
|
| SCOPED_TRACE(testing::Message() << "Forced safe download");
|
| @@ -906,7 +906,7 @@ TEST_F(DownloadTargetDeterminerTest, InactiveDownload) {
|
|
|
| EXPECT_CRDOWNLOAD},
|
|
|
| -#if !BUILDFLAG(ANDROID_JAVA_UI)
|
| +#if !defined(OS_ANDROID)
|
| {SAVE_AS, content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS,
|
| DownloadFileType::NOT_DANGEROUS, "http://example.com/foo.txt",
|
| "text/plain", FILE_PATH_LITERAL(""),
|
| @@ -914,7 +914,7 @@ TEST_F(DownloadTargetDeterminerTest, InactiveDownload) {
|
| FILE_PATH_LITERAL("foo.txt"), DownloadItem::TARGET_DISPOSITION_PROMPT,
|
|
|
| EXPECT_CRDOWNLOAD}
|
| -#endif // !BUILDFLAG(ANDROID_JAVA_UI)
|
| +#endif // !defined(OS_ANDROID)
|
| };
|
|
|
| for (size_t i = 0; i < arraysize(kInactiveTestCases); ++i) {
|
| @@ -1005,7 +1005,7 @@ TEST_F(DownloadTargetDeterminerTest, VisitedReferrer) {
|
|
|
| EXPECT_UNCONFIRMED},
|
|
|
| -#if !BUILDFLAG(ANDROID_JAVA_UI)
|
| +#if !defined(OS_ANDROID)
|
| {// 2: Safe because the user is being prompted.
|
| SAVE_AS, content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS,
|
| DownloadFileType::NOT_DANGEROUS,
|
| @@ -1015,7 +1015,7 @@ TEST_F(DownloadTargetDeterminerTest, VisitedReferrer) {
|
| FILE_PATH_LITERAL("foo.crx"), DownloadItem::TARGET_DISPOSITION_PROMPT,
|
|
|
| EXPECT_CRDOWNLOAD},
|
| -#endif // !BUILDFLAG(ANDROID_JAVA_UI)
|
| +#endif // !defined(OS_ANDROID)
|
|
|
| {// 3: Safe because of forced path.
|
| FORCED, content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS,
|
| @@ -1171,7 +1171,7 @@ TEST_F(DownloadTargetDeterminerTest, TransitionType) {
|
| }
|
| }
|
|
|
| -#if !BUILDFLAG(ANDROID_JAVA_UI)
|
| +#if !defined(OS_ANDROID)
|
| // These test cases are run with "Prompt for download" user preference set to
|
| // true.
|
| TEST_F(DownloadTargetDeterminerTest, PromptAlways) {
|
| @@ -1213,7 +1213,7 @@ TEST_F(DownloadTargetDeterminerTest, PromptAlways) {
|
| RunTestCasesWithActiveItem(kPromptingTestCases,
|
| arraysize(kPromptingTestCases));
|
| }
|
| -#endif // !BUILDFLAG(ANDROID_JAVA_UI)
|
| +#endif // !defined(OS_ANDROID)
|
|
|
| #if BUILDFLAG(ENABLE_EXTENSIONS)
|
| // These test cases are run with "Prompt for download" user preference set to
|
| @@ -1306,7 +1306,7 @@ TEST_F(DownloadTargetDeterminerTest, NotifyExtensionsSafe) {
|
|
|
| EXPECT_CRDOWNLOAD},
|
|
|
| -#if !BUILDFLAG(ANDROID_JAVA_UI)
|
| +#if !defined(OS_ANDROID)
|
| {// 1: Save_As Safe
|
| SAVE_AS, content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS,
|
| DownloadFileType::NOT_DANGEROUS, "http://example.com/foo.txt",
|
| @@ -1316,7 +1316,7 @@ TEST_F(DownloadTargetDeterminerTest, NotifyExtensionsSafe) {
|
| DownloadItem::TARGET_DISPOSITION_PROMPT,
|
|
|
| EXPECT_CRDOWNLOAD},
|
| -#endif // !BUILDFLAG(ANDROID_JAVA_UI)
|
| +#endif // !defined(OS_ANDROID)
|
|
|
| {// 2: Automatic Dangerous
|
| AUTOMATIC, content::DOWNLOAD_DANGER_TYPE_DANGEROUS_FILE,
|
| @@ -1431,7 +1431,7 @@ TEST_F(DownloadTargetDeterminerTest, NotifyExtensionsConflict) {
|
| RunTestCase(test_case, base::FilePath(), item.get());
|
| }
|
|
|
| -#if !BUILDFLAG(ANDROID_JAVA_UI)
|
| +#if !defined(OS_ANDROID)
|
| // Test that relative paths returned by extensions are always relative to the
|
| // default downloads path.
|
| TEST_F(DownloadTargetDeterminerTest, NotifyExtensionsDefaultPath) {
|
| @@ -1468,7 +1468,7 @@ TEST_F(DownloadTargetDeterminerTest, NotifyExtensionsDefaultPath) {
|
| ScheduleCallback(full_overridden_path)));
|
| RunTestCase(test_case, base::FilePath(), item.get());
|
| }
|
| -#endif // !BUILDFLAG(ANDROID_JAVA_UI)
|
| +#endif // !defined(OS_ANDROID)
|
|
|
| TEST_F(DownloadTargetDeterminerTest, InitialVirtualPathUnsafe) {
|
| const base::FilePath::CharType* kInitialPath =
|
| @@ -1636,7 +1636,7 @@ TEST_F(DownloadTargetDeterminerTest, ResumedWithPrompt) {
|
| "text/plain", FILE_PATH_LITERAL(""),
|
|
|
| FILE_PATH_LITERAL("foo.txt"),
|
| -#if BUILDFLAG(ANDROID_JAVA_UI)
|
| +#if defined(OS_ANDROID)
|
| DownloadItem::TARGET_DISPOSITION_OVERWRITE,
|
| #else
|
| DownloadItem::TARGET_DISPOSITION_PROMPT,
|
| @@ -1655,7 +1655,7 @@ TEST_F(DownloadTargetDeterminerTest, ResumedWithPrompt) {
|
| {
|
| // 2: Automatic Dangerous
|
| AUTOMATIC,
|
| -#if BUILDFLAG(ANDROID_JAVA_UI)
|
| +#if defined(OS_ANDROID)
|
| // If we don't prompt user, the file will be treated as dangerous.
|
| content::DOWNLOAD_DANGER_TYPE_DANGEROUS_FILE,
|
| DownloadFileType::ALLOW_ON_USER_GESTURE,
|
| @@ -1666,7 +1666,7 @@ TEST_F(DownloadTargetDeterminerTest, ResumedWithPrompt) {
|
| "http://example.com/foo.crx", "", FILE_PATH_LITERAL(""),
|
|
|
| FILE_PATH_LITERAL("foo.crx"),
|
| -#if BUILDFLAG(ANDROID_JAVA_UI)
|
| +#if defined(OS_ANDROID)
|
| DownloadItem::TARGET_DISPOSITION_OVERWRITE,
|
| // Dangerous download will have an unconfirmed intermediate file name.
|
| EXPECT_UNCONFIRMED,
|
| @@ -1695,7 +1695,7 @@ TEST_F(DownloadTargetDeterminerTest, ResumedWithPrompt) {
|
| EXPECT_CALL(*delegate(), NotifyExtensions(_, _, _))
|
| .Times(test_case.test_type == AUTOMATIC ? 1 : 0);
|
| EXPECT_CALL(*delegate(), ReserveVirtualPath(_, expected_path, false, _, _));
|
| -#if BUILDFLAG(ANDROID_JAVA_UI)
|
| +#if defined(OS_ANDROID)
|
| EXPECT_CALL(*delegate(), PromptUserForDownloadPath(_, expected_path, _))
|
| .Times(0);
|
| #else
|
|
|