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

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

Issue 9834039: Remove resource_request_info_impl.h dependency from chrome. This also makes blob/file system urls w… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 9 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
« no previous file with comments | « chrome/browser/DEPS ('k') | chrome/browser/net/view_blob_internals_job_factory.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/download/download_browsertest.cc
===================================================================
--- chrome/browser/download/download_browsertest.cc (revision 128327)
+++ chrome/browser/download/download_browsertest.cc (working copy)
@@ -60,9 +60,8 @@
#include "content/test/test_file_error_injector.h"
#include "content/test/test_navigation_observer.h"
#include "net/base/net_util.h"
+#include "net/test/test_server.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "webkit/blob/blob_data.h"
-#include "webkit/blob/blob_storage_controller.h"
using content::BrowserThread;
using content::DownloadItem;
@@ -2432,8 +2431,7 @@
// downloaded through a blob: URL.
IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadDangerousBlobData) {
ASSERT_TRUE(InitialSetup(false));
- const char kBlobUrl[] = "blob:test-download-url";
- GURL blob_url(kBlobUrl);
+
#if defined(OS_WIN)
// On Windows, if SafeBrowsing is enabled, certain file types (.exe, .cab,
// .msi) will be handled by the DownloadProtectionService. However, if the URL
@@ -2444,25 +2442,19 @@
#else
const char kFilename[] = "foo.jar";
#endif
- std::string content_disposition = "attachment; filename=";
- content_disposition += kFilename;
- webkit_blob::BlobStorageController* blob_controller =
- content::ResourceContext::GetBlobStorageController(
- DownloadManagerForBrowser(browser())->GetBrowserContext()->
- GetResourceContext());
- scoped_refptr<webkit_blob::BlobData> blob_data(new webkit_blob::BlobData());
- blob_data->AppendData("foo");
- blob_controller->AddFinishedBlob(blob_url, blob_data.get());
- blob_data = blob_controller->GetBlobDataFromUrl(blob_url);
- blob_data->set_content_type("application/octet-stream");
- blob_data->set_content_disposition(content_disposition);
+ std::string path("files/downloads/download-dangerous-blob.html?filename=");
+ path += kFilename;
+ // Need to use http urls because the blob js doesn't work on file urls for
+ // security reasons.
+ ASSERT_TRUE(test_server()->Start());
+ GURL url(test_server()->GetURL(path));
+
DownloadTestObserver* observer(DangerousDownloadWaiter(
browser(), 1, DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_ACCEPT));
- ui_test_utils::NavigateToURL(browser(), blob_url);
+ ui_test_utils::NavigateToURL(browser(), url);
observer->WaitForFinished();
- blob_controller->RemoveBlob(blob_url);
EXPECT_EQ(1u, observer->NumDownloadsSeenInState(DownloadItem::COMPLETE));
EXPECT_EQ(1u, observer->NumDangerousDownloadsSeen());
« no previous file with comments | « chrome/browser/DEPS ('k') | chrome/browser/net/view_blob_internals_job_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698