You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by st...@apache.org on 2013/05/14 23:12:41 UTC

[02/38] [BlackBerry10] Split out to new top-level platform

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/615aea47/lib/blackberry10/plugin/blackberry10/file.js
----------------------------------------------------------------------
diff --git a/lib/blackberry10/plugin/blackberry10/file.js b/lib/blackberry10/plugin/blackberry10/file.js
new file mode 100644
index 0000000..d611daf
--- /dev/null
+++ b/lib/blackberry10/plugin/blackberry10/file.js
@@ -0,0 +1,424 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+/*global WebKitBlobBuilder:false */
+/*global Blob:false */
+var cordova = require('cordova'),
+    FileError = require('cordova/plugin/FileError'),
+    DirectoryEntry = require('cordova/plugin/DirectoryEntry'),
+    FileEntry = require('cordova/plugin/FileEntry'),
+    File = require('cordova/plugin/File'),
+    FileSystem = require('cordova/plugin/FileSystem'),
+    FileReader = require('cordova/plugin/FileReader'),
+    nativeRequestFileSystem = window.webkitRequestFileSystem,
+    nativeResolveLocalFileSystemURI = function(uri, success, fail) {
+        if (uri.substring(0,11) !== "filesystem:") {
+            uri = "filesystem:" + uri;
+        }
+        window.webkitResolveLocalFileSystemURL(uri, success, fail);
+    },
+    NativeFileReader = window.FileReader;
+
+window.FileReader = FileReader;
+window.File = File;
+
+function getFileSystemName(nativeFs) {
+    return (nativeFs.name.indexOf("Persistent") != -1) ? "persistent" : "temporary";
+}
+
+function makeEntry(entry) {
+    if (entry.isDirectory) {
+        return new DirectoryEntry(entry.name, decodeURI(entry.toURL()).substring(11));
+    }
+    else {
+        return new FileEntry(entry.name, decodeURI(entry.toURL()).substring(11));
+    }
+}
+
+module.exports = {
+    /* requestFileSystem */
+    requestFileSystem: function(args, successCallback, errorCallback) {
+        var type = args[0],
+            size = args[1];
+
+        nativeRequestFileSystem(type, size, function(nativeFs) {
+            successCallback(new FileSystem(getFileSystemName(nativeFs), makeEntry(nativeFs.root)));
+        }, function(error) {
+            errorCallback(error.code);
+        });
+        return { "status" : cordova.callbackStatus.NO_RESULT, "message" : "async"};
+    },
+
+    /* resolveLocalFileSystemURI */
+    resolveLocalFileSystemURI: function(args, successCallback, errorCallback) {
+        var uri = args[0];
+
+        nativeResolveLocalFileSystemURI(uri, function(entry) {
+            successCallback(makeEntry(entry));
+        }, function(error) {
+            var code = error.code;
+            switch (code) {
+                case 5:
+                    code = FileError.NOT_FOUND_ERR;
+                    break;
+
+                case 2:
+                    code = FileError.ENCODING_ERR;
+                    break;
+            }
+            errorCallback(code);
+        });
+        return { "status" : cordova.callbackStatus.NO_RESULT, "message" : "async"};
+    },
+
+    /* DirectoryReader */
+    readEntries: function(args, successCallback, errorCallback) {
+        var uri = args[0];
+
+        nativeResolveLocalFileSystemURI(uri, function(dirEntry) {
+            var reader = dirEntry.createReader();
+            reader.readEntries(function(entries) {
+                var retVal = [];
+                for (var i = 0; i < entries.length; i++) {
+                    retVal.push(makeEntry(entries[i]));
+                }
+                successCallback(retVal);
+            }, function(error) {
+                errorCallback(error.code);
+            });
+        }, function(error) {
+            errorCallback(error.code);
+        });
+        return { "status" : cordova.callbackStatus.NO_RESULT, "message" : "async"};
+    },
+
+    /* Entry */
+    getMetadata: function(args, successCallback, errorCallback) {
+        var uri = args[0];
+
+        nativeResolveLocalFileSystemURI(uri, function(entry) {
+            entry.getMetadata(function(metaData) {
+                successCallback(metaData.modificationTime);
+            }, function(error) {
+                errorCallback(error.code);
+            });
+        }, function(error) {
+            errorCallback(error.code);
+        });
+        return { "status" : cordova.callbackStatus.NO_RESULT, "message" : "async"};
+    },
+
+    moveTo: function(args, successCallback, errorCallback) {
+        var srcUri = args[0],
+            parentUri = args[1],
+            name = args[2];
+
+        nativeResolveLocalFileSystemURI(srcUri, function(source) {
+            nativeResolveLocalFileSystemURI(parentUri, function(parent) {
+                source.moveTo(parent, name, function(entry) {
+                    successCallback(makeEntry(entry));
+                }, function(error) {
+                    errorCallback(error.code);
+                });
+            }, function(error) {
+                errorCallback(error.code);
+            });
+        }, function(error) {
+            errorCallback(error.code);
+        });
+        return { "status" : cordova.callbackStatus.NO_RESULT, "message" : "async"};
+    },
+
+    copyTo: function(args, successCallback, errorCallback) {
+        var srcUri = args[0],
+            parentUri = args[1],
+            name = args[2];
+
+        nativeResolveLocalFileSystemURI(srcUri, function(source) {
+            nativeResolveLocalFileSystemURI(parentUri, function(parent) {
+                source.copyTo(parent, name, function(entry) {
+                    successCallback(makeEntry(entry));
+                }, function(error) {
+                    errorCallback(error.code);
+                });
+            }, function(error) {
+                errorCallback(error.code);
+            });
+        }, function(error) {
+            errorCallback(error.code);
+        });
+        return { "status" : cordova.callbackStatus.NO_RESULT, "message" : "async"};
+    },
+
+    remove: function(args, successCallback, errorCallback) {
+        var uri = args[0];
+
+        nativeResolveLocalFileSystemURI(uri, function(entry) {
+            if (entry.fullPath === "/") {
+                errorCallback(FileError.NO_MODIFICATION_ALLOWED_ERR);
+            } else {
+                entry.remove(
+                    function (success) {
+                        if (successCallback) {
+                            successCallback(success);
+                        }
+                    },
+                    function(error) {
+                        if (errorCallback) {
+                            errorCallback(error.code);
+                        }
+                    }
+                );
+            }
+        }, function(error) {
+            errorCallback(error.code);
+        });
+        return { "status" : cordova.callbackStatus.NO_RESULT, "message" : "async"};
+    },
+
+    getParent: function(args, successCallback, errorCallback) {
+        var uri = args[0];
+
+        nativeResolveLocalFileSystemURI(uri, function(entry) {
+            entry.getParent(function(entry) {
+                successCallback(makeEntry(entry));
+            }, function(error) {
+                errorCallback(error.code);
+            });
+        }, function(error) {
+            errorCallback(error.code);
+        });
+        return { "status" : cordova.callbackStatus.NO_RESULT, "message" : "async"};
+    },
+
+    /* FileEntry */
+    getFileMetadata: function(args, successCallback, errorCallback) {
+        var uri = args[0];
+
+        nativeResolveLocalFileSystemURI(uri, function(entry) {
+            entry.file(function(file) {
+                var retVal = new File(file.name, decodeURI(entry.toURL()), file.type, file.lastModifiedDate, file.size);
+                successCallback(retVal);
+            }, function(error) {
+                errorCallback(error.code);
+            });
+        }, function(error) {
+            errorCallback(error.code);
+        });
+        return { "status" : cordova.callbackStatus.NO_RESULT, "message" : "async"};
+    },
+
+    /* DirectoryEntry */
+    getDirectory: function(args, successCallback, errorCallback) {
+        var uri = args[0],
+            path = args[1],
+            options = args[2];
+
+        nativeResolveLocalFileSystemURI(uri, function(entry) {
+            entry.getDirectory(path, options, function(entry) {
+                successCallback(makeEntry(entry));
+            }, function(error) {
+                if (error.code === FileError.INVALID_MODIFICATION_ERR) {
+                    if (options.create) {
+                        errorCallback(FileError.PATH_EXISTS_ERR);
+                    } else {
+                        errorCallback(FileError.ENCODING_ERR);
+                    }
+                } else {
+                    errorCallback(error.code);
+                }
+            });
+        }, function(error) {
+            errorCallback(error.code);
+        });
+        return { "status" : cordova.callbackStatus.NO_RESULT, "message" : "async"};
+    },
+
+    removeRecursively: function(args, successCallback, errorCallback) {
+        var uri = args[0];
+
+        nativeResolveLocalFileSystemURI(uri, function(entry) {
+            if (entry.fullPath === "/") {
+                errorCallback(FileError.NO_MODIFICATION_ALLOWED_ERR);
+            } else {
+                entry.removeRecursively(
+                    function (success) {
+                        if (successCallback) {
+                            successCallback(success);
+                        }
+                    },
+                    function(error) {
+                        errorCallback(error.code);
+                    }
+                );
+            }
+        }, function(error) {
+            errorCallback(error.code);
+        });
+        return { "status" : cordova.callbackStatus.NO_RESULT, "message" : "async"};
+    },
+
+    getFile: function(args, successCallback, errorCallback) {
+        var uri = args[0],
+            path = args[1],
+            options = args[2];
+
+        nativeResolveLocalFileSystemURI(uri, function(entry) {
+            entry.getFile(path, options, function(entry) {
+                successCallback(makeEntry(entry));
+            }, function(error) {
+                if (error.code === FileError.INVALID_MODIFICATION_ERR) {
+                    if (options.create) {
+                        errorCallback(FileError.PATH_EXISTS_ERR);
+                    } else {
+                        errorCallback(FileError.NOT_FOUND_ERR);
+                    }
+                } else {
+                    errorCallback(error.code);
+                }
+            });
+        }, function(error) {
+            errorCallback(error.code);
+        });
+        return { "status" : cordova.callbackStatus.NO_RESULT, "message" : "async"};
+    },
+
+    /* FileReader */
+    readAsText: function(args, successCallback, errorCallback) {
+        var uri = args[0],
+            encoding = args[1];
+
+        nativeResolveLocalFileSystemURI(uri, function(entry) {
+            var onLoadEnd = function(evt) {
+                    if (!evt.target.error) {
+                        successCallback(evt.target.result);
+                    }
+            },
+                onError = function(evt) {
+                    errorCallback(evt.target.error.code);
+            };
+
+            var reader = new NativeFileReader();
+
+            reader.onloadend = onLoadEnd;
+            reader.onerror = onError;
+            entry.file(function(file) {
+                reader.readAsText(file, encoding);
+            }, function(error) {
+                errorCallback(error.code);
+            });
+        }, function(error) {
+            errorCallback(error.code);
+        });
+        return { "status" : cordova.callbackStatus.NO_RESULT, "message" : "async"};
+    },
+
+    readAsDataURL: function(args, successCallback, errorCallback) {
+        var uri = args[0];
+
+        nativeResolveLocalFileSystemURI(uri, function(entry) {
+            var onLoadEnd = function(evt) {
+                    if (!evt.target.error) {
+                        successCallback(evt.target.result);
+                    }
+            },
+                onError = function(evt) {
+                    errorCallback(evt.target.error.code);
+            };
+
+            var reader = new NativeFileReader();
+
+            reader.onloadend = onLoadEnd;
+            reader.onerror = onError;
+            entry.file(function(file) {
+                reader.readAsDataURL(file);
+            }, function(error) {
+                errorCallback(error.code);
+            });
+        }, function(error) {
+            errorCallback(error.code);
+        });
+        return { "status" : cordova.callbackStatus.NO_RESULT, "message" : "async"};
+    },
+
+    /* FileWriter */
+    write: function(args, successCallback, errorCallback) {
+        var uri = args[0],
+            text = args[1],
+            position = args[2];
+
+        nativeResolveLocalFileSystemURI(uri, function(entry) {
+            var onWriteEnd = function(evt) {
+                    if(!evt.target.error) {
+                        successCallback(evt.target.position - position);
+                    } else {
+                        errorCallback(evt.target.error.code);
+                    }
+            },
+                onError = function(evt) {
+                    errorCallback(evt.target.error.code);
+            };
+
+            entry.createWriter(function(writer) {
+                writer.onwriteend = onWriteEnd;
+                writer.onerror = onError;
+
+                writer.seek(position);
+                writer.write(new Blob([text], {type: "text/plain"}));
+            }, function(error) {
+                errorCallback(error.code);
+            });
+        }, function(error) {
+            errorCallback(error.code);
+        });
+        return { "status" : cordova.callbackStatus.NO_RESULT, "message" : "async"};
+    },
+
+    truncate: function(args, successCallback, errorCallback) {
+        var uri = args[0],
+            size = args[1];
+
+        nativeResolveLocalFileSystemURI(uri, function(entry) {
+            var onWriteEnd = function(evt) {
+                    if(!evt.target.error) {
+                        successCallback(evt.target.length);
+                    } else {
+                        errorCallback(evt.target.error.code);
+                    }
+            },
+                onError = function(evt) {
+                    errorCallback(evt.target.error.code);
+            };
+
+            entry.createWriter(function(writer) {
+                writer.onwriteend = onWriteEnd;
+                writer.onerror = onError;
+
+                writer.truncate(size);
+            }, function(error) {
+                errorCallback(error.code);
+            });
+        }, function(error) {
+            errorCallback(error.code);
+        });
+        return { "status" : cordova.callbackStatus.NO_RESULT, "message" : "async"};
+    }
+};

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/615aea47/lib/blackberry10/plugin/blackberry10/fileTransfer.js
----------------------------------------------------------------------
diff --git a/lib/blackberry10/plugin/blackberry10/fileTransfer.js b/lib/blackberry10/plugin/blackberry10/fileTransfer.js
new file mode 100644
index 0000000..6848516
--- /dev/null
+++ b/lib/blackberry10/plugin/blackberry10/fileTransfer.js
@@ -0,0 +1,205 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+/*global Blob:false */
+var cordova = require('cordova'),
+    FileEntry = require('cordova/plugin/FileEntry'),
+    FileTransferError = require('cordova/plugin/FileTransferError'),
+    FileUploadResult = require('cordova/plugin/FileUploadResult'),
+    ProgressEvent = require('cordova/plugin/ProgressEvent'),
+    nativeResolveLocalFileSystemURI = function(uri, success, fail) {
+        if (uri.substring(0,11) !== "filesystem:") {
+            uri = "filesystem:" + uri;
+        }
+        window.webkitResolveLocalFileSystemURL(uri, success, fail);
+    },
+    xhr;
+
+function getParentPath(filePath) {
+    var pos = filePath.lastIndexOf('/');
+    return filePath.substring(0, pos + 1);
+}
+
+function getFileName(filePath) {
+    var pos = filePath.lastIndexOf('/');
+    return filePath.substring(pos + 1);
+}
+
+function cleanUpPath(filePath) {
+    var pos = filePath.lastIndexOf('/');
+    return filePath.substring(0, pos) + filePath.substring(pos + 1, filePath.length);
+}
+
+function checkURL(url) {
+    return url.indexOf(' ') === -1 ?  true : false;
+}
+
+module.exports = {
+    abort: function () {
+        return { "status" : cordova.callbackStatus.NO_RESULT, "message" : "async"};
+    },
+
+    upload: function(args, win, fail) {
+        var filePath = args[0],
+            server = args[1],
+            fileKey = args[2],
+            fileName = args[3],
+            mimeType = args[4],
+            params = args[5],
+            /*trustAllHosts = args[6],*/
+            chunkedMode = args[7],
+            headers = args[8];
+
+        if (!checkURL(server)) {
+            fail(new FileTransferError(FileTransferError.INVALID_URL_ERR));
+        }
+
+        nativeResolveLocalFileSystemURI(filePath, function(entry) {
+            entry.file(function(file) {
+                function uploadFile(blobFile) {
+                    var fd = new FormData();
+
+                    fd.append(fileKey, blobFile, fileName);
+                    for (var prop in params) {
+                        if(params.hasOwnProperty(prop)) {
+                            fd.append(prop, params[prop]);
+                        }
+                    }
+
+                    xhr = new XMLHttpRequest();
+                    xhr.open("POST", server);
+                    xhr.onload = function(evt) {
+                        if (xhr.status == 200) {
+                            var result = new FileUploadResult();
+                            result.bytesSent = file.size;
+                            result.responseCode = xhr.status;
+                            result.response = xhr.response;
+                            win(result);
+                        } else if (xhr.status == 404) {
+                            fail(new FileTransferError(FileTransferError.INVALID_URL_ERR, server, filePath, xhr.status));
+                        } else {
+                            fail(new FileTransferError(FileTransferError.CONNECTION_ERR, server, filePath, xhr.status));
+                        }
+                    };
+                    xhr.ontimeout = function(evt) {
+                        fail(new FileTransferError(FileTransferError.CONNECTION_ERR, server, filePath, xhr.status));
+                    };
+                    xhr.onerror = function () {
+                        fail(new FileTransferError(FileTransferError.CONNECTION_ERR, server, filePath, this.status));
+                    };
+                    xhr.onprogress = function (evt) {
+                        win(evt);
+                    };
+
+                    for (var header in headers) {
+                        if (headers.hasOwnProperty(header)) {
+                            xhr.setRequestHeader(header, headers[header]);
+                        }
+                    }
+
+                    xhr.send(fd);
+                }
+
+                var bytesPerChunk;
+                if (chunkedMode === true) {
+                    bytesPerChunk = 1024 * 1024; // 1MB chunk sizes.
+                } else {
+                    bytesPerChunk = file.size;
+                }
+                var start = 0;
+                var end = bytesPerChunk;
+                while (start < file.size) {
+                    var chunk = file.slice(start, end, mimeType);
+                    uploadFile(chunk);
+                    start = end;
+                    end = start + bytesPerChunk;
+                }
+            }, function(error) {
+                fail(new FileTransferError(FileTransferError.FILE_NOT_FOUND_ERR));
+            });
+        }, function(error) {
+            fail(new FileTransferError(FileTransferError.FILE_NOT_FOUND_ERR));
+        });
+
+        return { "status" : cordova.callbackStatus.NO_RESULT, "message" : "async"};
+    },
+
+    download: function (args, win, fail) {
+        var source = args[0],
+            target = cleanUpPath(args[1]),
+            fileWriter;
+
+        if (!checkURL(source)) {
+            fail(new FileTransferError(FileTransferError.INVALID_URL_ERR));
+        }
+
+        xhr = new XMLHttpRequest();
+
+        function writeFile(entry) {
+            entry.createWriter(function (writer) {
+                fileWriter = writer;
+                fileWriter.onwriteend = function (evt) {
+                    if (!evt.target.error) {
+                        win(new FileEntry(entry.name, entry.toURL()));
+                    } else {
+                        fail(evt.target.error);
+                    }
+                };
+                fileWriter.onerror = function (evt) {
+                    fail(evt.target.error);
+                };
+                fileWriter.write(new Blob([xhr.response]));
+            }, function (error) {
+                fail(error);
+            });
+        }
+
+        xhr.onerror = function (e) {
+            fail(new FileTransferError(FileTransferError.CONNECTION_ERR, source, target, xhr.status));
+        };
+
+        xhr.onload = function () {
+            if (xhr.readyState === xhr.DONE) {
+                if (xhr.status === 200 && xhr.response) {
+                    nativeResolveLocalFileSystemURI(getParentPath(target), function (dir) {
+                        dir.getFile(getFileName(target), {create: true}, writeFile, function (error) {
+                            fail(new FileTransferError(FileTransferError.FILE_NOT_FOUND_ERR));
+                        });
+                    }, function (error) {
+                        fail(new FileTransferError(FileTransferError.FILE_NOT_FOUND_ERR));
+                    });
+                } else if (xhr.status === 404) {
+                    fail(new FileTransferError(FileTransferError.INVALID_URL_ERR, source, target, xhr.status));
+                } else {
+                    fail(new FileTransferError(FileTransferError.CONNECTION_ERR, source, target, xhr.status));
+                }
+            }
+        };
+        xhr.onprogress = function (evt) {
+            win(evt);
+        };
+
+        xhr.responseType = "blob";
+        xhr.open("GET", source, true);
+        xhr.send();
+        return { "status" : cordova.callbackStatus.NO_RESULT, "message" : "async"};
+    }
+};

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/615aea47/lib/blackberry10/plugin/blackberry10/logger.js
----------------------------------------------------------------------
diff --git a/lib/blackberry10/plugin/blackberry10/logger.js b/lib/blackberry10/plugin/blackberry10/logger.js
new file mode 100644
index 0000000..bd47a1e
--- /dev/null
+++ b/lib/blackberry10/plugin/blackberry10/logger.js
@@ -0,0 +1,30 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+var cordova = require('cordova');
+
+module.exports = {
+    log: function (args, win, fail) {
+        console.log(args);
+        return {"status" : cordova.callbackStatus.OK,
+                "message" : 'Message logged to console: ' + args};
+    }
+};

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/615aea47/lib/blackberry10/plugin/blackberry10/magnetometer.js
----------------------------------------------------------------------
diff --git a/lib/blackberry10/plugin/blackberry10/magnetometer.js b/lib/blackberry10/plugin/blackberry10/magnetometer.js
new file mode 100644
index 0000000..72aa90e
--- /dev/null
+++ b/lib/blackberry10/plugin/blackberry10/magnetometer.js
@@ -0,0 +1,45 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+var cordova = require('cordova'),
+    callback;
+
+module.exports = {
+    start: function (args, win, fail) {
+        window.removeEventListener("deviceorientation", callback);
+        callback = function (orientation) {
+            var heading = 360 - orientation.alpha;
+            win({
+                magneticHeading: heading,
+                trueHeading: heading,
+                headingAccuracy: 0,
+                timestamp: orientation.timeStamp
+            });
+        };
+
+        window.addEventListener("deviceorientation", callback);
+        return { "status" : cordova.callbackStatus.NO_RESULT, "message" : "WebWorks Is On It" };
+    },
+    stop: function (args, win, fail) {
+        window.removeEventListener("deviceorientation", callback);
+        return { "status" : cordova.callbackStatus.OK, "message" : "removed" };
+    }
+};

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/615aea47/lib/blackberry10/plugin/blackberry10/manager.js
----------------------------------------------------------------------
diff --git a/lib/blackberry10/plugin/blackberry10/manager.js b/lib/blackberry10/plugin/blackberry10/manager.js
new file mode 100644
index 0000000..8307c74
--- /dev/null
+++ b/lib/blackberry10/plugin/blackberry10/manager.js
@@ -0,0 +1,60 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+var cordova = require('cordova'),
+    plugins = {
+        'NetworkStatus' : require('cordova/plugin/blackberry10/network'),
+        'Accelerometer' : require('cordova/plugin/blackberry10/accelerometer'),
+        'Device' : require('cordova/plugin/blackberry10/device'),
+        'Battery' : require('cordova/plugin/blackberry10/battery'),
+        'Compass' : require('cordova/plugin/blackberry10/magnetometer'),
+        'Camera' : require('cordova/plugin/blackberry10/camera'),
+        'Capture' : require('cordova/plugin/blackberry10/capture'),
+        'Logger' : require('cordova/plugin/blackberry10/logger'),
+        'Notification' : require('cordova/plugin/blackberry10/notification'),
+        'Media': require('cordova/plugin/blackberry10/media'),
+        'File' : require('cordova/plugin/blackberry10/file'),
+        'InAppBrowser' : require('cordova/plugin/blackberry10/InAppBrowser'),
+        'FileTransfer': require('cordova/plugin/blackberry10/fileTransfer')
+    };
+
+module.exports = {
+    addPlugin: function (key, module) {
+        plugins[key] = require(module);
+    },
+    exec: function (win, fail, clazz, action, args) {
+        var result = {"status" : cordova.callbackStatus.CLASS_NOT_FOUND_EXCEPTION, "message" : "Class " + clazz + " cannot be found"};
+
+        if (plugins[clazz]) {
+            if (plugins[clazz][action]) {
+                result = plugins[clazz][action](args, win, fail);
+            }
+            else {
+                result = { "status" : cordova.callbackStatus.INVALID_ACTION, "message" : "Action not found: " + action };
+            }
+        }
+
+        return result;
+    },
+    resume: function () {},
+    pause: function () {},
+    destroy: function () {}
+};

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/615aea47/lib/blackberry10/plugin/blackberry10/media.js
----------------------------------------------------------------------
diff --git a/lib/blackberry10/plugin/blackberry10/media.js b/lib/blackberry10/plugin/blackberry10/media.js
new file mode 100644
index 0000000..a141a99
--- /dev/null
+++ b/lib/blackberry10/plugin/blackberry10/media.js
@@ -0,0 +1,189 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+var cordova = require('cordova'),
+    audioObjects = {};
+
+module.exports = {
+    create: function (args, win, fail) {
+        if (!args.length) {
+            return {"status" : 9, "message" : "Media Object id was not sent in arguments"};
+        }
+
+        var id = args[0],
+            src = args[1];
+
+        if (typeof src == "undefined"){
+            audioObjects[id] = new Audio();
+        } else {
+            audioObjects[id] = new Audio(src);
+        }
+
+        return {"status" : 1, "message" : "Audio object created" };
+    },
+    startPlayingAudio: function (args, win, fail) {
+        if (!args.length) {
+            return {"status" : 9, "message" : "Media Object id was not sent in arguments"};
+        }
+
+        var id = args[0],
+            audio = audioObjects[id],
+            result;
+
+        if (args.length === 1 || typeof args[1] == "undefined" ) {
+            return {"status" : 9, "message" : "Media source argument not found"};
+        }
+
+        if (audio) {
+            audio.pause();
+            audioObjects[id] = undefined;
+        }
+
+        audio = audioObjects[id] = new Audio(args[1]);
+        audio.play();
+        return {"status" : 1, "message" : "Audio play started" };
+    },
+    stopPlayingAudio: function (args, win, fail) {
+        if (!args.length) {
+            return {"status" : 9, "message" : "Media Object id was not sent in arguments"};
+        }
+
+        var id = args[0],
+            audio = audioObjects[id],
+            result;
+
+        if (!audio) {
+            return {"status" : 2, "message" : "Audio Object has not been initialized"};
+        }
+
+        audio.pause();
+        audioObjects[id] = undefined;
+
+        return {"status" : 1, "message" : "Audio play stopped" };
+    },
+    seekToAudio: function (args, win, fail) {
+        if (!args.length) {
+            return {"status" : 9, "message" : "Media Object id was not sent in arguments"};
+        }
+
+        var id = args[0],
+            audio = audioObjects[id],
+            result;
+
+        if (!audio) {
+            result = {"status" : 2, "message" : "Audio Object has not been initialized"};
+        } else if (args.length === 1) {
+            result = {"status" : 9, "message" : "Media seek time argument not found"};
+        } else {
+            try {
+                audio.currentTime = args[1];
+            } catch (e) {
+                console.log('Error seeking audio: ' + e);
+                return {"status" : 3, "message" : "Error seeking audio: " + e};
+            }
+
+            result = {"status" : 1, "message" : "Seek to audio succeeded" };
+        }
+        return result;
+    },
+    pausePlayingAudio: function (args, win, fail) {
+        if (!args.length) {
+            return {"status" : 9, "message" : "Media Object id was not sent in arguments"};
+        }
+
+        var id = args[0],
+            audio = audioObjects[id],
+            result;
+
+        if (!audio) {
+            return {"status" : 2, "message" : "Audio Object has not been initialized"};
+        }
+
+        audio.pause();
+
+        return {"status" : 1, "message" : "Audio paused" };
+    },
+    getCurrentPositionAudio: function (args, win, fail) {
+        if (!args.length) {
+            return {"status" : 9, "message" : "Media Object id was not sent in arguments"};
+        }
+
+        var id = args[0],
+            audio = audioObjects[id],
+            result;
+
+        if (!audio) {
+            return {"status" : 2, "message" : "Audio Object has not been initialized"};
+        }
+
+        return {"status" : 1, "message" : audio.currentTime };
+    },
+    getDuration: function (args, win, fail) {
+        if (!args.length) {
+            return {"status" : 9, "message" : "Media Object id was not sent in arguments"};
+        }
+
+        var id = args[0],
+            audio = audioObjects[id],
+            result;
+
+        if (!audio) {
+            return {"status" : 2, "message" : "Audio Object has not been initialized"};
+        }
+
+        return {"status" : 1, "message" : audio.duration };
+    },
+    startRecordingAudio: function (args, win, fail) {
+        if (!args.length) {
+            return {"status" : 9, "message" : "Media Object id was not sent in arguments"};
+        }
+
+        if (args.length <= 1) {
+            return {"status" : 9, "message" : "Media start recording, insufficient arguments"};
+        }
+
+        blackberry.media.microphone.record(args[1], win, fail);
+        return { "status" : cordova.callbackStatus.NO_RESULT, "message" : "WebWorks Is On It" };
+    },
+    stopRecordingAudio: function (args, win, fail) {
+    },
+    release: function (args, win, fail) {
+        if (!args.length) {
+            return {"status" : 9, "message" : "Media Object id was not sent in arguments"};
+        }
+
+        var id = args[0],
+            audio = audioObjects[id],
+            result;
+
+        if (audio) {
+            if(audio.src !== ""){
+                audio.src = undefined;
+            }
+            audioObjects[id] = undefined;
+            //delete audio;
+        }
+
+        result = {"status" : 1, "message" : "Media resources released"};
+
+        return result;
+    }
+};

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/615aea47/lib/blackberry10/plugin/blackberry10/network.js
----------------------------------------------------------------------
diff --git a/lib/blackberry10/plugin/blackberry10/network.js b/lib/blackberry10/plugin/blackberry10/network.js
new file mode 100644
index 0000000..b640f75
--- /dev/null
+++ b/lib/blackberry10/plugin/blackberry10/network.js
@@ -0,0 +1,28 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+var cordova = require('cordova');
+
+module.exports = {
+    getConnectionInfo: function (args, win, fail) {
+        return { "status": cordova.callbackStatus.OK, "message": blackberry.connection.type};
+    }
+};

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/615aea47/lib/blackberry10/plugin/blackberry10/notification.js
----------------------------------------------------------------------
diff --git a/lib/blackberry10/plugin/blackberry10/notification.js b/lib/blackberry10/plugin/blackberry10/notification.js
new file mode 100644
index 0000000..9de87b8
--- /dev/null
+++ b/lib/blackberry10/plugin/blackberry10/notification.js
@@ -0,0 +1,52 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+var cordova = require('cordova');
+
+module.exports = {
+    alert: function (args, win, fail) {
+        if (args.length !== 3) {
+            return {"status" : 9, "message" : "Notification action - alert arguments not found"};
+        }
+
+        //Unpack and map the args
+        var msg = args[0],
+            title = args[1],
+            btnLabel = args[2];
+
+        blackberry.ui.dialog.customAskAsync.apply(this, [ msg, [ btnLabel ], win, { "title" : title } ]);
+        return { "status" : cordova.callbackStatus.NO_RESULT, "message" : "WebWorks Is On It" };
+    },
+    confirm: function (args, win, fail) {
+        if (args.length !== 3) {
+            return {"status" : 9, "message" : "Notification action - confirm arguments not found"};
+        }
+
+        //Unpack and map the args
+        var msg = args[0],
+            title = args[1],
+            btnLabel = args[2],
+            btnLabels = btnLabel.split(",");
+
+        blackberry.ui.dialog.customAskAsync.apply(this, [msg, btnLabels, win, {"title" : title} ]);
+        return { "status" : cordova.callbackStatus.NO_RESULT, "message" : "WebWorks Is On It" };
+    }
+};

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/615aea47/lib/blackberry10/plugin/blackberry10/platform.js
----------------------------------------------------------------------
diff --git a/lib/blackberry10/plugin/blackberry10/platform.js b/lib/blackberry10/plugin/blackberry10/platform.js
new file mode 100644
index 0000000..871f2d1
--- /dev/null
+++ b/lib/blackberry10/plugin/blackberry10/platform.js
@@ -0,0 +1,44 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+var cordova = require('cordova');
+
+module.exports = {
+    id: "blackberry10",
+    initialize: function () {
+        document.addEventListener("deviceready", function () {
+            blackberry.event.addEventListener("pause", function () {
+                cordova.fireDocumentEvent("pause");
+            });
+            blackberry.event.addEventListener("resume", function () {
+                cordova.fireDocumentEvent("resume");
+            });
+
+            window.addEventListener("online", function () {
+                cordova.fireDocumentEvent("online");
+            });
+
+            window.addEventListener("offline", function () {
+                cordova.fireDocumentEvent("offline");
+            });
+        });
+    }
+};

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/615aea47/lib/scripts/bootstrap-blackberry.js
----------------------------------------------------------------------
diff --git a/lib/scripts/bootstrap-blackberry.js b/lib/scripts/bootstrap-blackberry.js
index 8dbf65e..8f3c0bc 100644
--- a/lib/scripts/bootstrap-blackberry.js
+++ b/lib/scripts/bootstrap-blackberry.js
@@ -20,25 +20,7 @@
 */
 
 document.addEventListener("DOMContentLoaded", function () {
-    switch(require('cordova/platform').runtime()) {
-    case 'qnx':
-        var wwjs = document.createElement("script");
-        wwjs.src = "local:///chrome/webworks.js";
-        wwjs.onload = function () {
-            document.addEventListener("webworksready", function () {
-                require('cordova/channel').onNativeReady.fire();
-            });
-        };
-        wwjs.onerror = function () {
-            console.error('there was a problem loading webworks.js');
-        };
-        document.head.appendChild(wwjs);
-        break;
-    case 'air':
+    if (require('cordova/platform').runtime() === 'air') {
         require('cordova/channel').onNativeReady.fire();
-        break;
-    case 'java':
-        //nothing to do for java
-        break;
     }
 });

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/615aea47/lib/scripts/bootstrap-blackberry10.js
----------------------------------------------------------------------
diff --git a/lib/scripts/bootstrap-blackberry10.js b/lib/scripts/bootstrap-blackberry10.js
new file mode 100644
index 0000000..65115fd
--- /dev/null
+++ b/lib/scripts/bootstrap-blackberry10.js
@@ -0,0 +1,34 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+document.addEventListener("DOMContentLoaded", function () {
+    var wwjs = document.createElement("script");
+    wwjs.src = "local:///chrome/webworks.js";
+    wwjs.onload = function () {
+        document.addEventListener("webworksready", function () {
+            require('cordova/channel').onNativeReady.fire();
+        });
+    };
+    wwjs.onerror = function () {
+        alert('there was a problem loading webworks.js');
+    };
+    document.head.appendChild(wwjs);
+});

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/615aea47/test/blackberry/qnx/test.battery.js
----------------------------------------------------------------------
diff --git a/test/blackberry/qnx/test.battery.js b/test/blackberry/qnx/test.battery.js
deleted file mode 100644
index c66c0ef..0000000
--- a/test/blackberry/qnx/test.battery.js
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-describe("blackberry qnx battery", function () {
-    var battery = require('cordova/plugin/qnx/battery'),
-        cordova = require('cordova');
-
-    beforeEach(function () {
-        spyOn(window, "setInterval").andReturn(1);
-        spyOn(window, "clearInterval");
-    });
-
-    it("returns no_result when calling start", function () {
-        expect(battery.start()).toEqual({
-            status: cordova.callbackStatus.NO_RESULT,
-            message: "WebWorks Is On It"
-        });
-    });
-
-    it("sets an interval for 500 ms when calling start", function () {
-        battery.start();
-        expect(window.setInterval).toHaveBeenCalledWith(jasmine.any(Function), 500);
-    });
-
-    it("calls the win callback with values from navigator.webkitBattery", function () {
-        global.navigator = window.navigator;
-        window.navigator.webkitBattery = { level: 0.12, charging: true };
-
-        var win = jasmine.createSpy("win");
-        battery.start({}, win);
-
-        window.setInterval.mostRecentCall.args[0]();
-
-        expect(win).toHaveBeenCalledWith({
-            level: 12,
-            isPlugged: true
-        });
-
-        delete window.navigator.webkitBattery;
-    });
-
-    it("returns ok when calling stop", function () {
-        expect(battery.stop()).toEqual({
-            status: cordova.callbackStatus.OK,
-            message: "stopped"
-        });
-    });
-
-    it("calls clearInterval when stopping", function () {
-        battery.start();
-        battery.stop();
-        expect(window.clearInterval).toHaveBeenCalledWith(1);
-    });
-});

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/615aea47/test/blackberry/qnx/test.camera.js
----------------------------------------------------------------------
diff --git a/test/blackberry/qnx/test.camera.js b/test/blackberry/qnx/test.camera.js
deleted file mode 100644
index 1cedd6c..0000000
--- a/test/blackberry/qnx/test.camera.js
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-describe("blackberry qnx camera", function () {
-    var camera = require('cordova/plugin/qnx/camera'),
-        cordova = require('cordova');
-
-    beforeEach(function () {
-        global.blackberry = {
-            invoke: {
-                card: {
-                    invokeCamera: jasmine.createSpy("invokeCamera")
-                }
-            }
-        };
-    });
-
-    afterEach(function () {
-        delete global.blackberry;
-    });
-    
-    it("returns no_result when calling takePicture", function () {
-        expect(camera.takePicture()).toEqual({
-            status: cordova.callbackStatus.NO_RESULT,
-            message: "WebWorks Is On It"
-        });
-    });
-
-    it("calls blackberry.invoke.card.invokeCamera", function () {
-        camera.takePicture();
-        expect(blackberry.invoke.card.invokeCamera).toHaveBeenCalledWith("photo", jasmine.any(Function), jasmine.any(Function), jasmine.any(Function));
-    });
-
-    it("adds file:// to the path provided to the callback and calls success", function () {
-        var win = jasmine.createSpy("win");
-        camera.takePicture({}, win);
-
-        blackberry.invoke.card.invokeCamera.mostRecentCall.args[1]("pics/ponies.jpg");
-        expect(win).toHaveBeenCalledWith("file://pics/ponies.jpg");
-    });
-});

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/615aea47/test/blackberry/qnx/test.capture.js
----------------------------------------------------------------------
diff --git a/test/blackberry/qnx/test.capture.js b/test/blackberry/qnx/test.capture.js
deleted file mode 100644
index 2c73f91..0000000
--- a/test/blackberry/qnx/test.capture.js
+++ /dev/null
@@ -1,222 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-describe("blackberry qnx capture", function () {
-    var capture = require('cordova/plugin/qnx/capture'),
-        cordova = require('cordova');
-
-    describe("getSupportedAudioModes", function(){
-        it('should return Ok', function(){
-            expect(capture.getSupportedAudioModes()).toEqual({
-                status: cordova.callbackStatus.OK,
-                message: []
-            });
-        });
-    });
-
-    describe("getSupportedImageModes", function(){
-        it('should return Ok', function(){
-            expect(capture.getSupportedImageModes()).toEqual({
-                status: cordova.callbackStatus.OK,
-                message: []
-            });
-        });
-    });
-
-    describe("getSupportedVideoModes", function(){
-        it('should return Ok', function(){
-            expect(capture.getSupportedVideoModes()).toEqual({
-                status: cordova.callbackStatus.OK,
-                message: []
-            });
-        });
-    });
-
-    function testCapture(method, action) {
-        describe(method, function(){
-            beforeEach(function () {
-                global.blackberry = {
-                    invoke: {
-                        card: {
-                            invokeCamera: jasmine.createSpy('blackberry.invoke.card.invokeCamera')
-                        }
-                    }
-                };
-            });
-
-            afterEach(function () {
-                delete global.blackberry;
-            });
-
-            it('should return No Result', function(){
-                var args = [{limit: 0}],
-                    win = jasmine.createSpy('win'),
-                    fail = jasmine.createSpy('fail');
-
-                expect(capture[method](args, win, fail)).toEqual({
-                    status: cordova.callbackStatus.NO_RESULT,
-                    message: "WebWorks Is On It"
-                });
-            });
-
-            describe("when the limit is 0 or less", function () {
-                it('calls the win callback with an empty array', function(){
-                    var args = [{ limit: -9 }],
-                        win = jasmine.createSpy('win'),
-                        fail = jasmine.createSpy('fail');
-
-                    capture[method](args, win, fail);
-                    expect(win).toHaveBeenCalled();
-                });
-            });
-
-            describe("when the limit is greater than 0", function () {
-                var win, fail;
-
-                beforeEach(function () {
-                    win = jasmine.createSpy("win");
-                    fail = jasmine.createSpy("fail");
-                });
-
-                it("calls the invokeCamera method", function () {
-                    capture[method]([{limit: 1}], win, fail);
-                    expect(blackberry.invoke.card.invokeCamera).toHaveBeenCalledWith(action, 
-                                                                                     jasmine.any(Function),
-                                                                                     jasmine.any(Function),
-                                                                                     jasmine.any(Function));
-                });
-
-                describe("inside the invokeCamera callback", function () {
-                    var onsave;
-
-                    beforeEach(function () {
-                        window.webkitRequestFileSystem = jasmine.createSpy("window.webkitRequestFileSystem");
-                        global.blackberry.io = { sandbox: true };
-
-                        capture[method]([{limit: 1}], win, fail);
-                        onsave = blackberry.invoke.card.invokeCamera.mostRecentCall.args[1];
-                    });
-
-                    afterEach(function () {
-                        delete window.webkitRequestFileSystem;
-                    });
-
-                    it("sets the sandbox to false", function () {
-                        onsave();
-                        expect(blackberry.io.sandbox).toBe(false);
-                    });
-
-                    it("calls webkitRequestFileSystem", function () {
-                        onsave();
-                        expect(window.webkitRequestFileSystem).toHaveBeenCalledWith(
-                            window.PERSISTENT, 
-                            1024, 
-                            jasmine.any(Function), 
-                            fail);
-                    });
-
-                    describe("in the webkitRequestFileSystem callback", function () {
-                        var callback,
-                            fs = { root: { getFile: jasmine.createSpy("getFile") } };
-
-                        beforeEach(function () {
-                            onsave('/foo/bar/baz.gif');
-                            callback = window.webkitRequestFileSystem.mostRecentCall.args[2];
-                        });
-
-                        it("calls getfile on the provided filesystem", function () {
-                            callback(fs);
-                            expect(fs.root.getFile).toHaveBeenCalledWith('/foo/bar/baz.gif', 
-                                                                         {},
-                                                                         jasmine.any(Function), 
-                                                                         fail);
-                        });
-
-                        it("calls the file method of the fileEntity", function () {
-                            var fe = { file: jasmine.createSpy('file') };
-                            callback(fs);
-                            fs.root.getFile.mostRecentCall.args[2](fe);
-                            expect(fe.file).toHaveBeenCalledWith(jasmine.any(Function), fail);
-                        });
-
-                        describe("in the file callback", function () {
-                            var fe = { 
-                                    file: jasmine.createSpy('file'),
-                                    fullPath: 'file://this/is/the/full/path/eh.png'
-                                },
-                                fileCB;
-
-                            beforeEach(function () {
-                                callback(fs);
-                                fs.root.getFile.mostRecentCall.args[2](fe);
-                                fileCB = fe.file.mostRecentCall.args[0];
-                            });
-
-                            it("sets the fullPath of the file object", function () {
-                                var file = {};
-                                fileCB(file);
-                                expect(file.fullPath).toBe(fe.fullPath);
-                            });
-
-                            it("calls the win callback with an array containing the file", function () {
-                                var file = {};
-                                fileCB(file);
-                                expect(win).toHaveBeenCalledWith([file]);
-                            });
-
-                            it("resets the value of blackberry.io.sandbox", function () {
-                                var file = {};
-                                fileCB(file);
-                                expect(blackberry.io.sandbox).toBe(true);
-                            });
-                        });
-                    });
-                });
-            });
-        });
-    }
-
-    testCapture('captureImage', 'photo');
-    testCapture('captureVideo', 'video');
-
-    describe("captureAudio", function(){
-        it('should call the fail callback', function(){
-            var args = {},
-                win = jasmine.createSpy('win'),
-                fail = jasmine.createSpy('fail');
-
-            capture.captureAudio(args, win, fail);
-            expect(fail).toHaveBeenCalled();
-            expect(win).not.toHaveBeenCalled();
-        });
-
-        it('should return no result', function(){
-            var args = "arguments",
-                win = jasmine.createSpy('win'),
-                fail = jasmine.createSpy('fail');
-
-            expect(capture.captureAudio(args, win, fail)).toEqual({
-                status: cordova.callbackStatus.NO_RESULT,
-                message: "WebWorks Is On It"
-            });
-        });
-    });
-});

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/615aea47/test/blackberry/qnx/test.compass.js
----------------------------------------------------------------------
diff --git a/test/blackberry/qnx/test.compass.js b/test/blackberry/qnx/test.compass.js
deleted file mode 100644
index 870a0a4..0000000
--- a/test/blackberry/qnx/test.compass.js
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-xdescribe("blackberry qnx compass", function () {
-    var compass = require('cordova/plugin/qnx/compass'),
-        cordova = require('cordova'),
-        exec = require('cordova/exec'),
-        utils = require('cordova/utils'),
-        CompassHeading = require('cordova/plugin/CompassHeading'),
-        CompassError = require('cordova/plugin/CompassError'),
-        win = jasmine.createSpy('win'),
-        fail = jasmine.createSpy('fail');
-
-    beforeEach(function () {
-        window.start = jasmine.createSpy('start');
-        window.stop = jasmine.createSpy('stop');
-        window.removeListeners = jasmine.createSpy('removeListeners');
-        global.listeners = [];
-
-    });
-
-    afterEach(function () {
-
-    });
-
-
-    describe("watchHeading", function(){
-        it('should return that successCallback is not a function', function(){
-            expect(compass.getCurrentHeading).toThrow("getCurrentHeading must be called with at least a success callback function as first parameter.");
-        });
-
-        it('should see that start() was called', function(){
-            compass.getCurrentHeading(win, fail);
-            expect(listeners).toHaveBeenCalled();
-        });
-
-    });
-
-    describe("clearWatch", function(){
-
-
-    });
-});

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/615aea47/test/blackberry/qnx/test.device.js
----------------------------------------------------------------------
diff --git a/test/blackberry/qnx/test.device.js b/test/blackberry/qnx/test.device.js
deleted file mode 100644
index 58c1c8d..0000000
--- a/test/blackberry/qnx/test.device.js
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-describe("blackberry qnx device", function () {
-    var device = require('cordova/plugin/qnx/device');
-    
-    it("calls the win callback with the device info", function () {
-        global.blackberry = {
-            system: {
-                softwareVersion: "NaN"
-            },
-            identity: {
-                uuid: 1
-            }
-        };
-
-        var info;
-
-        //HACK: I know this is a sync call ;)
-        device.getDeviceInfo({}, function (i) { info = i; });
-
-        expect(info.platform).toBe("BlackBerry");
-        expect(info.version).toBe("NaN");
-        expect(info.name).toBe("Dev Alpha");
-        expect(info.uuid).toBe(1);
-        expect(info.cordova).toBeDefined();
-        
-        delete global.blackberry;
-    });
-});

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/615aea47/test/blackberry/qnx/test.fileTransfer.js
----------------------------------------------------------------------
diff --git a/test/blackberry/qnx/test.fileTransfer.js b/test/blackberry/qnx/test.fileTransfer.js
deleted file mode 100644
index 43baedc..0000000
--- a/test/blackberry/qnx/test.fileTransfer.js
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-describe("blackberry qnx fileTransfer", function () {
-    var fileTransfer = require('cordova/plugin/qnx/fileTransfer');
-    var cordova = require('cordova'),
-        win = jasmine.createSpy('win'),
-        fail = jasmine.createSpy('fail')
-        xhrSend = jasmine.createSpy('xhr send');
-        xhrOpen = jasmine.createSpy('xhr open');
-
-    beforeEach(function () {
-        global.blackberry = {
-            io:{
-                filetransfer: {
-                    download: jasmine.createSpy('download'),
-                    upload: jasmine.createSpy('upload')
-                }
-            }
-        };
-        XMLHttpRequest = function () {
-            var xhr = {
-                send: xhrSend,
-                open: xhrOpen
-            };
-            return xhr;
-        };
-        window.webkitResolveLocalFileSystemURL = jasmine.createSpy("resolveFS")
-    });
-
-    afterEach(function () {
-        delete global.blackberry;
-        delete XMLHttpRequest;
-        delete webkitResolveLocalFileSystemURL;
-        delete window.webkitResolveLocalFileSystemURL;
-    });
-
-    describe("download", function(){
-        it('should call the blackberry download', function () {
-            fileTransfer.download(["source/file", "target/file"], win, fail);
-            expect(xhrOpen).toHaveBeenCalled();
-            expect(xhrSend).toHaveBeenCalled();
-        });
-
-        it('should return No Result', function(){
-            expect(fileTransfer.download(["location/source", "location/place/here"], win, fail)).toEqual({
-                status: cordova.callbackStatus.NO_RESULT,
-                message: "async"
-            });
-        });
-    });
-
-    describe('upload', function(){
-        it('should call the blackberry upload', function(){
-            fileTransfer.upload(["source", "target", "fileKey", "fileName", "mimeType", "params", "chunkedMode"], win, fail);
-            expect(xhrOpen).toHaveBeenCalled();
-            expect(xhrSend).toHaveBeenCalled();
-        });
-
-        it('should return No Result', function(){
-            expect(fileTransfer.upload(["location/source", "location/place/here"], win, fail)).toEqual({
-                status: cordova.callbackStatus.NO_RESULT,
-                message: "async"
-            });
-        });
-    });
-});

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/615aea47/test/blackberry/qnx/test.magnetometer.js
----------------------------------------------------------------------
diff --git a/test/blackberry/qnx/test.magnetometer.js b/test/blackberry/qnx/test.magnetometer.js
deleted file mode 100644
index 2f8e583..0000000
--- a/test/blackberry/qnx/test.magnetometer.js
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-describe("blackberry qnx magnetometer", function () {
-    var magnetometer = require('cordova/plugin/qnx/magnetometer'),
-        cordova = require('cordova');
-
-    beforeEach(function () {
-        spyOn(window, "removeEventListener");
-        spyOn(window, "addEventListener");
-    });
-
-    describe("start", function(){
-        it('should return no result', function(){
-            expect(magnetometer.start()).toEqual({
-                status: cordova.callbackStatus.NO_RESULT,
-                message: "WebWorks Is On It"
-            });
-        });
-
-        it('should remove the event listener', function(){
-            magnetometer.start();
-            expect(window.removeEventListener).toHaveBeenCalledWith("deviceorientation", jasmine.any(Function));
-        });
-
-        it('should add an event listener', function(){
-            magnetometer.start();
-            expect(window.addEventListener).toHaveBeenCalledWith("deviceorientation", jasmine.any(Function));
-        });
-
-        it('call the win callback with the data from the event', function(){
-            var win = jasmine.createSpy('win');
-            magnetometer.start({}, win);
-
-            window.addEventListener.mostRecentCall.args[1]({
-                alpha: 60,
-                timeStamp: "bout that time, eh chap?"
-            });
-
-            expect(win).toHaveBeenCalledWith({
-                magneticHeading: 300,
-                trueHeading: 300,
-                headingAccuracy: 0,
-                timestamp: "bout that time, eh chap?"
-            });
-        });
-    });
-
-    describe('stop', function(){
-        it('should return OK', function(){
-            expect(magnetometer.stop()).toEqual({
-                status: cordova.callbackStatus.OK,
-                message: "removed"
-            });
-        });
-
-        it('should remove the event listener', function(){
-            magnetometer.stop();
-            expect(window.removeEventListener).toHaveBeenCalledWith("deviceorientation", jasmine.any(Function));
-        });
-    });
-});

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/615aea47/test/blackberry/qnx/test.manager.js
----------------------------------------------------------------------
diff --git a/test/blackberry/qnx/test.manager.js b/test/blackberry/qnx/test.manager.js
deleted file mode 100644
index 5e5571a..0000000
--- a/test/blackberry/qnx/test.manager.js
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-describe("blackberry qnx manager", function () {
-    var manager = require('cordova/plugin/qnx/manager');
-
-    it("calls the plugin", function () {
-        var device = require('cordova/plugin/qnx/device'),
-            win = jasmine.createSpy('win'),
-            fail = jasmine.createSpy('fail'),
-            args = {};
-
-        spyOn(device, "getDeviceInfo");
-
-        manager.exec(win, fail, "Device", "getDeviceInfo", args);
-        expect(device.getDeviceInfo).toHaveBeenCalledWith(args, win, fail);
-    });
-
-    it("returns the result of the plugin", function () {
-        var camera = require('cordova/plugin/qnx/camera');
-        spyOn(camera, "takePicture").andReturn("duckface");
-        expect(manager.exec(null, null, "Camera", "takePicture")).toBe("duckface");
-    });
-
-    it("returns class not found when no plugin", function () {
-        expect(manager.exec(null, null, "Ruby", "method_missing")).toEqual({
-           status: cordova.callbackStatus.CLASS_NOT_FOUND_EXCEPTION,
-           message: "Class Ruby cannot be found"
-        });
-    });
-
-    it("returns invalid action when no action", function () {
-        expect(manager.exec(null, null, "Camera", "makePonies")).toEqual({
-            status: cordova.callbackStatus.INVALID_ACTION,
-            message: "Action not found: makePonies"
-        });
-    });
-});

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/615aea47/test/blackberry/qnx/test.network.js
----------------------------------------------------------------------
diff --git a/test/blackberry/qnx/test.network.js b/test/blackberry/qnx/test.network.js
deleted file mode 100644
index 63a224b..0000000
--- a/test/blackberry/qnx/test.network.js
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-describe("blackberry qnx network", function () {
-    var cordova = require('cordova'),
-        network = require('cordova/plugin/qnx/network');
-
-    it("returns the connection info", function () {
-        global.blackberry = {
-            connection: {
-                type: "pigeon"
-            }
-        };
-        expect(network.getConnectionInfo()).toEqual({
-            status: cordova.callbackStatus.OK,
-            message: "pigeon"
-        });
-
-        delete global.blackberry;
-    });
-});

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/615aea47/test/blackberry/qnx/test.platform.js
----------------------------------------------------------------------
diff --git a/test/blackberry/qnx/test.platform.js b/test/blackberry/qnx/test.platform.js
deleted file mode 100644
index 231c5ca..0000000
--- a/test/blackberry/qnx/test.platform.js
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-
-describe("blackberry qnx platform", function () {
-    var platform = require('cordova/plugin/qnx/platform'),
-        cordova = require('cordova');
-
-    beforeEach(function () {
-
-        global.blackberry = {
-            event:{
-                addEventListener: jasmine.createSpy('addEventListener')
-            }
-        }
-
-        spyOn(cordova, "fireDocumentEvent");
-
-        spyOn(document, "addEventListener").andCallFake(function(){
-            blackberry.event.addEventListener("pause", function(){
-                cordova.fireDocumentEvent("pause")
-            });
-            blackberry.event.addEventListener("resume", function(){
-                cordova.fireDocumentEvent("resume")
-            });
-
-            window.addEventListener("online", function(){
-                cordova.fireDocumentEvent("online");
-            });
-            window.addEventListener("offline", function(){
-                cordova.fireDocumentEvent("offline");
-            });
-        });
-        
-        spyOn(window, "addEventListener").andCallFake(function(){
-            cordova.fireDocumentEvent("online");
-            cordova.fireDocumentEvent("offline");
-        });
-    });
-
-    afterEach(function(){
-        delete global.blackberry;
-    });
-
-    describe("exports", function(){
-        it('should have the qnx id', function(){
-            expect(platform.id).toBe("qnx");
-        });
-    });
-
-    describe("initialize", function(){
-        it('should add an event listener to document', function(){
-            platform.initialize();
-            expect(document.addEventListener).toHaveBeenCalledWith("deviceready", jasmine.any(Function));
-        });
-        it('should check if blackberry event addEventListener was called for pause', function(){
-            platform.initialize();
-            expect(blackberry.event.addEventListener).toHaveBeenCalledWith("pause", jasmine.any(Function));
-        });
-        it('should check if blackberry event addEventListener was called for resume', function(){
-            platform.initialize();     
-            expect(blackberry.event.addEventListener).toHaveBeenCalledWith("resume", jasmine.any(Function));
-        });
-        it('should check if window.addEventListener was called for online', function(){
-            platform.initialize();
-            expect(window.addEventListener).toHaveBeenCalledWith("online", jasmine.any(Function));
-            
-        });
-        it('should check if window.addEventListener was called for offline', function(){
-            platform.initialize();
-            expect(window.addEventListener).toHaveBeenCalledWith("offline", jasmine.any(Function));
-        });
-
-        it('should call cordova.fireDocumentEvent online', function(){
-            platform.initialize();
-            expect(cordova.fireDocumentEvent).toHaveBeenCalledWith("online");
-        });
-        it('should call cordova.fireDocumentEvent offline', function(){
-            platform.initialize();
-            expect(cordova.fireDocumentEvent).toHaveBeenCalledWith("offline");
-        });
-        it('should call cordova.fireDocumentEvent pause', function(){
-            delete global.blackberry;
-            global.blackberry = { event: { addEventListener: function(){ } } };
-            spyOn(blackberry.event, "addEventListener").andCallFake(function(){
-                cordova.fireDocumentEvent("pause");
-            });
-
-            platform.initialize();
-            
-            expect(cordova.fireDocumentEvent).toHaveBeenCalledWith("pause");
-        });
-        it('should call cordova.fireDocumentEvent resume', function(){
-            delete global.blackberry;
-            global.blackberry = { event: { addEventListener: function(){ } } };
-            spyOn(blackberry.event, "addEventListener").andCallFake(function(){
-                cordova.fireDocumentEvent("resume");
-            });
-
-            platform.initialize();
-            
-            expect(cordova.fireDocumentEvent).toHaveBeenCalledWith("resume");
-        });
-
-    });
-});

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/615aea47/test/blackberry/test.exec.js
----------------------------------------------------------------------
diff --git a/test/blackberry/test.exec.js b/test/blackberry/test.exec.js
index 755b067..1becbe0 100644
--- a/test/blackberry/test.exec.js
+++ b/test/blackberry/test.exec.js
@@ -25,12 +25,12 @@ describe("blackberry exec", function () {
 
     it("calls the managers exec for the given runtime", function () {
         var platform = require('cordova/platform'),
-            manager = require('cordova/plugin/qnx/manager'),
+            manager = require('cordova/plugin/air/manager'),
             win = jasmine.createSpy("win"),
             fail = jasmine.createSpy("fail"),
             args = {};
 
-        spyOn(platform, "runtime").andReturn("qnx");
+        spyOn(platform, "runtime").andReturn("air");
         spyOn(manager, "exec");
 
         exec(win, fail, "foo", "bar", args);
@@ -40,10 +40,10 @@ describe("blackberry exec", function () {
 
     describe("when the callback status is ok", function () {
         var platform = require('cordova/platform'),
-            manager = require('cordova/plugin/qnx/manager');
+            manager = require('cordova/plugin/air/manager');
 
         beforeEach(function () {
-            spyOn(platform, "runtime").andReturn("qnx");
+            spyOn(platform, "runtime").andReturn("air");
             spyOn(manager, "exec").andReturn({
                 status: cordova.callbackStatus.OK,
                 message: "sometimes I drink from the milk carton"
@@ -85,10 +85,10 @@ describe("blackberry exec", function () {
 
     describe("when the callback status is no_result", function () {
         var platform = require('cordova/platform'),
-            manager = require('cordova/plugin/qnx/manager');
+            manager = require('cordova/plugin/air/manager');
 
         beforeEach(function () {
-            spyOn(platform, "runtime").andReturn("qnx");
+            spyOn(platform, "runtime").andReturn("air");
             spyOn(manager, "exec").andReturn({
                 status: cordova.callbackStatus.NO_RESULT,
                 message: "I know what you did last summer"
@@ -114,11 +114,11 @@ describe("blackberry exec", function () {
 
     describe("when the callback status is anything else", function () {
         var platform = require('cordova/platform'),
-            manager = require('cordova/plugin/qnx/manager');
+            manager = require('cordova/plugin/air/manager');
 
         beforeEach(function () {
             spyOn(console, "log");
-            spyOn(platform, "runtime").andReturn("qnx");
+            spyOn(platform, "runtime").andReturn("air");
             spyOn(manager, "exec").andReturn({
                 status: "poop",
                 message: "the bed"

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/615aea47/test/blackberry/test.platform.js
----------------------------------------------------------------------
diff --git a/test/blackberry/test.platform.js b/test/blackberry/test.platform.js
index 8e2a9d0..067d436 100644
--- a/test/blackberry/test.platform.js
+++ b/test/blackberry/test.platform.js
@@ -33,14 +33,15 @@ describe("blackberry platform", function () {
         modulereplacer.replace('cordova/platform', platform);
     });
 
-    describe("when getting the runtime", function () {
-        it("returns qnx for the bb10 user agent", function () {
-            navigator.__defineGetter__("userAgent", function () {
-               return "Mozilla/5.0 (BB10; Touch) AppleWebKit/537.1+ (KHTML, like Gecko) Version/10.0.0.1337 Mobile Safari/537.1+";
-            });
-            expect(platform.runtime()).toBe("qnx");
-        });
+    beforeEach(function () {
+        GLOBAL.navigator = {};
+    });
 
+    afterEach(function () {
+        delete GLOBAL.navigator;
+    });
+
+    describe("when getting the runtime", function () {
         it("returns air for the playbook user agent", function () {
             navigator.__defineGetter__("userAgent", function () {
                return "Mozilla/5.0 (PlayBook; U; RIM Tablet OS 2.1.0; en-US) AppleWebKit/536.2+ (KHTML, like Gecko) Version/7.2.1.0 Safari/536.2+";
@@ -90,15 +91,5 @@ describe("blackberry platform", function () {
             expect(platform.contextObj.navigator.app).not.toBeUndefined();
         });
 
-        it("builds qnx objects into window", function () {
-            var qnx = require('cordova/plugin/qnx/platform');
-
-            spyOn(qnx, "initialize");
-            spyOn(platform, "runtime").andReturn("qnx");
-            platform.initialize();
-
-            expect(platform.contextObj.open).not.toBeUndefined();
-            expect(platform.contextObj.navigator.compass).not.toBeUndefined();
-        });
     });
 });

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/615aea47/test/blackberry10/test.battery.js
----------------------------------------------------------------------
diff --git a/test/blackberry10/test.battery.js b/test/blackberry10/test.battery.js
new file mode 100644
index 0000000..4e8b0b0
--- /dev/null
+++ b/test/blackberry10/test.battery.js
@@ -0,0 +1,72 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+
+describe("blackberry10 battery", function () {
+    var battery = require('cordova/plugin/blackberry10/battery'),
+        cordova = require('cordova');
+
+    beforeEach(function () {
+        spyOn(window, "setInterval").andReturn(1);
+        spyOn(window, "clearInterval");
+    });
+
+    it("returns no_result when calling start", function () {
+        expect(battery.start()).toEqual({
+            status: cordova.callbackStatus.NO_RESULT,
+            message: "WebWorks Is On It"
+        });
+    });
+
+    it("sets an interval for 500 ms when calling start", function () {
+        battery.start();
+        expect(window.setInterval).toHaveBeenCalledWith(jasmine.any(Function), 500);
+    });
+
+    it("calls the win callback with values from navigator.webkitBattery", function () {
+        global.navigator = window.navigator;
+        window.navigator.webkitBattery = { level: 0.12, charging: true };
+
+        var win = jasmine.createSpy("win");
+        battery.start({}, win);
+
+        window.setInterval.mostRecentCall.args[0]();
+
+        expect(win).toHaveBeenCalledWith({
+            level: 12,
+            isPlugged: true
+        });
+
+        delete window.navigator.webkitBattery;
+    });
+
+    it("returns ok when calling stop", function () {
+        expect(battery.stop()).toEqual({
+            status: cordova.callbackStatus.OK,
+            message: "stopped"
+        });
+    });
+
+    it("calls clearInterval when stopping", function () {
+        battery.start();
+        battery.stop();
+        expect(window.clearInterval).toHaveBeenCalledWith(1);
+    });
+});