michael@0: /* michael@0: * michael@0: * Licensed to the Apache Software Foundation (ASF) under one michael@0: * or more contributor license agreements. See the NOTICE file michael@0: * distributed with this work for additional information michael@0: * regarding copyright ownership. The ASF licenses this file michael@0: * to you under the Apache License, Version 2.0 (the michael@0: * "License"); you may not use this file except in compliance michael@0: * with the License. You may obtain a copy of the License at michael@0: * michael@0: * http://www.apache.org/licenses/LICENSE-2.0 michael@0: * michael@0: * Unless required by applicable law or agreed to in writing, michael@0: * software distributed under the License is distributed on an michael@0: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY michael@0: * KIND, either express or implied. See the License for the michael@0: * specific language governing permissions and limitations michael@0: * under the License. michael@0: * michael@0: */ michael@0: michael@0: exports.defineAutoTests = function() { michael@0: describe('Device Information (window.device)', function () { michael@0: it("should exist", function() { michael@0: expect(window.device).toBeDefined(); michael@0: }); michael@0: michael@0: it("should contain a platform specification that is a string", function() { michael@0: expect(window.device.platform).toBeDefined(); michael@0: expect((new String(window.device.platform)).length > 0).toBe(true); michael@0: }); michael@0: michael@0: it("should contain a version specification that is a string", function() { michael@0: expect(window.device.version).toBeDefined(); michael@0: expect((new String(window.device.version)).length > 0).toBe(true); michael@0: }); michael@0: michael@0: it("should contain a UUID specification that is a string or a number", function() { michael@0: expect(window.device.uuid).toBeDefined(); michael@0: if (typeof window.device.uuid == 'string' || typeof window.device.uuid == 'object') { michael@0: expect((new String(window.device.uuid)).length > 0).toBe(true); michael@0: } else { michael@0: expect(window.device.uuid > 0).toBe(true); michael@0: } michael@0: }); michael@0: michael@0: it("should contain a cordova specification that is a string", function() { michael@0: expect(window.device.cordova).toBeDefined(); michael@0: expect((new String(window.device.cordova)).length > 0).toBe(true); michael@0: }); michael@0: michael@0: it("should depend on the precense of cordova.version string", function() { michael@0: expect(window.cordova.version).toBeDefined(); michael@0: expect((new String(window.cordova.version)).length > 0).toBe(true); michael@0: }); michael@0: michael@0: it("should contain device.cordova equal to cordova.version", function() { michael@0: expect(window.device.cordova).toBe(window.cordova.version); michael@0: }); michael@0: michael@0: it("should contain a model specification that is a string", function() { michael@0: expect(window.device.model).toBeDefined(); michael@0: expect((new String(window.device.model)).length > 0).toBe(true); michael@0: }); michael@0: }); michael@0: }; michael@0: michael@0: exports.defineManualTests = function(contentEl, createActionButton) { michael@0: var logMessage = function (message, color) { michael@0: var log = document.getElementById('info'); michael@0: var logLine = document.createElement('div'); michael@0: if (color) { michael@0: logLine.style.color = color; michael@0: } michael@0: logLine.innerHTML = message; michael@0: log.appendChild(logLine); michael@0: } michael@0: michael@0: var clearLog = function () { michael@0: var log = document.getElementById('info'); michael@0: log.innerHTML = ''; michael@0: } michael@0: michael@0: var device_tests = '