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

Unified Diff: content/browser/download/download_browsertest.cc

Issue 18364005: Don't override application/octet-stream MIME type. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge with r212359 Created 7 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/download/download_browsertest.cc
diff --git a/content/browser/download/download_browsertest.cc b/content/browser/download/download_browsertest.cc
index 38663b898a357d8ad326d42941a12100e15e6b80..ab5259445a5c2a4177d277433f68ecd9a15032e2 100644
--- a/content/browser/download/download_browsertest.cc
+++ b/content/browser/download/download_browsertest.cc
@@ -10,12 +10,14 @@
#include "base/files/file_path.h"
#include "base/files/scoped_temp_dir.h"
#include "base/strings/stringprintf.h"
+#include "base/strings/utf_string_conversions.h"
#include "content/browser/byte_stream.h"
#include "content/browser/download/download_file_factory.h"
#include "content/browser/download/download_file_impl.h"
#include "content/browser/download/download_item_impl.h"
#include "content/browser/download/download_manager_impl.h"
#include "content/browser/download/download_resource_handler.h"
+#include "content/browser/plugin_service_impl.h"
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/public/browser/power_save_blocker.h"
#include "content/public/common/content_switches.h"
@@ -33,6 +35,7 @@
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
+#include "webkit/plugins/webplugininfo.h"
using ::testing::_;
using ::testing::AllOf;
@@ -779,6 +782,28 @@ IN_PROC_BROWSER_TEST_F(DownloadContentTest, MultiDownload) {
file2, GetTestFilePath("download", "download-test.lib")));
}
+#if defined(ENABLE_PLUGINS)
+// Content served with a MIME type of application/octet-stream should be
+// downloaded even when a plugin can be found that handles the file type.
+IN_PROC_BROWSER_TEST_F(DownloadContentTest, DownloadOctetStream) {
+ const base::FilePath::CharType kTestFilePath[] =
+ FILE_PATH_LITERAL("octet-stream.abc");
+ const char kTestPluginName[] = "TestPlugin";
+ const char kTestMimeType[] = "application/x-test-mime-type";
+ const char kTestFileType[] = "abc";
+
+ webkit::WebPluginInfo plugin_info;
+ plugin_info.name = base::ASCIIToUTF16(kTestPluginName);
+ plugin_info.mime_types.push_back(
+ webkit::WebPluginMimeType(kTestMimeType, kTestFileType, ""));
+ PluginServiceImpl::GetInstance()->RegisterInternalPlugin(plugin_info, false);
+
+ // The following is served with a Content-Type of application/octet-stream.
+ GURL url(URLRequestMockHTTPJob::GetMockUrl(base::FilePath(kTestFilePath)));
+ DownloadAndWait(shell(), url, DownloadItem::COMPLETE);
+}
+#endif
+
// Try to cancel just before we release the download file, by delaying final
// rename callback.
IN_PROC_BROWSER_TEST_F(DownloadContentTest, CancelAtFinalRename) {
« no previous file with comments | « no previous file | content/test/data/download/octet-stream.abc » ('j') | webkit/plugins/npapi/plugin_list_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698