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

Side by Side Diff: chrome/test/data/extensions/api_test/downloads/test.js

Issue 9762002: Disable downloads from "file:" or "data:" URLs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed breaking tests. 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 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 // downloads api test 5 // downloads api test
6 // browser_tests.exe --gtest_filter=DownloadsApiTest.Downloads 6 // browser_tests.exe --gtest_filter=DownloadsApiTest.Downloads
7 7
8 // Uncomment this when the apitest is re-enabled. 8 // Uncomment this when the apitest is re-enabled.
9 // console.debug = function() {}; 9 // console.debug = function() {};
10 10
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after
695 // Valid URLs plus fragments are still valid URLs. 695 // Valid URLs plus fragments are still valid URLs.
696 var downloadId = getNextId(); 696 var downloadId = getNextId();
697 console.debug(downloadId); 697 console.debug(downloadId);
698 downloads.download( 698 downloads.download(
699 {'url': SAFE_FAST_URL + '#frag'}, 699 {'url': SAFE_FAST_URL + '#frag'},
700 chrome.test.callback(function(id) { 700 chrome.test.callback(function(id) {
701 chrome.test.assertEq(downloadId, id); 701 chrome.test.assertEq(downloadId, id);
702 })); 702 }));
703 }, 703 },
704 704
705 function downloadAllowDataURLs() { 705 function downloadDontAllowDataURLs() {
706 // Valid data URLs are valid URLs. 706 // We block downloading from data URLs.
707 var downloadId = getNextId();
708 console.debug(downloadId);
709 downloads.download( 707 downloads.download(
710 {'url': 'data:text/plain,hello'}, 708 {'url': 'data:text/plain,hello'},
711 chrome.test.callback(function(id) { 709 chrome.test.callbackFail("net::ERR_DISALLOWED_URL_SCHEME"));
712 chrome.test.assertEq(downloadId, id);
713 }));
714 }, 710 },
715 711
716 function downloadAllowFileURLs() { 712 function downloadDontAllowFileURLs() {
717 // Valid file URLs are valid URLs. 713 // We block downloading from file URLs.
718 var downloadId = getNextId();
719 console.debug(downloadId);
720 downloads.download( 714 downloads.download(
721 {'url': 'file:///'}, 715 {'url': 'file:///'},
722 chrome.test.callback(function(id) { 716 chrome.test.callbackFail("net::ERR_DISALLOWED_URL_SCHEME"));
723 chrome.test.assertEq(downloadId, id);
724 }));
725 }, 717 },
726 718
727 // TODO(benjhayden): Set up a test ftp server. 719 // TODO(benjhayden): Set up a test ftp server.
728 // function downloadAllowFTPURLs() { 720 // function downloadAllowFTPURLs() {
729 // // Valid ftp URLs are valid URLs. 721 // // Valid ftp URLs are valid URLs.
730 // var downloadId = getNextId(); 722 // var downloadId = getNextId();
731 // console.debug(downloadId); 723 // console.debug(downloadId);
732 // downloads.download( 724 // downloads.download(
733 // {'url': 'ftp://localhost:' + testConfig.testServer.port + '/'}, 725 // {'url': 'ftp://localhost:' + testConfig.testServer.port + '/'},
734 // chrome.test.callback(function(id) { 726 // chrome.test.callback(function(id) {
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
851 }, 843 },
852 844
853 function callNotifyPass() { 845 function callNotifyPass() {
854 chrome.test.notifyPass(); 846 chrome.test.notifyPass();
855 setTimeout(chrome.test.callback(function() { 847 setTimeout(chrome.test.callback(function() {
856 console.debug(''); 848 console.debug('');
857 }), 0); 849 }), 0);
858 } 850 }
859 ]); 851 ]);
860 }); 852 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698