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

Side by Side Diff: chrome/browser/resources/downloads/item_view.js

Issue 1111593002: Fix incorrect assert() for interrupted/paused/in progress downloads. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed tests i'm running locally Created 5 years, 8 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
« no previous file with comments | « no previous file | chrome/browser/ui/webui/downloads_ui_browsertest.js » ('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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 cr.define('downloads', function() { 5 cr.define('downloads', function() {
6 /** @const */ var Item = downloads.Item; 6 /** @const */ var Item = downloads.Item;
7 7
8 /** 8 /**
9 * Creates and updates the DOM representation for a download. 9 * Creates and updates the DOM representation for a download.
10 * @constructor 10 * @constructor
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 339
340 /** 340 /**
341 * @param {!downloads.Data} data 341 * @param {!downloads.Data} data
342 * @return {string} User-visible status update text. 342 * @return {string} User-visible status update text.
343 * @private 343 * @private
344 */ 344 */
345 getStatusText_: function(data) { 345 getStatusText_: function(data) {
346 switch (data.state) { 346 switch (data.state) {
347 case Item.States.IN_PROGRESS: 347 case Item.States.IN_PROGRESS:
348 case Item.States.PAUSED: // Fallthrough. 348 case Item.States.PAUSED: // Fallthrough.
349 return assert(data.progress_status_text); 349 assert(typeof data.progress_status_text == 'string');
350 return data.progress_status_text;
350 case Item.States.CANCELLED: 351 case Item.States.CANCELLED:
351 return loadTimeData.getString('status_cancelled'); 352 return loadTimeData.getString('status_cancelled');
352 case Item.States.DANGEROUS: 353 case Item.States.DANGEROUS:
353 break; // Intentionally hit assertNotReached(); at bottom. 354 break; // Intentionally hit assertNotReached(); at bottom.
354 case Item.States.INTERRUPTED: 355 case Item.States.INTERRUPTED:
355 return assert(data.last_reason_text); 356 assert(typeof data.last_reason_text == 'string');
357 return data.last_reason_text;
356 case Item.States.COMPLETE: 358 case Item.States.COMPLETE:
357 return data.file_externally_removed ? 359 return data.file_externally_removed ?
358 loadTimeData.getString('status_removed') : ''; 360 loadTimeData.getString('status_removed') : '';
359 } 361 }
360 assertNotReached(); 362 assertNotReached();
361 return ''; 363 return '';
362 }, 364 },
363 365
364 /** 366 /**
365 * @private 367 * @private
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 }, 422 },
421 423
422 /** @private */ 424 /** @private */
423 onDiscardClick_: function() { 425 onDiscardClick_: function() {
424 chrome.send('discardDangerous', [this.id_]); 426 chrome.send('discardDangerous', [this.id_]);
425 }, 427 },
426 }; 428 };
427 429
428 return {ItemView: ItemView}; 430 return {ItemView: ItemView};
429 }); 431 });
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/webui/downloads_ui_browsertest.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698