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

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

Issue 7825035: Implement chrome.experimental.downloads.search() (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: rewrite Created 9 years, 1 month 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
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | content/browser/download/download_item.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 18 matching lines...) Expand all
29 chrome.test.succeed(); 29 chrome.test.succeed();
30 } 30 }
31 } 31 }
32 32
33 // The "/slow" handler waits a specified amount of time before returning a 33 // The "/slow" handler waits a specified amount of time before returning a
34 // safe file. Specify zero seconds to return quickly. 34 // safe file. Specify zero seconds to return quickly.
35 var SAFE_FAST_URL = getURL("slow?0"); 35 var SAFE_FAST_URL = getURL("slow?0");
36 36
37 chrome.test.runTests([ 37 chrome.test.runTests([
38 // TODO(benjhayden): Test onErased using remove(). 38 // TODO(benjhayden): Test onErased using remove().
39 TODO Enable and complete this test function after 8060042.
40 function downloadSearch() {
41 chrome.experimental.downloads.download(
42 {"url": getURL("slow?0"), "filename": "abc"},
43 function(id) {
44 chrome.test.assertEq(getNextId(), id);
45 });
46 chrome.experimental.downloads.download(
47 {"url": getURL("slow?0"), "filename": "a"},
48 function(id) {
49 chrome.test.assertEq(getNextId(), id);
50 });
51 chrome.experimental.downloads.download(
52 {"url": getURL("slow?0"), "filename": "b"},
53 function(id) {
54 chrome.test.assertEq(getNextId(), id);
55 });
56 chrome.experimental.downloads.download(
57 {"url": getURL("slow?0"), "filename": "c"},
58 function(id) {
59 chrome.test.assertEq(getNextId(), id);
60 });
61 chrome.experimental.downloads.search(
62 {},
63 function(results) {
64 chrome.test.assertEq(4, results.length);
65 // TODO
66 });
67 chrome.experimental.downloads.search(
68 {filename: "abc"},
69 function(results) {
70 chrome.test.assertEq(1, results.length);
71 // TODO
72 });
73 chrome.experimental.downloads.search(
74 {filename: "b"},
75 function(results) {
76 chrome.test.assertEq(2, results.length);
77 // TODO
78 });
79 },
39 function downloadFilename() { 80 function downloadFilename() {
40 chrome.experimental.downloads.download( 81 chrome.experimental.downloads.download(
41 {"url": SAFE_FAST_URL, "filename": "foo"}, 82 {"url": SAFE_FAST_URL, "filename": "foo"},
42 chrome.test.callbackPass(function(id) { 83 chrome.test.callbackPass(function(id) {
43 chrome.test.assertEq(getNextId(), id); 84 chrome.test.assertEq(getNextId(), id);
44 })); 85 }));
45 // TODO(benjhayden): Test the filename using onChanged. 86 // TODO(benjhayden): Test the filename using onChanged.
46 }, 87 },
47 function downloadOnCreated() { 88 function downloadOnCreated() {
48 chrome.test.listenOnce(chrome.experimental.downloads.onCreated, 89 chrome.test.listenOnce(chrome.experimental.downloads.onCreated,
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 }, 163 },
123 function downloadInvalidHeader() { 164 function downloadInvalidHeader() {
124 chrome.experimental.downloads.download( 165 chrome.experimental.downloads.download(
125 {"url": SAFE_FAST_URL, 166 {"url": SAFE_FAST_URL,
126 "headers": [{"name": "Cookie", "value": "fake"}]}, 167 "headers": [{"name": "Cookie", "value": "fake"}]},
127 chrome.test.callbackFail("I'm afraid I can't do that.")); 168 chrome.test.callbackFail("I'm afraid I can't do that."));
128 // TODO(benjhayden): Give a better error message. 169 // TODO(benjhayden): Give a better error message.
129 } 170 }
130 ]); 171 ]);
131 }); 172 });
OLDNEW
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | content/browser/download/download_item.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698