Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 function debug(message) | |
| 6 { | |
| 7 document.getElementById('status').innerHTML += '<br/>' + message; | |
| 8 } | |
| 9 | |
| 10 function done(message) | |
| 11 { | |
| 12 if (document.location.hash == '#fail') | |
| 13 return; | |
| 14 if (message) | |
| 15 debug('PASS: ' + message); | |
| 16 else | |
| 17 debug('PASS'); | |
| 18 document.location.hash = '#pass'; | |
| 19 } | |
| 20 | |
| 21 function fail(message) | |
| 22 { | |
| 23 debug('FAILED: ' + message); | |
| 24 document.location.hash = '#fail'; | |
| 25 } | |
| 26 | |
| 27 function getLog() | |
| 28 { | |
| 29 return "" + document.getElementById('status').innerHTML; | |
|
kinuko
2011/08/30 12:12:04
"" -> '' for consistency?
is this '"" +' placed t
| |
| 30 } | |
| 31 | |
| 32 function fileErrorToString(e) { | |
| 33 switch (e.code) { | |
| 34 case FileError.QUOTA_EXCEEDED_ERR: | |
| 35 msg = 'QUOTA_EXCEEDED_ERR'; | |
|
kinuko
2011/08/30 12:12:04
looks like we can simply do this?
return 'QUOTA_E
| |
| 36 break; | |
| 37 case FileError.NOT_FOUND_ERR: | |
| 38 msg = 'NOT_FOUND_ERR'; | |
| 39 break; | |
| 40 case FileError.SECURITY_ERR: | |
| 41 msg = 'SECURITY_ERR'; | |
| 42 break; | |
| 43 case FileError.INVALID_MODIFICATION_ERR: | |
| 44 msg = 'INVALID_MODIFICATION_ERR'; | |
| 45 break; | |
| 46 case FileError.INVALID_STATE_ERR: | |
| 47 msg = 'INVALID_STATE_ERR'; | |
| 48 break; | |
| 49 default: | |
| 50 msg = 'Unknown Error'; | |
| 51 break; | |
| 52 }; | |
|
kinuko
2011/08/30 12:12:04
nit: semicolon is not needed here?
| |
| 53 return msg; | |
| 54 } | |
| 55 | |
| 56 function unexpectedErrorCallback(e) | |
| 57 { | |
| 58 fail('unexpectedErrorCallback:' + fileErrorToString(e)); | |
| 59 } | |
| OLD | NEW |