| 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 244417171f8315e750a064b4f5428295e828f725..0fdada52de598af912d2e76faafd3effcf32f4eb 100644
|
| --- a/chrome/test/data/extensions/api_test/downloads/test.js
|
| +++ b/chrome/test/data/extensions/api_test/downloads/test.js
|
| @@ -14,12 +14,18 @@ function debugObject(obj) {
|
| }
|
| }
|
|
|
| -var downloads = chrome.experimental.downloads;
|
| window.requestFileSystem = (window.requestFileSystem ||
|
| window.webkitRequestFileSystem);
|
| window.BlobBuilder = (window.BlobBuilder ||
|
| window.WebKitBlobBuilder);
|
|
|
| +var downloads = chrome.downloads;
|
| +
|
| +// These strings may change. Do not rely on them in non-test extensions.
|
| +var ERROR_GENERIC = "I'm afraid I can't do that.";
|
| +var ERROR_INVALID_URL = 'Invalid URL.';
|
| +var ERROR_INVALID_OPERATION = 'Invalid operation.';
|
| +
|
| chrome.test.getConfig(function(testConfig) {
|
| function getURL(path) {
|
| return 'http://localhost:' + testConfig.testServer.port + '/' + path;
|
| @@ -85,7 +91,7 @@ chrome.test.getConfig(function(testConfig) {
|
| // function myListener(delta) {
|
| // if ((delta.id != downloadId) ||
|
| // !delta.filename ||
|
| - // (delta.filename.new.indexOf('/foo/slow') == -1))
|
| + // (delta.filename.current.indexOf('/foo/slow') == -1))
|
| // return;
|
| // downloads.onChanged.removeListener(myListener);
|
| // callbackCompleted();
|
| @@ -164,11 +170,11 @@ chrome.test.getConfig(function(testConfig) {
|
| console.debug(downloadId);
|
| var callbackCompleted = chrome.test.callbackAdded();
|
| function myListener(delta) {
|
| - console.debug(delta.id);
|
| + console.debug(JSON.stringify(delta));
|
| if ((delta.id != downloadId) ||
|
| !delta.state)
|
| return;
|
| - chrome.test.assertEq(downloads.STATE_COMPLETE, delta.state.new);
|
| + chrome.test.assertEq('complete', delta.state.current);
|
| console.debug(downloadId);
|
| downloads.onChanged.removeListener(myListener);
|
| callbackCompleted();
|
| @@ -196,8 +202,8 @@ chrome.test.getConfig(function(testConfig) {
|
| !delta.error)
|
| return;
|
| console.debug(downloadId);
|
| - chrome.test.assertEq(downloads.STATE_INTERRUPTED, delta.state.new);
|
| - chrome.test.assertEq(30, delta.error.new);
|
| + chrome.test.assertEq('interrupted', delta.state.current);
|
| + chrome.test.assertEq(30, delta.error.current);
|
| downloads.onChanged.removeListener(changedListener);
|
| if (changedCompleted) {
|
| changedCompleted();
|
| @@ -220,9 +226,10 @@ chrome.test.getConfig(function(testConfig) {
|
| console.debug(downloadId);
|
| downloads.onCreated.removeListener(createdListener);
|
| createdCompleted();
|
| - if (createdItem.state == downloads.STATE_INTERRUPTED) {
|
| - changedListener({id: downloadId, state: {new: createdItem.state},
|
| - error: {new: createdItem.error}});
|
| + if (createdItem.state == 'interrupted') {
|
| + changedListener({id: downloadId,
|
| + state: {current: createdItem.state},
|
| + error: {current: createdItem.error}});
|
| }
|
| }
|
| downloads.onCreated.addListener(createdListener);
|
| @@ -248,7 +255,7 @@ chrome.test.getConfig(function(testConfig) {
|
| if ((delta.id != downloadId) ||
|
| !delta.state)
|
| return;
|
| - chrome.test.assertEq(downloads.STATE_COMPLETE, delta.state.new);
|
| + chrome.test.assertEq('complete', delta.state.current);
|
| console.debug(downloadId);
|
| downloads.onChanged.removeListener(changedListener);
|
| changedCompleted();
|
| @@ -278,7 +285,7 @@ chrome.test.getConfig(function(testConfig) {
|
| if ((delta.id != downloadId) ||
|
| !delta.state)
|
| return;
|
| - chrome.test.assertEq(downloads.STATE_COMPLETE, delta.state.new);
|
| + chrome.test.assertEq('complete', delta.state.current);
|
| console.debug(downloadId);
|
| downloads.search({id: downloadId},
|
| chrome.test.callback(function(items) {
|
| @@ -323,8 +330,8 @@ chrome.test.getConfig(function(testConfig) {
|
| !delta.state ||
|
| !delta.error)
|
| return;
|
| - chrome.test.assertEq(downloads.STATE_INTERRUPTED, delta.state.new);
|
| - chrome.test.assertEq(33, delta.error.new);
|
| + chrome.test.assertEq('interrupted', delta.state.current);
|
| + chrome.test.assertEq(33, delta.error.current);
|
| console.debug(downloadId);
|
| downloads.onChanged.removeListener(changedListener);
|
| if (changedCompleted) {
|
| @@ -348,9 +355,10 @@ chrome.test.getConfig(function(testConfig) {
|
| console.debug(downloadId);
|
| downloads.onCreated.removeListener(createdListener);
|
| createdCompleted();
|
| - if (createdItem.state == downloads.STATE_INTERRUPTED) {
|
| - changedListener({id: downloadId, state: {new: createdItem.state},
|
| - error: {new: createdItem.error}});
|
| + if (createdItem.state == 'interrupted') {
|
| + changedListener({id: downloadId,
|
| + state: {current: createdItem.state},
|
| + error: {current: createdItem.error}});
|
| }
|
| }
|
| downloads.onCreated.addListener(createdListener);
|
| @@ -383,9 +391,9 @@ chrome.test.getConfig(function(testConfig) {
|
| !delta.state ||
|
| !delta.error)
|
| return;
|
| - chrome.test.assertEq(downloads.STATE_INTERRUPTED, delta.state.new);
|
| - chrome.test.assertEq(33, delta.error.new);
|
| - if (delta.error) console.debug(delta.error.new);
|
| + chrome.test.assertEq('interrupted', delta.state.current);
|
| + chrome.test.assertEq(33, delta.error.current);
|
| + if (delta.error) console.debug(delta.error.current);
|
| console.debug(downloadId);
|
| downloads.onChanged.removeListener(changedListener);
|
| if (changedCompleted) {
|
| @@ -409,9 +417,10 @@ chrome.test.getConfig(function(testConfig) {
|
| console.debug(downloadId);
|
| downloads.onCreated.removeListener(createdListener);
|
| createdCompleted();
|
| - if (createdItem.state == downloads.STATE_INTERRUPTED) {
|
| - changedListener({id: downloadId, state: {new: createdItem.state},
|
| - error: {new: createdItem.error}});
|
| + if (createdItem.state == 'interrupted') {
|
| + changedListener({id: downloadId,
|
| + state: {current: createdItem.state},
|
| + error: {current: createdItem.error}});
|
| }
|
| }
|
| downloads.onCreated.addListener(createdListener);
|
| @@ -438,7 +447,7 @@ chrome.test.getConfig(function(testConfig) {
|
| if ((delta.id != downloadId) ||
|
| !delta.state)
|
| return;
|
| - chrome.test.assertEq(downloads.STATE_COMPLETE, delta.state.new);
|
| + chrome.test.assertEq('complete', delta.state.current);
|
| console.debug(downloadId);
|
| downloads.search({id: downloadId},
|
| chrome.test.callback(function(items) {
|
| @@ -477,7 +486,7 @@ chrome.test.getConfig(function(testConfig) {
|
| if ((delta.id != downloadId) ||
|
| !delta.state)
|
| return;
|
| - chrome.test.assertEq(downloads.STATE_COMPLETE, delta.state.new);
|
| + chrome.test.assertEq('complete', delta.state.current);
|
| console.debug(downloadId);
|
| downloads.search({id: downloadId},
|
| chrome.test.callback(function(items) {
|
| @@ -522,8 +531,8 @@ chrome.test.getConfig(function(testConfig) {
|
| !delta.state ||
|
| !delta.error)
|
| return;
|
| - chrome.test.assertEq(downloads.STATE_INTERRUPTED, delta.state.new);
|
| - chrome.test.assertEq(33, delta.error.new);
|
| + chrome.test.assertEq('interrupted', delta.state.current);
|
| + chrome.test.assertEq(33, delta.error.current);
|
| console.debug(downloadId);
|
| downloads.onChanged.removeListener(changedListener);
|
| if (changedCompleted) {
|
| @@ -547,9 +556,10 @@ chrome.test.getConfig(function(testConfig) {
|
| console.debug(downloadId);
|
| downloads.onCreated.removeListener(createdListener);
|
| createdCompleted();
|
| - if (createdItem.state == downloads.STATE_INTERRUPTED) {
|
| - changedListener({id: downloadId, state: {new: createdItem.state},
|
| - error: {new: createdItem.error}});
|
| + if (createdItem.state == 'interrupted') {
|
| + changedListener({id: downloadId,
|
| + state: {current: createdItem.state},
|
| + error: {current: createdItem.error}});
|
| }
|
| }
|
| downloads.onCreated.addListener(createdListener);
|
| @@ -567,7 +577,7 @@ chrome.test.getConfig(function(testConfig) {
|
| downloads.download(
|
| {'url': SAFE_FAST_URL,
|
| 'headers': [{'name': 'Accept-chArsEt', 'value': 'evil'}]},
|
| - chrome.test.callbackFail(downloads.ERROR_GENERIC));
|
| + chrome.test.callbackFail(ERROR_GENERIC));
|
| },
|
|
|
| function downloadHeadersInvalid1() {
|
| @@ -575,7 +585,7 @@ chrome.test.getConfig(function(testConfig) {
|
| downloads.download(
|
| {'url': SAFE_FAST_URL,
|
| 'headers': [{'name': 'accept-eNcoding', 'value': 'evil'}]},
|
| - chrome.test.callbackFail(downloads.ERROR_GENERIC));
|
| + chrome.test.callbackFail(ERROR_GENERIC));
|
| },
|
|
|
| function downloadHeadersInvalid2() {
|
| @@ -583,7 +593,7 @@ chrome.test.getConfig(function(testConfig) {
|
| downloads.download(
|
| {'url': SAFE_FAST_URL,
|
| 'headers': [{'name': 'coNNection', 'value': 'evil'}]},
|
| - chrome.test.callbackFail(downloads.ERROR_GENERIC));
|
| + chrome.test.callbackFail(ERROR_GENERIC));
|
| },
|
|
|
| function downloadHeadersInvalid3() {
|
| @@ -591,7 +601,7 @@ chrome.test.getConfig(function(testConfig) {
|
| downloads.download(
|
| {'url': SAFE_FAST_URL,
|
| 'headers': [{'name': 'coNteNt-leNgth', 'value': 'evil'}]},
|
| - chrome.test.callbackFail(downloads.ERROR_GENERIC));
|
| + chrome.test.callbackFail(ERROR_GENERIC));
|
| },
|
|
|
| function downloadHeadersInvalid4() {
|
| @@ -599,7 +609,7 @@ chrome.test.getConfig(function(testConfig) {
|
| downloads.download(
|
| {'url': SAFE_FAST_URL,
|
| 'headers': [{'name': 'cooKIE', 'value': 'evil'}]},
|
| - chrome.test.callbackFail(downloads.ERROR_GENERIC));
|
| + chrome.test.callbackFail(ERROR_GENERIC));
|
| },
|
|
|
| function downloadHeadersInvalid5() {
|
| @@ -607,7 +617,7 @@ chrome.test.getConfig(function(testConfig) {
|
| downloads.download(
|
| {'url': SAFE_FAST_URL,
|
| 'headers': [{'name': 'cOOkie2', 'value': 'evil'}]},
|
| - chrome.test.callbackFail(downloads.ERROR_GENERIC));
|
| + chrome.test.callbackFail(ERROR_GENERIC));
|
| },
|
|
|
| function downloadHeadersInvalid6() {
|
| @@ -615,7 +625,7 @@ chrome.test.getConfig(function(testConfig) {
|
| downloads.download(
|
| {'url': SAFE_FAST_URL,
|
| 'headers': [{'name': 'coNteNt-traNsfer-eNcodiNg', 'value': 'evil'}]},
|
| - chrome.test.callbackFail(downloads.ERROR_GENERIC));
|
| + chrome.test.callbackFail(ERROR_GENERIC));
|
| },
|
|
|
| function downloadHeadersInvalid7() {
|
| @@ -623,7 +633,7 @@ chrome.test.getConfig(function(testConfig) {
|
| downloads.download(
|
| {'url': SAFE_FAST_URL,
|
| 'headers': [{'name': 'dAtE', 'value': 'evil'}]},
|
| - chrome.test.callbackFail(downloads.ERROR_GENERIC));
|
| + chrome.test.callbackFail(ERROR_GENERIC));
|
| },
|
|
|
| function downloadHeadersInvalid8() {
|
| @@ -631,7 +641,7 @@ chrome.test.getConfig(function(testConfig) {
|
| downloads.download(
|
| {'url': SAFE_FAST_URL,
|
| 'headers': [{'name': 'ExpEcT', 'value': 'evil'}]},
|
| - chrome.test.callbackFail(downloads.ERROR_GENERIC));
|
| + chrome.test.callbackFail(ERROR_GENERIC));
|
| },
|
|
|
| function downloadHeadersInvalid9() {
|
| @@ -639,7 +649,7 @@ chrome.test.getConfig(function(testConfig) {
|
| downloads.download(
|
| {'url': SAFE_FAST_URL,
|
| 'headers': [{'name': 'hOsT', 'value': 'evil'}]},
|
| - chrome.test.callbackFail(downloads.ERROR_GENERIC));
|
| + chrome.test.callbackFail(ERROR_GENERIC));
|
| },
|
|
|
| function downloadHeadersInvalid10() {
|
| @@ -647,7 +657,7 @@ chrome.test.getConfig(function(testConfig) {
|
| downloads.download(
|
| {'url': SAFE_FAST_URL,
|
| 'headers': [{'name': 'kEEp-aLivE', 'value': 'evil'}]},
|
| - chrome.test.callbackFail(downloads.ERROR_GENERIC));
|
| + chrome.test.callbackFail(ERROR_GENERIC));
|
| },
|
|
|
| function downloadHeadersInvalid11() {
|
| @@ -655,7 +665,7 @@ chrome.test.getConfig(function(testConfig) {
|
| downloads.download(
|
| {'url': SAFE_FAST_URL,
|
| 'headers': [{'name': 'rEfErEr', 'value': 'evil'}]},
|
| - chrome.test.callbackFail(downloads.ERROR_GENERIC));
|
| + chrome.test.callbackFail(ERROR_GENERIC));
|
| },
|
|
|
| function downloadHeadersInvalid12() {
|
| @@ -663,7 +673,7 @@ chrome.test.getConfig(function(testConfig) {
|
| downloads.download(
|
| {'url': SAFE_FAST_URL,
|
| 'headers': [{'name': 'tE', 'value': 'evil'}]},
|
| - chrome.test.callbackFail(downloads.ERROR_GENERIC));
|
| + chrome.test.callbackFail(ERROR_GENERIC));
|
| },
|
|
|
| function downloadHeadersInvalid13() {
|
| @@ -671,7 +681,7 @@ chrome.test.getConfig(function(testConfig) {
|
| downloads.download(
|
| {'url': SAFE_FAST_URL,
|
| 'headers': [{'name': 'trAilER', 'value': 'evil'}]},
|
| - chrome.test.callbackFail(downloads.ERROR_GENERIC));
|
| + chrome.test.callbackFail(ERROR_GENERIC));
|
| },
|
|
|
| function downloadHeadersInvalid14() {
|
| @@ -679,7 +689,7 @@ chrome.test.getConfig(function(testConfig) {
|
| downloads.download(
|
| {'url': SAFE_FAST_URL,
|
| 'headers': [{'name': 'trANsfer-eNcodiNg', 'value': 'evil'}]},
|
| - chrome.test.callbackFail(downloads.ERROR_GENERIC));
|
| + chrome.test.callbackFail(ERROR_GENERIC));
|
| },
|
|
|
| function downloadHeadersInvalid15() {
|
| @@ -687,7 +697,7 @@ chrome.test.getConfig(function(testConfig) {
|
| downloads.download(
|
| {'url': SAFE_FAST_URL,
|
| 'headers': [{'name': 'upGRAde', 'value': 'evil'}]},
|
| - chrome.test.callbackFail(downloads.ERROR_GENERIC));
|
| + chrome.test.callbackFail(ERROR_GENERIC));
|
| },
|
|
|
| function downloadHeadersInvalid16() {
|
| @@ -695,7 +705,7 @@ chrome.test.getConfig(function(testConfig) {
|
| downloads.download(
|
| {'url': SAFE_FAST_URL,
|
| 'headers': [{'name': 'usER-agENt', 'value': 'evil'}]},
|
| - chrome.test.callbackFail(downloads.ERROR_GENERIC));
|
| + chrome.test.callbackFail(ERROR_GENERIC));
|
| },
|
|
|
| function downloadHeadersInvalid17() {
|
| @@ -703,7 +713,7 @@ chrome.test.getConfig(function(testConfig) {
|
| downloads.download(
|
| {'url': SAFE_FAST_URL,
|
| 'headers': [{'name': 'viA', 'value': 'evil'}]},
|
| - chrome.test.callbackFail(downloads.ERROR_GENERIC));
|
| + chrome.test.callbackFail(ERROR_GENERIC));
|
| },
|
|
|
| function downloadHeadersInvalid18() {
|
| @@ -711,7 +721,7 @@ chrome.test.getConfig(function(testConfig) {
|
| downloads.download(
|
| {'url': SAFE_FAST_URL,
|
| 'headers': [{'name': 'pRoxY-', 'value': 'evil'}]},
|
| - chrome.test.callbackFail(downloads.ERROR_GENERIC));
|
| + chrome.test.callbackFail(ERROR_GENERIC));
|
| },
|
|
|
| function downloadHeadersInvalid19() {
|
| @@ -719,7 +729,7 @@ chrome.test.getConfig(function(testConfig) {
|
| downloads.download(
|
| {'url': SAFE_FAST_URL,
|
| 'headers': [{'name': 'sEc-', 'value': 'evil'}]},
|
| - chrome.test.callbackFail(downloads.ERROR_GENERIC));
|
| + chrome.test.callbackFail(ERROR_GENERIC));
|
| },
|
|
|
| function downloadHeadersInvalid20() {
|
| @@ -727,7 +737,7 @@ chrome.test.getConfig(function(testConfig) {
|
| downloads.download(
|
| {'url': SAFE_FAST_URL,
|
| 'headers': [{'name': 'pRoxY-probably-not-evil', 'value': 'evil'}]},
|
| - chrome.test.callbackFail(downloads.ERROR_GENERIC));
|
| + chrome.test.callbackFail(ERROR_GENERIC));
|
| },
|
|
|
| function downloadHeadersInvalid21() {
|
| @@ -735,7 +745,7 @@ chrome.test.getConfig(function(testConfig) {
|
| downloads.download(
|
| {'url': SAFE_FAST_URL,
|
| 'headers': [{'name': 'sEc-probably-not-evil', 'value': 'evil'}]},
|
| - chrome.test.callbackFail(downloads.ERROR_GENERIC));
|
| + chrome.test.callbackFail(ERROR_GENERIC));
|
| },
|
|
|
| function downloadHeadersInvalid22() {
|
| @@ -743,7 +753,7 @@ chrome.test.getConfig(function(testConfig) {
|
| downloads.download(
|
| {'url': SAFE_FAST_URL,
|
| 'headers': [{'name': 'oRiGiN', 'value': 'evil'}]},
|
| - chrome.test.callbackFail(downloads.ERROR_GENERIC));
|
| + chrome.test.callbackFail(ERROR_GENERIC));
|
| },
|
|
|
| function downloadHeadersInvalid23() {
|
| @@ -752,7 +762,7 @@ chrome.test.getConfig(function(testConfig) {
|
| {'url': SAFE_FAST_URL,
|
| 'headers': [{'name': 'Access-Control-Request-Headers',
|
| 'value': 'evil'}]},
|
| - chrome.test.callbackFail(downloads.ERROR_GENERIC));
|
| + chrome.test.callbackFail(ERROR_GENERIC));
|
| },
|
|
|
| function downloadHeadersInvalid24() {
|
| @@ -761,7 +771,7 @@ chrome.test.getConfig(function(testConfig) {
|
| {'url': SAFE_FAST_URL,
|
| 'headers': [{'name': 'Access-Control-Request-Method',
|
| 'value': 'evil'}]},
|
| - chrome.test.callbackFail(downloads.ERROR_GENERIC));
|
| + chrome.test.callbackFail(ERROR_GENERIC));
|
| },
|
|
|
| function downloadInterrupted() {
|
| @@ -800,8 +810,8 @@ chrome.test.getConfig(function(testConfig) {
|
| !delta.state ||
|
| !delta.error)
|
| return;
|
| - chrome.test.assertEq(downloads.STATE_INTERRUPTED, delta.state.new);
|
| - chrome.test.assertEq(40, delta.error.new);
|
| + chrome.test.assertEq('interrupted', delta.state.current);
|
| + chrome.test.assertEq(40, delta.error.current);
|
| console.debug(downloadId);
|
| downloads.onChanged.removeListener(changedListener);
|
| changedCompleted();
|
| @@ -827,7 +837,7 @@ chrome.test.getConfig(function(testConfig) {
|
| console.debug(delta.id);
|
| if ((delta.id != downloadId) ||
|
| !delta.filename ||
|
| - (delta.filename.new.indexOf(FILENAME) == -1))
|
| + (delta.filename.current.indexOf(FILENAME) == -1))
|
| return;
|
| console.debug(downloadId);
|
| downloads.onChanged.removeListener(myListener);
|
| @@ -847,7 +857,7 @@ chrome.test.getConfig(function(testConfig) {
|
| function downloadFilenameDisallowSlashes() {
|
| downloads.download(
|
| {'url': SAFE_FAST_URL, 'filename': 'subdirectory/file.txt'},
|
| - chrome.test.callbackFail(downloads.ERROR_GENERIC));
|
| + chrome.test.callbackFail(ERROR_GENERIC));
|
| },
|
|
|
| function downloadOnCreated() {
|
| @@ -876,7 +886,7 @@ chrome.test.getConfig(function(testConfig) {
|
| // Test that we disallow invalid filenames for new downloads.
|
| downloads.download(
|
| {'url': SAFE_FAST_URL, 'filename': '../../../../../etc/passwd'},
|
| - chrome.test.callbackFail(downloads.ERROR_GENERIC));
|
| + chrome.test.callbackFail(ERROR_GENERIC));
|
| },
|
|
|
| function downloadEmpty() {
|
| @@ -903,7 +913,7 @@ chrome.test.getConfig(function(testConfig) {
|
| // Test that download() requires a valid url.
|
| downloads.download(
|
| {'url': 'foo bar'},
|
| - chrome.test.callbackFail(downloads.ERROR_INVALID_URL));
|
| + chrome.test.callbackFail(ERROR_INVALID_URL));
|
| },
|
|
|
| function downloadInvalidURL1() {
|
| @@ -911,7 +921,7 @@ chrome.test.getConfig(function(testConfig) {
|
| // hostname.
|
| downloads.download(
|
| {'url': '../hello'},
|
| - chrome.test.callbackFail(downloads.ERROR_INVALID_URL));
|
| + chrome.test.callbackFail(ERROR_INVALID_URL));
|
| },
|
|
|
| function downloadInvalidURL2() {
|
| @@ -919,14 +929,14 @@ chrome.test.getConfig(function(testConfig) {
|
| // hostname.
|
| downloads.download(
|
| {'url': '/hello'},
|
| - chrome.test.callbackFail(downloads.ERROR_INVALID_URL));
|
| + chrome.test.callbackFail(ERROR_INVALID_URL));
|
| },
|
|
|
| function downloadInvalidURL3() {
|
| // Test that download() requires a valid url, including protocol.
|
| downloads.download(
|
| {'url': 'google.com/'},
|
| - chrome.test.callbackFail(downloads.ERROR_INVALID_URL));
|
| + chrome.test.callbackFail(ERROR_INVALID_URL));
|
| },
|
|
|
| function downloadInvalidURL4() {
|
| @@ -934,7 +944,7 @@ chrome.test.getConfig(function(testConfig) {
|
| // hostname.
|
| downloads.download(
|
| {'url': 'http://'},
|
| - chrome.test.callbackFail(downloads.ERROR_INVALID_URL));
|
| + chrome.test.callbackFail(ERROR_INVALID_URL));
|
| },
|
|
|
| function downloadInvalidURL5() {
|
| @@ -942,7 +952,7 @@ chrome.test.getConfig(function(testConfig) {
|
| // hostname.
|
| downloads.download(
|
| {'url': '#frag'},
|
| - chrome.test.callbackFail(downloads.ERROR_INVALID_URL));
|
| + chrome.test.callbackFail(ERROR_INVALID_URL));
|
| },
|
|
|
| function downloadInvalidURL6() {
|
| @@ -950,7 +960,7 @@ chrome.test.getConfig(function(testConfig) {
|
| // hostname.
|
| downloads.download(
|
| {'url': 'foo/bar.html#frag'},
|
| - chrome.test.callbackFail(downloads.ERROR_INVALID_URL));
|
| + chrome.test.callbackFail(ERROR_INVALID_URL));
|
| },
|
|
|
| function downloadAllowFragments() {
|
| @@ -988,14 +998,14 @@ chrome.test.getConfig(function(testConfig) {
|
| // Test that download() rejects javascript urls.
|
| downloads.download(
|
| {'url': 'javascript:document.write("hello");'},
|
| - chrome.test.callbackFail(downloads.ERROR_INVALID_URL));
|
| + chrome.test.callbackFail(ERROR_INVALID_URL));
|
| },
|
|
|
| function downloadInvalidURL8() {
|
| // Test that download() rejects javascript urls.
|
| downloads.download(
|
| {'url': 'javascript:return false;'},
|
| - chrome.test.callbackFail(downloads.ERROR_INVALID_URL));
|
| + chrome.test.callbackFail(ERROR_INVALID_URL));
|
| },
|
|
|
| function downloadInvalidURL9() {
|
| @@ -1003,7 +1013,7 @@ chrome.test.getConfig(function(testConfig) {
|
| // permissions check.
|
| downloads.download(
|
| {'url': 'ftp://example.com/example.txt'},
|
| - chrome.test.callbackFail(downloads.ERROR_INVALID_URL));
|
| + chrome.test.callbackFail(ERROR_INVALID_URL));
|
| },
|
|
|
| // TODO(benjhayden): Set up a test ftp server, add ftp://localhost* to
|
| @@ -1032,7 +1042,7 @@ chrome.test.getConfig(function(testConfig) {
|
| {'url': SAFE_FAST_URL,
|
| 'headers': [{ 'name': 'Cookie', 'value': 'fake'}]
|
| },
|
| - chrome.test.callbackFail(downloads.ERROR_GENERIC));
|
| + chrome.test.callbackFail(ERROR_GENERIC));
|
| },
|
|
|
| function downloadGetFileIconInvalidOptions() {
|
| @@ -1050,31 +1060,31 @@ chrome.test.getConfig(function(testConfig) {
|
|
|
| function downloadGetFileIconInvalidId() {
|
| downloads.getFileIcon(-42, {size: 32},
|
| - chrome.test.callbackFail(downloads.ERROR_INVALID_OPERATION));
|
| + chrome.test.callbackFail(ERROR_INVALID_OPERATION));
|
| },
|
|
|
| function downloadPauseInvalidId() {
|
| downloads.pause(-42, chrome.test.callbackFail(
|
| - downloads.ERROR_INVALID_OPERATION));
|
| + ERROR_INVALID_OPERATION));
|
| },
|
|
|
| function downloadPauseInvalidType() {
|
| - assertThrows(('Invocation of form experimental.downloads.pause(string,' +
|
| - ' function) doesn\'t match definition experimental.' +
|
| - 'downloads.pause(integer id, optional function callback)'),
|
| + assertThrows(('Invocation of form downloads.pause(string, function) ' +
|
| + 'doesn\'t match definition downloads.pause(integer ' +
|
| + 'downloadId, optional function NullCallback)'),
|
| downloads.pause,
|
| 'foo');
|
| },
|
|
|
| function downloadResumeInvalidId() {
|
| downloads.resume(-42, chrome.test.callbackFail(
|
| - downloads.ERROR_INVALID_OPERATION));
|
| + ERROR_INVALID_OPERATION));
|
| },
|
|
|
| function downloadResumeInvalidType() {
|
| - assertThrows(('Invocation of form experimental.downloads.resume(string,' +
|
| - ' function) doesn\'t match definition experimental.' +
|
| - 'downloads.resume(integer id, optional function callback)'),
|
| + assertThrows(('Invocation of form downloads.resume(string, function) ' +
|
| + 'doesn\'t match definition downloads.resume(integer ' +
|
| + 'downloadId, optional function NullCallback)'),
|
| downloads.resume,
|
| 'foo');
|
| },
|
| @@ -1087,9 +1097,9 @@ chrome.test.getConfig(function(testConfig) {
|
| },
|
|
|
| function downloadCancelInvalidType() {
|
| - assertThrows(('Invocation of form experimental.downloads.cancel(string,' +
|
| - ' function) doesn\'t match definition experimental.' +
|
| - 'downloads.cancel(integer id, optional function callback)'),
|
| + assertThrows(('Invocation of form downloads.cancel(string, function) ' +
|
| + 'doesn\'t match definition downloads.cancel(integer ' +
|
| + 'downloadId, optional function NullCallback)'),
|
| downloads.cancel, 'foo');
|
| },
|
|
|
|
|