| 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 // Comment this out to enable debugging. | 8 // Comment this out to enable debugging. |
| 9 console.debug = function() {}; | 9 console.debug = function() {}; |
| 10 | 10 |
| (...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 687 }, | 687 }, |
| 688 | 688 |
| 689 function downloadHeadersInvalid22() { | 689 function downloadHeadersInvalid22() { |
| 690 // Test that we disallow certain headers. | 690 // Test that we disallow certain headers. |
| 691 downloads.download( | 691 downloads.download( |
| 692 {'url': SAFE_FAST_URL, | 692 {'url': SAFE_FAST_URL, |
| 693 'headers': [{'name': 'oRiGiN', 'value': 'evil'}]}, | 693 'headers': [{'name': 'oRiGiN', 'value': 'evil'}]}, |
| 694 chrome.test.callbackFail(downloads.ERROR_GENERIC)); | 694 chrome.test.callbackFail(downloads.ERROR_GENERIC)); |
| 695 }, | 695 }, |
| 696 | 696 |
| 697 // TODO(benjhayden): Find why these aren't caught by | 697 function downloadHeadersInvalid23() { |
| 698 // net::HttpUtil::IsSafeHeader(). | 698 // Test that we disallow certain headers. |
| 699 // function downloadHeadersInvalid23() { | 699 downloads.download( |
| 700 // // Test that we disallow certain headers. | 700 {'url': SAFE_FAST_URL, |
| 701 // downloads.download( | 701 'headers': [{'name': 'Access-Control-Request-Headers', |
| 702 // {'url': SAFE_FAST_URL, | 702 'value': 'evil'}]}, |
| 703 // 'headers': [{'name': 'Access-Control-Request-Headers', | 703 chrome.test.callbackFail(downloads.ERROR_GENERIC)); |
| 704 // 'value': 'evil'}]}, | 704 }, |
| 705 // chrome.test.callbackFail(downloads.ERROR_GENERIC)); | |
| 706 // }, | |
| 707 | 705 |
| 708 // function downloadHeadersInvalid24() { | 706 function downloadHeadersInvalid24() { |
| 709 // // Test that we disallow certain headers. | 707 // Test that we disallow certain headers. |
| 710 // downloads.download( | 708 downloads.download( |
| 711 // {'url': SAFE_FAST_URL, | 709 {'url': SAFE_FAST_URL, |
| 712 // 'headers': [{'name': 'Access-Control-Request-Method', | 710 'headers': [{'name': 'Access-Control-Request-Method', |
| 713 // 'value': 'evil'}]}, | 711 'value': 'evil'}]}, |
| 714 // chrome.test.callbackFail(downloads.ERROR_GENERIC)); | 712 chrome.test.callbackFail(downloads.ERROR_GENERIC)); |
| 715 // }, | 713 }, |
| 716 | 714 |
| 717 function downloadInterrupted() { | 715 function downloadInterrupted() { |
| 718 // Test that cancel()ing an in-progress download causes its state to | 716 // Test that cancel()ing an in-progress download causes its state to |
| 719 // transition to interrupted, and test that that state transition is | 717 // transition to interrupted, and test that that state transition is |
| 720 // detectable by an onChanged event listener. | 718 // detectable by an onChanged event listener. |
| 721 // TODO(benjhayden): Test other sources of interruptions such as server | 719 // TODO(benjhayden): Test other sources of interruptions such as server |
| 722 // death. | 720 // death. |
| 723 var downloadId = getNextId(); | 721 var downloadId = getNextId(); |
| 724 console.debug(downloadId); | 722 console.debug(downloadId); |
| 725 | 723 |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1061 }, | 1059 }, |
| 1062 | 1060 |
| 1063 function callNotifyPass() { | 1061 function callNotifyPass() { |
| 1064 chrome.test.notifyPass(); | 1062 chrome.test.notifyPass(); |
| 1065 setTimeout(chrome.test.callback(function() { | 1063 setTimeout(chrome.test.callback(function() { |
| 1066 console.debug(''); | 1064 console.debug(''); |
| 1067 }), 0); | 1065 }), 0); |
| 1068 } | 1066 } |
| 1069 ]); | 1067 ]); |
| 1070 }); | 1068 }); |
| OLD | NEW |