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

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

Issue 11048039: Don't use web intents for rss feeds. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix test Created 8 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 | Annotate | Revision Log
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 "base/file_path.h" 5 #include "base/file_path.h"
6 #include "base/file_util.h" 6 #include "base/file_util.h"
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/observer_list.h" 8 #include "base/observer_list.h"
9 #include "base/scoped_temp_dir.h" 9 #include "base/scoped_temp_dir.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after
904 RunTestCases(kLastSavePathTestCases, arraysize(kLastSavePathTestCases)); 904 RunTestCases(kLastSavePathTestCases, arraysize(kLastSavePathTestCases));
905 905
906 // Now clear the last download path. 906 // Now clear the last download path.
907 delegate()->ClearLastDownloadPath(); 907 delegate()->ClearLastDownloadPath();
908 908
909 // Run the first test case again. Since the last download path was cleared, 909 // Run the first test case again. Since the last download path was cleared,
910 // this test case should behave identically to the first time it was run. 910 // this test case should behave identically to the first time it was run.
911 RunTestCases(kLastSavePathTestCases, 1); 911 RunTestCases(kLastSavePathTestCases, 1);
912 } 912 }
913 913
914 #if defined(OS_CHROMEOS)
914 TEST_F(ChromeDownloadManagerDelegateTest, StartDownload_WebIntents) { 915 TEST_F(ChromeDownloadManagerDelegateTest, StartDownload_WebIntents) {
915 const DownloadTestCase kWebIntentsTestCases[] = { 916 const DownloadTestCase kWebIntentsTestCases[] = {
916 { 917 {
917 // 1: A file which would be dangerous, but is handled by web intents. 918 // 1: A file which would be dangerous, but is handled by web intents.
918 // The name will be unaltered (the actual save name will have the 919 // The name will be unaltered (the actual save name will have the
919 // .webintents extension). 920 // .webintents extension).
920 AUTOMATIC, 921 AUTOMATIC,
921 content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, 922 content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS,
922 "http://example.com/feed.exe", "application/rss+xml", 923 "http://example.com/feed.exe", "application/msword",
923 FILE_PATH_LITERAL(""), 924 FILE_PATH_LITERAL(""),
924 925
925 FILE_PATH_LITERAL("feed.exe.webintents"), 926 FILE_PATH_LITERAL("feed.exe.webintents"),
926 FILE_PATH_LITERAL(""), 927 FILE_PATH_LITERAL(""),
927 DownloadItem::TARGET_DISPOSITION_OVERWRITE, 928 DownloadItem::TARGET_DISPOSITION_OVERWRITE,
928 929
929 EXPECT_CRDOWNLOAD 930 EXPECT_CRDOWNLOAD
930 }, 931 },
931 932
932 { 933 {
933 // 2: A download with a forced path won't be handled by web intents. 934 // 2: A download with a forced path won't be handled by web intents.
934 FORCED, 935 FORCED,
935 content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, 936 content::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS,
936 "http://example.com/feed.exe", "application/rss+xml", 937 "http://example.com/feed.exe", "application/msword",
937 FILE_PATH_LITERAL("forced.feed.exe"), 938 FILE_PATH_LITERAL("forced.feed.exe"),
938 939
939 FILE_PATH_LITERAL("forced.feed.exe"), 940 FILE_PATH_LITERAL("forced.feed.exe"),
940 FILE_PATH_LITERAL(""), 941 FILE_PATH_LITERAL(""),
941 DownloadItem::TARGET_DISPOSITION_OVERWRITE, 942 DownloadItem::TARGET_DISPOSITION_OVERWRITE,
942 943
943 EXPECT_CRDOWNLOAD 944 EXPECT_CRDOWNLOAD
944 }, 945 },
945 }; 946 };
946 947
947 RunTestCases(kWebIntentsTestCases, arraysize(kWebIntentsTestCases)); 948 RunTestCases(kWebIntentsTestCases, arraysize(kWebIntentsTestCases));
948 } 949 }
950 #endif
949 951
950 // TODO(asanka): Add more tests. 952 // TODO(asanka): Add more tests.
951 // * Default download path is not writable. 953 // * Default download path is not writable.
952 // * Download path doesn't exist. 954 // * Download path doesn't exist.
953 // * IsDangerousFile(). 955 // * IsDangerousFile().
954 // * Filename generation. 956 // * Filename generation.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698