Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(87)

Side by Side Diff: chrome/test/data/extensions/api_test/downloads/test.js

Issue 8203005: Implement chrome.experimental.downloads.onChanged (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: on_changed_stats_,OnChangedStat Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 chrome.test.getConfig(function(testConfig) { 8 chrome.test.getConfig(function(testConfig) {
9 function getURL(path) { 9 function getURL(path) {
10 return "http://localhost:" + testConfig.testServer.port + "/" + path; 10 return "http://localhost:" + testConfig.testServer.port + "/" + path;
(...skipping 12 matching lines...) Expand all
23 chrome.test.fail("Failed to throw exception (" + 23 chrome.test.fail("Failed to throw exception (" +
24 expected_message + ")"); 24 expected_message + ")");
25 }); 25 });
26 } catch (exception) { 26 } catch (exception) {
27 chrome.test.assertEq(expected_message, exception.message); 27 chrome.test.assertEq(expected_message, exception.message);
28 chrome.test.succeed(); 28 chrome.test.succeed();
29 } 29 }
30 } 30 }
31 31
32 chrome.test.runTests([ 32 chrome.test.runTests([
33 // TODO(benjhayden): Uncomment after 8060042.
34 // function downloadOnChanged() {
35 // function myListener(delta) {
36 // if (delta.state && delta.state.new == 'complete') {
37 // chrome.experimental.downloads.onChanged.removeListener(myListener);
38 // chrome.test.succeed();
39 // }
40 // }
41 // chrome.experimental.downloads.onChanged.addListener(myListener);
42 // chrome.experimental.downloads.download(
43 // {"url": getURL("slow?0")},
44 // function(id) {
45 // chrome.test.assertEq(getNextId(), id);
46 // });
47 // },
33 function downloadFilename() { 48 function downloadFilename() {
34 chrome.experimental.downloads.download( 49 chrome.experimental.downloads.download(
35 {"url": getURL("pass"), "filename": "pass"}, 50 {"url": getURL("pass"), "filename": "pass"},
36 chrome.test.callbackPass(function(id) { 51 chrome.test.callbackPass(function(id) {
37 chrome.test.assertEq(getNextId(), id); 52 chrome.test.assertEq(getNextId(), id);
38 })); 53 }));
39 // TODO(benjhayden): Test the filename using onChanged. 54 // TODO(benjhayden): Test the filename using onChanged.
40 }, 55 },
41 function downloadSubDirectoryFilename() { 56 function downloadSubDirectoryFilename() {
42 chrome.experimental.downloads.download( 57 chrome.experimental.downloads.download(
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 }, 121 },
107 function downloadInvalidHeader() { 122 function downloadInvalidHeader() {
108 chrome.experimental.downloads.download( 123 chrome.experimental.downloads.download(
109 {"url": getURL("pass"), 124 {"url": getURL("pass"),
110 "headers": [{"name": "Cookie", "value": "fake"}]}, 125 "headers": [{"name": "Cookie", "value": "fake"}]},
111 chrome.test.callbackFail("I'm afraid I can't do that.")); 126 chrome.test.callbackFail("I'm afraid I can't do that."));
112 // TODO(benjhayden): Give a better error message. 127 // TODO(benjhayden): Give a better error message.
113 } 128 }
114 ]); 129 ]);
115 }); 130 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698