| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 }); |
| OLD | NEW |