| 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 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 702 })); | 702 })); |
| 703 }, | 703 }, |
| 704 | 704 |
| 705 function downloadDontAllowDataURLs() { | 705 function downloadDontAllowDataURLs() { |
| 706 // We block downloading from data URLs. | 706 // We block downloading from data URLs. |
| 707 downloads.download( | 707 downloads.download( |
| 708 {'url': 'data:text/plain,hello'}, | 708 {'url': 'data:text/plain,hello'}, |
| 709 chrome.test.callbackFail("net::ERR_DISALLOWED_URL_SCHEME")); | 709 chrome.test.callbackFail("net::ERR_DISALLOWED_URL_SCHEME")); |
| 710 }, | 710 }, |
| 711 | 711 |
| 712 function downloadDontAllowFileURLs() { | 712 function downloadAllowFileURLs() { |
| 713 // We block downloading from file URLs. | 713 // Valid file URLs are valid URLs. |
| 714 var downloadId = getNextId(); |
| 715 console.debug(downloadId); |
| 714 downloads.download( | 716 downloads.download( |
| 715 {'url': 'file:///'}, | 717 {'url': 'file:///'}, |
| 716 chrome.test.callbackFail("net::ERR_DISALLOWED_URL_SCHEME")); | 718 chrome.test.callback(function(id) { |
| 719 chrome.test.assertEq(downloadId, id); |
| 720 })); |
| 717 }, | 721 }, |
| 718 | 722 |
| 719 // TODO(benjhayden): Set up a test ftp server. | 723 // TODO(benjhayden): Set up a test ftp server. |
| 720 // function downloadAllowFTPURLs() { | 724 // function downloadAllowFTPURLs() { |
| 721 // // Valid ftp URLs are valid URLs. | 725 // // Valid ftp URLs are valid URLs. |
| 722 // var downloadId = getNextId(); | 726 // var downloadId = getNextId(); |
| 723 // console.debug(downloadId); | 727 // console.debug(downloadId); |
| 724 // downloads.download( | 728 // downloads.download( |
| 725 // {'url': 'ftp://localhost:' + testConfig.testServer.port + '/'}, | 729 // {'url': 'ftp://localhost:' + testConfig.testServer.port + '/'}, |
| 726 // chrome.test.callback(function(id) { | 730 // chrome.test.callback(function(id) { |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 843 }, | 847 }, |
| 844 | 848 |
| 845 function callNotifyPass() { | 849 function callNotifyPass() { |
| 846 chrome.test.notifyPass(); | 850 chrome.test.notifyPass(); |
| 847 setTimeout(chrome.test.callback(function() { | 851 setTimeout(chrome.test.callback(function() { |
| 848 console.debug(''); | 852 console.debug(''); |
| 849 }), 0); | 853 }), 0); |
| 850 } | 854 } |
| 851 ]); | 855 ]); |
| 852 }); | 856 }); |
| OLD | NEW |