Commit 854e131a authored by jam@chromium.org's avatar jam@chromium.org

Move resource_dispatcher_host_browsertest.cc to content_browsertests.

BUG=90448
Review URL: https://chromiumcodereview.appspot.com/10829070

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@148966 0039d316-1c4b-4281-b951-d872f2087c98
parent 3dfa4c08
......@@ -79,14 +79,6 @@
],
'isolate_dependency_touched': [
'../third_party/pyftpdlib/src/pyftpdlib/__init__.py',
'test/data/content-disposition-empty.html',
'test/data/content-disposition-inline.html',
'test/data/content-sniffer-test0.html',
'test/data/content-sniffer-test1.html',
'test/data/content-sniffer-test2.html',
'test/data/content-sniffer-test3-frame.txt',
'test/data/content-sniffer-test3.html',
'test/data/nosniff-test.html',
'test/data/title2.html',
],
},
......@@ -333,26 +325,11 @@
'test/data/autofill/heuristics/output/20_register_epson.com.mx.out',
'test/data/beforeunload.html',
'test/data/cancelled_redirect_test.html',
'test/data/content-disposition-empty.html',
'test/data/content-disposition-empty.html.mock-http-headers',
'test/data/content-disposition-inline.html',
'test/data/content-disposition-inline.html.mock-http-headers',
'test/data/content-sniffer-test0.html',
'test/data/content-sniffer-test0.html.mock-http-headers',
'test/data/content-sniffer-test1.html',
'test/data/content-sniffer-test1.html.mock-http-headers',
'test/data/content-sniffer-test2.html',
'test/data/content-sniffer-test2.html.mock-http-headers',
'test/data/content-sniffer-test3-frame.txt.mock-http-headers',
'test/data/content-sniffer-test3.html',
'test/data/content-sniffer-test3.html.mock-http-headers',
'test/data/cookie1.html',
'test/data/custom_handler_foo.html',
'test/data/download-test2.html',
'test/data/download-test2.html.mock-http-headers',
'test/data/download-test3.gif',
'test/data/dynamic1.html',
'test/data/dynamic2.html',
'test/data/empty.html',
'test/data/english_page.html',
'test/data/extensions/api_test/app_process/manifest.json',
......@@ -542,8 +519,6 @@
'test/data/iframe_in_empty_frame.js',
'test/data/is_search_provider_installed.html',
'test/data/is_search_provider_installed_with_exception.html',
'test/data/nosniff-test.html',
'test/data/nosniff-test.html.mock-http-headers',
'test/data/notifications/notifications_request_function.html',
'test/data/notifications/notifications_request_inline.html',
'test/data/page_cycler/animate2.gif',
......@@ -641,8 +616,6 @@
'test/data/ssl/unsafe_worker.js',
'test/data/ssl/wss_close.html',
'test/data/ssl/wss_close_slave.html',
'test/data/sync_xmlhttprequest_disallowed.html',
'test/data/sync_xmlhttprequest_during_unload.html',
'test/data/title1.html',
'test/data/title3.html',
'test/data/webui/async.js',
......
......@@ -3007,7 +3007,6 @@
# TODO(craig): Rename this and run from base_unittests when the test
# is safe to run there. See http://crbug.com/78722 for details.
'../base/files/file_path_watcher_browsertest.cc',
'../content/browser/renderer_host/resource_dispatcher_host_browsertest.cc',
],
'rules': [
{
......
<html>
<head><title>success</title></head>
<body>this page should be displayed instead of downloaded</body>
</html>
HTTP/1.1 200 OK
Content-Type: text/html
Content-Length: 116
Content-Disposition: filename="foo.html"
Date: Mon, 13 Nov 2006 21:38:09 GMT
Expires: Tue, 14 Nov 2006 19:23:58 GMT
<html>
<head><title>success</title></head>
<body>this page should be displayed instead of downloaded</body>
</html>
HTTP/1.1 200 OK
Content-Type: text/html
Content-Length: 116
Content-Disposition: inline; filename="foo.html"
Date: Mon, 13 Nov 2006 21:38:09 GMT
Expires: Tue, 14 Nov 2006 19:23:58 GMT
<html>
<head><title>Content Sniffer Test 0</title></head>
<body>We should sniff this content as HTML.</body>
</html>
<html>
<head><title>Content Sniffer Test 1</title></head>
<body>We should not sniff this content as HTML.</body>
</html>
HTTP/1.1 200 OK
Content-Type: text/plain; charset=utf-8
Content-Length: 125
<html>
<head><title>Content Sniffer Test 2</title></head>
<body>We should not sniff this as HTML as server says its a GIF.</body>
</html>
HTTP/1.1 200 OK
Content-Type: image/gif
Content-Length: 142
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<title>Content Sniffer Test 3</title>
</head>
<body>
<script id="sc">
var iframe = document.createElement('iframe');
iframe.frameBorder = iframe.width = iframe.height = 0;
iframe.src = "http://mock.http/content-sniffer-test3-frame.txt";
document.body.appendChild(iframe);
</script>
<pre>Do NOT download!!</pre>
</body>
</html>
HTTP/1.1 200 OK
Content-Length: 472
Content-Type: text/html
<html>
<head>
<title></title>
</head>
<body>
<script>
function NewXHR(url) {
var r = new XMLHttpRequest
r.open("GET", url);
return r;
}
function SignalSuccess() {
document.location = "title3.html";
}
function SignalFailure() {
document.location = "title1.html";
}
function CreateDummyRequest() {
dummy_request = NewXHR("http://mock.http/title2.html");
dummy_request.onload = SignalSuccess;
dummy_request.send(null);
}
function RedirectFailed() {
// Good, the redirect was blocked by WebKit.
//
// We also care that the underlying network stack does not send the redirect.
// We cannot detect that from JS, but our test harness is designed to detect
// that (see ResourceDispatcherTest::CrossOriginRedirectBlocked). Before
// calling SignalSuccess, we want to allow the browser time to notice a request
// to follow the redirect if one should exist. To do that, we just need to
// make another network request.
//
// The setTimeout call is intended to delay CreateDummyRequest so that any
// processing associated with the current "error" handler completes.
setTimeout(CreateDummyRequest, 0);
}
function RedirectSucceeded() {
// Oops, the redirect should have been denied!
SignalFailure();
}
// Kick off a request that will attempt a cross-origin redirect.
request = NewXHR("http://mock.http/redirect-to-title2.html");
request.onerror = RedirectFailed;
request.onload = RedirectSucceeded;
request.send(null);
</script>
</body>
</html>
<html>
<head>
<title>Test Title</title>
<script type="text/javascript">
function OpenPopup() {
// Create a new popup window
var oWnd = window.open('','MyPopupName','width=350,height=300',false);
// Dynamically generate the HTML content for popup window
var sHtml =
'<html>'
+ '<head><title>My Popup Title</title></head>'
+ '<body></body>'
+ '</html>';
// Push the HTML into that window
oWnd.document.write(sHtml);
// Finish
oWnd.document.close();
}
</script>
</head>
<body>
<p>This is dynamic1.html</p>
</body>
</html>
<html>
<head>
<title>Test Title</title>
<script type="text/javascript">
function OpenPopup() {
// Create a new popup window
var oWnd = window.open('','MyPopupName','width=350,height=300',false);
// Dynamically generate the HTML content for popup window
var sHtml =
'<html>'
+ '<head><title>My Popup Title</title></head>'
+ '<body>'
+ '<script type="text/javascript">'
+ 'document.title="My Dynamic Title";'
+ '<\/script>'
+ '</body>'
+ '</html>';
// Push the HTML into that window
oWnd.document.write(sHtml);
// Finish
oWnd.document.close();
}
</script>
</head>
<body>
<p>This is dynamic2.html</p>
</body>
</html>
<html>
<head><title>nosniff Test</title></head>
<body>We should NOT sniff this content as HTML.</body>
</html>
HTTP/1.1 200 OK
Content-Length: 111
X-Content-Type-Options: nosniff
<html>
<head>
<title>Loading...</title>
</head>
<body onload="attachUnloadListener()">
<script>
function attachUnloadListener() {
window.addEventListener('unload', onUnload, false);
document.title = "set cookie on unload";
}
function onUnload() {
document.cookie = "onunloadCookie=foo";
}
</script>
<p>Navigate to another page to set cookie</p>
</body>
</html>
<html>
<head>
<script>
var request_success = false;
function OnLoad() {
var request = new XMLHttpRequest();
request.open("GET", "title1.html", false);
request.send("");
var my_div = document.getElementById("my_div");
if (request.readyState == 4 && request.status == 200) {
request_success = true;
my_div.innerHTML = "Got a successful response: " + request.responseText;
} else {
my_div.innerHTML = "Request failed: ready state=" + request.readyState +
" status=" + request.status;
}
}
function DidSyncRequestSucceed() {
return request_success;
}
</script>
</head>
<body onload="OnLoad();">
This page sends a synchronous XMLHttpRequest.
<br><br>
<div id="my_div"></div>
</body>
</html>
<html>
<head>
<script>
var success = false;
function OnLoad() {
try {
var request = new XMLHttpRequest();
request.open("GET", "file:///c:/foo.txt", false);
request.send(null);
} catch (e) {
success = true;
}
document.getElementById("console").appendChild(
document.createTextNode(success ? "SUCCESS" : "FAILURE"));
}
function DidSucceed() {
return success;
}
</script>
</head>
<body onload="OnLoad();">
This page sends a synchronous XMLHttpRequest to fetch a local file, which
should not be allowed.
<div id="console"></div>
</body>
</html>
<html>
<head>
<title>Loading...</title>
</head>
<body onload="attachUnloadListener()">
<script>
function attachUnloadListener() {
window.addEventListener('unload', onUnload, false);
document.title = "sync xhr on unload";
}
var req = new XMLHttpRequest();
function onUnload() {
req.open('GET','download-test1.lib', false);
req.send(null);
}
</script>
<p>Navigate to another page to trigger synch xmlhttprequest</p>
</body>
</html>
......@@ -53,7 +53,7 @@ class ShutdownTest : public UIPerfTest {
ui_test_utils::GetTestFilePath(kCurrentDir,
FilePath(FILE_PATH_LITERAL("french_page.html"))),
ui_test_utils::GetTestFilePath(kCurrentDir,
FilePath(FILE_PATH_LITERAL("onunload_cookie.html"))),
FilePath(FILE_PATH_LITERAL("setcookie.html"))),
};
for (size_t i = 0; i < arraysize(test_cases); i++) {
......
......@@ -576,6 +576,7 @@
'browser/plugin_service_impl_browsertest.cc',
'browser/renderer_host/render_view_host_browsertest.cc',
'browser/renderer_host/render_view_host_manager_browsertest.cc',
'browser/renderer_host/resource_dispatcher_host_browsertest.cc',
'browser/session_history_browsertest.cc',
'browser/speech/speech_recognition_browsertest.cc',
'browser/webkit_browsertest.cc',
......
......@@ -24,6 +24,8 @@ namespace content {
ShellDownloadManagerDelegate::ShellDownloadManagerDelegate()
: download_manager_(NULL) {
// Balanced in Shutdown();
AddRef();
}
ShellDownloadManagerDelegate::~ShellDownloadManagerDelegate(){
......@@ -35,6 +37,10 @@ void ShellDownloadManagerDelegate::SetDownloadManager(
download_manager_ = download_manager;
}
void ShellDownloadManagerDelegate::Shutdown() {
Release();
}
bool ShellDownloadManagerDelegate::DetermineDownloadTarget(
DownloadItem* download,
const DownloadTargetCallback& callback) {
......
......@@ -21,6 +21,7 @@ class ShellDownloadManagerDelegate
void SetDownloadManager(DownloadManager* manager);
virtual void Shutdown() OVERRIDE;
virtual bool DetermineDownloadTarget(
DownloadItem* download,
const DownloadTargetCallback& callback) OVERRIDE;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment