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 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 } | 581 } |
582 downloads.onChanged.addListener(myListener); | 582 downloads.onChanged.addListener(myListener); |
583 downloads.download( | 583 downloads.download( |
584 {'url': SAFE_FAST_URL, 'filename': FILENAME}, | 584 {'url': SAFE_FAST_URL, 'filename': FILENAME}, |
585 chrome.test.callback(function(id) { | 585 chrome.test.callback(function(id) { |
586 console.debug(downloadId); | 586 console.debug(downloadId); |
587 chrome.test.assertEq(downloadId, id); | 587 chrome.test.assertEq(downloadId, id); |
588 })); | 588 })); |
589 }, | 589 }, |
590 | 590 |
| 591 // TODO(benjhayden): Update this test when downloading to sub-directories is |
| 592 // supported. |
| 593 function downloadFilenameDisallowSlashes() { |
| 594 downloads.download( |
| 595 {'url': SAFE_FAST_URL, 'filename': 'subdirectory/file.txt'}, |
| 596 chrome.test.callbackFail(downloads.ERROR_GENERIC)); |
| 597 }, |
| 598 |
591 function downloadOnCreated() { | 599 function downloadOnCreated() { |
592 // Test that the onCreated event fires when we start a download. | 600 // Test that the onCreated event fires when we start a download. |
593 var downloadId = getNextId(); | 601 var downloadId = getNextId(); |
594 console.debug(downloadId); | 602 console.debug(downloadId); |
595 var createdCompleted = chrome.test.callbackAdded(); | 603 var createdCompleted = chrome.test.callbackAdded(); |
596 function createdListener(item) { | 604 function createdListener(item) { |
597 console.debug(item.id); | 605 console.debug(item.id); |
598 if (item.id != downloadId) | 606 if (item.id != downloadId) |
599 return; | 607 return; |
600 console.debug(downloadId); | 608 console.debug(downloadId); |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
849 }, | 857 }, |
850 | 858 |
851 function callNotifyPass() { | 859 function callNotifyPass() { |
852 chrome.test.notifyPass(); | 860 chrome.test.notifyPass(); |
853 setTimeout(chrome.test.callback(function() { | 861 setTimeout(chrome.test.callback(function() { |
854 console.debug(''); | 862 console.debug(''); |
855 }), 0); | 863 }), 0); |
856 } | 864 } |
857 ]); | 865 ]); |
858 }); | 866 }); |
OLD | NEW |