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

Unified Diff: chrome/test/data/fileapi/common.js

Issue 7715024: Add browser_tests for FileAPI with Quota. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Reflected the comments. Created 9 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/test/data/fileapi/common.js
diff --git a/chrome/test/data/fileapi/common.js b/chrome/test/data/fileapi/common.js
new file mode 100644
index 0000000000000000000000000000000000000000..12d4a8c11c7891c1487b8837daa7eb578fe4a544
--- /dev/null
+++ b/chrome/test/data/fileapi/common.js
@@ -0,0 +1,59 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+function debug(message)
+{
+ document.getElementById('status').innerHTML += '<br/>' + message;
+}
+
+function done(message)
+{
+ if (document.location.hash == '#fail')
+ return;
+ if (message)
+ debug('PASS: ' + message);
+ else
+ debug('PASS');
+ document.location.hash = '#pass';
+}
+
+function fail(message)
+{
+ debug('FAILED: ' + message);
+ document.location.hash = '#fail';
+}
+
+function getLog()
+{
+ return "" + document.getElementById('status').innerHTML;
kinuko 2011/08/30 12:12:04 "" -> '' for consistency? is this '"" +' placed t
+}
+
+function fileErrorToString(e) {
+ switch (e.code) {
+ case FileError.QUOTA_EXCEEDED_ERR:
+ msg = 'QUOTA_EXCEEDED_ERR';
kinuko 2011/08/30 12:12:04 looks like we can simply do this? return 'QUOTA_E
+ break;
+ case FileError.NOT_FOUND_ERR:
+ msg = 'NOT_FOUND_ERR';
+ break;
+ case FileError.SECURITY_ERR:
+ msg = 'SECURITY_ERR';
+ break;
+ case FileError.INVALID_MODIFICATION_ERR:
+ msg = 'INVALID_MODIFICATION_ERR';
+ break;
+ case FileError.INVALID_STATE_ERR:
+ msg = 'INVALID_STATE_ERR';
+ break;
+ default:
+ msg = 'Unknown Error';
+ break;
+ };
kinuko 2011/08/30 12:12:04 nit: semicolon is not needed here?
+ return msg;
+}
+
+function unexpectedErrorCallback(e)
+{
+ fail('unexpectedErrorCallback:' + fileErrorToString(e));
+}

Powered by Google App Engine
This is Rietveld 408576698