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 5function debug(message) 6{ 7 document.getElementById('status').innerHTML += '<br/>' + message; 8} 9 10function 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 21function fail(message) 22{ 23 debug('FAILED: ' + message); 24 document.location.hash = '#fail'; 25} 26 27function getLog() 28{ 29 return '' + document.getElementById('status').innerHTML; 30} 31 32function fileErrorToString(e) 33{ 34 switch (e.code) { 35 case FileError.QUOTA_EXCEEDED_ERR: 36 return 'QUOTA_EXCEEDED_ERR'; 37 case FileError.NOT_FOUND_ERR: 38 return 'NOT_FOUND_ERR'; 39 case FileError.SECURITY_ERR: 40 return 'SECURITY_ERR'; 41 case FileError.INVALID_MODIFICATION_ERR: 42 return 'INVALID_MODIFICATION_ERR'; 43 case FileError.INVALID_STATE_ERR: 44 return 'INVALID_STATE_ERR'; 45 default: 46 return 'Unknown Error'; 47 } 48} 49 50function unexpectedErrorCallback(e) 51{ 52 fail('unexpectedErrorCallback:' + fileErrorToString(e)); 53} 54