Index: chrome/test/data/extensions/api_test/downloads/test.js |
diff --git a/chrome/test/data/extensions/api_test/downloads/test.js b/chrome/test/data/extensions/api_test/downloads/test.js |
index 0a1368c87aaebfcd15db05b3747c253b60c14074..77ad82bf5b0064b536eca03ce9e35b72a427cf28 100644 |
--- a/chrome/test/data/extensions/api_test/downloads/test.js |
+++ b/chrome/test/data/extensions/api_test/downloads/test.js |
@@ -50,13 +50,33 @@ chrome.test.getConfig(function(testConfig) { |
chrome.test.runTests([ |
// TODO(benjhayden): Test onErased using remove(). |
Randy Smith (Not in Mondays)
2012/01/15 18:47:13
Why not as part of this CL, since it fires the OnE
benjhayden
2012/02/01 21:42:40
I need remove() in order to test onErased. I can't
Randy Smith (Not in Mondays)
2012/02/02 18:10:06
*snort* Right you are. Who knew? :-} (I.e. tha
|
+ function downloadOnChanged() { |
+ function myListener(delta) { |
+ if (delta.state && delta.state.new == 'complete') { |
+ chrome.experimental.downloads.onChanged.removeListener(myListener); |
+ chrome.test.succeed(); |
+ } |
+ } |
+ chrome.experimental.downloads.onChanged.addListener(myListener); |
+ chrome.experimental.downloads.download( |
+ {"url": getURL("slow?0")}, |
+ function(id) { |
+ chrome.test.assertEq(getNextId(), id); |
+ }); |
+ }, |
function downloadFilename() { |
+ function myListener(delta) { |
+ if (delta.filename && delta.filename.new.indexOf('/foo') !== -1) { |
+ chrome.experimental.downloads.onChanged.removeListener(myListener); |
+ chrome.test.succeed(); |
+ } |
+ } |
+ chrome.experimental.downloads.onChanged.addListener(myListener); |
downloads.download( |
{'url': SAFE_FAST_URL, 'filename': 'foo'}, |
- chrome.test.callbackPass(function(id) { |
+ function(id) { |
chrome.test.assertEq(getNextId(), id); |
- })); |
- // TODO(benjhayden): Test the filename using onChanged. |
+ }); |
}, |
function downloadOnCreated() { |
chrome.test.listenOnce(downloads.onCreated, |