cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agri...@apache.org
Subject [04/19] Move mobilespec into www/ so as to not include non-app files in the app
Date Mon, 07 Jul 2014 18:08:08 GMT
http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/77ff9a37/www/autotest/tests/globalization.tests.js
----------------------------------------------------------------------
diff --git a/www/autotest/tests/globalization.tests.js b/www/autotest/tests/globalization.tests.js
new file mode 100644
index 0000000..ddc7c3c
--- /dev/null
+++ b/www/autotest/tests/globalization.tests.js
@@ -0,0 +1,869 @@
+/*
+ * 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('Globalization (navigator.globalization)', function () {
+
+    //not supported on bb10
+    if (cordova.platformId === 'blackberry10') {
+        return;
+    }
+
+    it("globalization.spec.1 should exist", function() {
+        expect(navigator.globalization).toBeDefined();
+    });
+    
+    describe("getPreferredLanguage", function() {
+        it("globalization.spec.1 should exist", function() {
+            expect(typeof navigator.globalization.getPreferredLanguage).toBeDefined();
+            expect(typeof navigator.globalization.getPreferredLanguage == 'function').toBe(true);
+        });
+        it("globalization.spec.3 getPreferredLanguage success callback should be called with a Properties object", function() {
+            var win = jasmine.createSpy().andCallFake(function(a) {
+                    expect(a).toBeDefined();
+                    expect(typeof a).toBe('object');
+                    expect(a.value).toBeDefined();
+                    expect(typeof a.value).toBe('string');
+                    expect(a.value.length > 0).toBe(true);
+                }),
+                fail = jasmine.createSpy();
+
+            runs(function () {
+                navigator.globalization.getPreferredLanguage(win, fail);
+            });
+
+            waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
+
+            runs(function () {
+                expect(fail).not.toHaveBeenCalled();
+            });
+        });
+    });
+    
+    describe("getLocaleName", function() {
+        it("globalization.spec.1 should exist", function() {
+            expect(typeof navigator.globalization.getLocaleName).toBeDefined();
+            expect(typeof navigator.globalization.getLocaleName == 'function').toBe(true);
+        });
+        it("globalization.spec.3 getLocaleName success callback should be called with a Properties object", function() {
+            var win = jasmine.createSpy().andCallFake(function(a) {
+                    expect(a).toBeDefined();
+                    expect(typeof a).toBe('object');
+                    expect(a.value).toBeDefined();
+                    expect(typeof a.value).toBe('string');
+                    expect(a.value.length > 0).toBe(true);
+                }),
+                fail = jasmine.createSpy();
+
+            runs(function () {
+                navigator.globalization.getLocaleName(win, fail);
+            });
+
+            waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
+
+            runs(function () {
+                expect(fail).not.toHaveBeenCalled();
+            });
+        });
+    });
+    
+    describe('Globalization Constants (window.Globalization)', function () {
+        it("globalization.spec.1 should exist", function() {
+            expect(window.GlobalizationError).toBeDefined();
+            expect(window.GlobalizationError.UNKNOWN_ERROR).toBe(0);
+            expect(window.GlobalizationError.FORMATTING_ERROR).toBe(1);
+            expect(window.GlobalizationError.PARSING_ERROR).toBe(2);
+            expect(window.GlobalizationError.PATTERN_ERROR).toBe(3);
+        });
+    });
+    
+    describe("dateToString", function() {
+        it("globalization.spec.1 should exist", function() {
+            expect(typeof navigator.globalization.dateToString).toBeDefined();
+            expect(typeof navigator.globalization.dateToString == 'function').toBe(true);
+        });
+        it("globalization.spec.5 dateToString using default options, success callback should be called with a Properties object", function() {
+            var win = jasmine.createSpy().andCallFake(function(a) {
+                    expect(a).toBeDefined();
+                    expect(typeof a).toBe('object');
+                    expect(a.value).toBeDefined();
+                    expect(typeof a.value).toBe('string');
+                    expect(a.value.length > 0).toBe(true);
+                }),
+                fail = jasmine.createSpy();
+
+            runs(function () {
+                navigator.globalization.dateToString(new Date(), win, fail);
+            });
+
+            waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
+
+            runs(function () {
+                expect(fail).not.toHaveBeenCalled();
+            });
+        });
+        it("globalization.spec.6 dateToString using formatLength=short and selector=date options, success callback should be called with a Properties object", function() {
+            var win = jasmine.createSpy().andCallFake(function(a) {
+                    expect(a).toBeDefined();
+                    expect(typeof a).toBe('object');
+                    expect(a.value).toBeDefined();
+                    expect(typeof a.value).toBe('string');
+                    expect(a.value.length > 0).toBe(true);
+                }),
+                fail = jasmine.createSpy();
+
+            runs(function () {
+                navigator.globalization.dateToString(new Date(), win, fail, {formatLength: 'short', selector: 'date'});
+            });
+
+            waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
+
+            runs(function () {
+                expect(fail).not.toHaveBeenCalled();
+            });
+        });
+        it("globalization.spec.7 dateToString using formatLength=full and selector=date options, success callback should be called with a Properties object", function() {
+            var win = jasmine.createSpy().andCallFake(function(a) {
+                    expect(a).toBeDefined();
+                    expect(typeof a).toBe('object');
+                    expect(a.value).toBeDefined();
+                    expect(typeof a.value).toBe('string');
+                    expect(a.value.length > 0).toBe(true);
+                }),
+                fail = jasmine.createSpy();
+
+            runs(function () {
+                navigator.globalization.dateToString(new Date(), win, fail, {formatLength: 'full', selector: 'date'});
+            });
+
+            waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
+
+            runs(function () {
+                expect(fail).not.toHaveBeenCalled();
+            });
+        });
+        it("globalization.spec.8 dateToString using formatLength=medium and selector=date and time(default) options, success callback should be called with a Properties object", function() {
+            var win = jasmine.createSpy().andCallFake(function(a) {
+                    expect(a).toBeDefined();
+                    expect(typeof a).toBe('object');
+                    expect(a.value).toBeDefined();
+                    expect(typeof a.value).toBe('string');
+                    expect(a.value.length > 0).toBe(true);
+                }),
+                fail = jasmine.createSpy();
+
+            runs(function () {
+                navigator.globalization.dateToString(new Date(), win, fail, {formatLength: 'medium'});
+            });
+
+            waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
+
+            runs(function () {
+                expect(fail).not.toHaveBeenCalled();
+            });
+        });
+        it("globalization.spec.9 dateToString using formatLength=long and selector=date and time(default) options, success callback should be called with a Properties object", function() {
+            var win = jasmine.createSpy().andCallFake(function(a) {
+                    expect(a).toBeDefined();
+                    expect(typeof a).toBe('object');
+                    expect(a.value).toBeDefined();
+                    expect(typeof a.value).toBe('string');
+                    expect(a.value.length > 0).toBe(true);
+                }),
+                fail = jasmine.createSpy();
+
+            runs(function () {
+                navigator.globalization.dateToString(new Date(), win, fail, {formatLength: 'long'});
+            });
+
+            waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
+
+            runs(function () {
+                expect(fail).not.toHaveBeenCalled();
+            });
+        });
+        it("globalization.spec.10 dateToString using formatLength=full and selector=date and time(default) options, success callback should be called with a Properties object", function() {
+            var win = jasmine.createSpy().andCallFake(function(a) {
+                    expect(a).toBeDefined();
+                    expect(typeof a).toBe('object');
+                    expect(a.value).toBeDefined();
+                    expect(typeof a.value).toBe('string');
+                    expect(a.value.length > 0).toBe(true);
+                }),
+                fail = jasmine.createSpy();
+
+            runs(function () {
+                navigator.globalization.dateToString(new Date(), win, fail, {formatLength: 'full'});
+            });
+
+            waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
+
+            runs(function () {
+                expect(fail).not.toHaveBeenCalled();
+            });
+        });
+    });
+    
+    describe("stringToDate", function() {
+        it("globalization.spec.1 should exist", function() {
+            expect(typeof navigator.globalization.stringToDate).toBeDefined();
+            expect(typeof navigator.globalization.stringToDate == 'function').toBe(true);
+        });
+        it("globalization.spec.12 stringToDate using default options, success callback should be called with a Properties object", function() {
+            var win = jasmine.createSpy().andCallFake(function(a) {
+                    expect(a).toBeDefined();
+                    expect(typeof a).toBe('object');
+                    expect(a.year).toBeDefined();
+                    expect(typeof a.year).toBe('number');
+                    expect(a.year >= 0 && a.year <=9999).toBe(true);
+                    expect(a.month).toBeDefined();
+                    expect(typeof a.month).toBe('number');
+                    expect(a.month >= 0 && a.month <=11).toBe(true);
+                    expect(a.day).toBeDefined();
+                    expect(typeof a.day).toBe('number');
+                    expect(a.day >= 1 && a.day <=31).toBe(true);
+                    expect(a.hour).toBeDefined();
+                    expect(typeof a.hour).toBe('number');
+                    expect(a.hour >= 0 && a.hour <=23).toBe(true);
+                    expect(a.minute).toBeDefined();
+                    expect(typeof a.minute).toBe('number');
+                    expect(a.minute >= 0 && a.minute <=59).toBe(true);
+                    expect(a.second).toBeDefined();
+                    expect(typeof a.second).toBe('number');
+                    expect(a.second >= 0 && a.second <=59).toBe(true);
+                    expect(a.millisecond).toBeDefined();
+                    expect(typeof a.millisecond).toBe('number');
+                }),
+                fail = jasmine.createSpy();
+                
+            var win2 = function(a) {
+                navigator.globalization.stringToDate(a.value, win, fail);                
+            };
+
+            runs(function () {
+                navigator.globalization.dateToString(new Date(), win2, fail);
+            });
+
+            waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
+
+            runs(function () {
+                expect(fail).not.toHaveBeenCalled();
+            });
+        });
+        it("globalization.spec.13 stringToDate using formatLength=short and selector=date options, success callback should be called with a Properties object", function() {
+            var win = jasmine.createSpy().andCallFake(function(a) {
+                    expect(a).toBeDefined();
+                    expect(typeof a).toBe('object');
+                    expect(a.year).toBeDefined();
+                    expect(typeof a.year).toBe('number');
+                    expect(a.year >= 0 && a.year <=9999).toBe(true);
+                    expect(a.month).toBeDefined();
+                    expect(typeof a.month).toBe('number');
+                    expect(a.month >= 0 && a.month <=11).toBe(true);
+                    expect(a.day).toBeDefined();
+                    expect(typeof a.day).toBe('number');
+                    expect(a.day >= 1 && a.day <=31).toBe(true);
+                    expect(a.hour).toBeDefined();
+                    expect(typeof a.hour).toBe('number');
+                    expect(a.hour >= 0 && a.hour <=23).toBe(true);
+                    expect(a.minute).toBeDefined();
+                    expect(typeof a.minute).toBe('number');
+                    expect(a.minute >= 0 && a.minute <=59).toBe(true);
+                    expect(a.second).toBeDefined();
+                    expect(typeof a.second).toBe('number');
+                    expect(a.second >= 0 && a.second <=59).toBe(true);
+                    expect(a.millisecond).toBeDefined();
+                    expect(typeof a.millisecond).toBe('number');
+                }),
+                fail = jasmine.createSpy();
+                
+            var win2 = function(a) {
+                navigator.globalization.stringToDate(a.value, win, fail, {formatLength: 'short', selector: 'date'});
+            };
+
+            runs(function () {
+                navigator.globalization.dateToString(new Date(), win2, fail, {formatLength: 'short', selector: 'date'});
+            });
+
+            waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
+
+            runs(function () {
+                expect(fail).not.toHaveBeenCalled();
+            });
+        });
+        it("globalization.spec.14 stringToDate using formatLength=full and selector=date options, success callback should be called with a Properties object", function() {
+            var win = jasmine.createSpy().andCallFake(function(a) {
+                    expect(a).toBeDefined();
+                    expect(typeof a).toBe('object');
+                    expect(a.year).toBeDefined();
+                    expect(typeof a.year).toBe('number');
+                    expect(a.year >= 0 && a.year <=9999).toBe(true);
+                    expect(a.month).toBeDefined();
+                    expect(typeof a.month).toBe('number');
+                    expect(a.month >= 0 && a.month <=11).toBe(true);
+                    expect(a.day).toBeDefined();
+                    expect(typeof a.day).toBe('number');
+                    expect(a.day >= 1 && a.day <=31).toBe(true);
+                    expect(a.hour).toBeDefined();
+                    expect(typeof a.hour).toBe('number');
+                    expect(a.hour >= 0 && a.hour <=23).toBe(true);
+                    expect(a.minute).toBeDefined();
+                    expect(typeof a.minute).toBe('number');
+                    expect(a.minute >= 0 && a.minute <=59).toBe(true);
+                    expect(a.second).toBeDefined();
+                    expect(typeof a.second).toBe('number');
+                    expect(a.second >= 0 && a.second <=59).toBe(true);
+                    expect(a.millisecond).toBeDefined();
+                    expect(typeof a.millisecond).toBe('number');
+                }),
+                fail = jasmine.createSpy();
+
+            var win2 = function(a) {
+                navigator.globalization.stringToDate(a.value, win, fail, {formatLength: 'full', selector: 'date'});
+            };
+            runs(function () {
+                navigator.globalization.dateToString(new Date(), win2, fail, {formatLength: 'full', selector: 'date'});
+            });
+
+            waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
+
+            runs(function () {
+                expect(fail).not.toHaveBeenCalled();
+            });
+        });
+        it("globalization.spec.15 stringToDate using invalid date, error callback should be called with a GlobalizationError object", function() {
+            var win = jasmine.createSpy(),
+                fail = jasmine.createSpy().andCallFake(function(a) {
+                    expect(a).toBeDefined();
+                    expect(typeof a).toBe('object');
+                    expect(a.code).toBeDefined();
+                    expect(typeof a.code).toBe('number');
+                    expect(a.code === GlobalizationError.PARSING_ERROR).toBe(true);
+                    expect(a.message).toBeDefined();
+                    expect(typeof a.message).toBe('string');
+                    expect(a.message !== "").toBe(true);
+                });
+
+            runs(function () {
+                navigator.globalization.stringToDate('notADate', win, fail, {selector:'foobar'});
+            });
+
+            waitsFor(function () { return fail.wasCalled; }, "fail never called", Tests.TEST_TIMEOUT);
+
+            runs(function () {
+                expect(win).not.toHaveBeenCalled();
+            });
+        });
+    });
+
+    describe("getDatePattern", function() {
+        it("globalization.spec.1 should exist", function() {
+            expect(typeof navigator.globalization.getDatePattern).toBeDefined();
+            expect(typeof navigator.globalization.getDatePattern == 'function').toBe(true);
+        });
+        it("globalization.spec.17 getDatePattern using default options, success callback should be called with a Properties object", function() {
+            var win = jasmine.createSpy().andCallFake(function(a) {
+                    expect(a).toBeDefined();
+                    expect(typeof a).toBe('object');
+                    expect(a.pattern).toBeDefined();
+                    expect(typeof a.pattern).toBe('string');
+                    expect(a.pattern.length > 0).toBe(true);
+                    expect(a.timezone).toBeDefined();
+                    expect(typeof a.timezone).toBe('string');
+                    expect(a.timezone.length > 0).toBe(true);
+                    expect(a.utc_offset).toBeDefined();
+                    expect(typeof a.utc_offset).toBe('number');
+                    expect(a.dst_offset).toBeDefined();
+                    expect(typeof a.dst_offset).toBe('number');
+                }),
+                fail = jasmine.createSpy();
+
+            runs(function () {
+                navigator.globalization.getDatePattern(win, fail);
+            });
+
+            waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
+
+            runs(function () {
+                expect(fail).not.toHaveBeenCalled();
+            });
+        });
+        it("globalization.spec.18 getDatePattern using formatLength=medium and selector=date options, success callback should be called with a Properties object", function() {
+            var win = jasmine.createSpy().andCallFake(function(a) {
+                    expect(a).toBeDefined();
+                    expect(typeof a).toBe('object');
+                    expect(a.pattern).toBeDefined();
+                    expect(typeof a.pattern).toBe('string');
+                    expect(a.pattern.length > 0).toBe(true);
+                    expect(a.timezone).toBeDefined();
+                    expect(typeof a.timezone).toBe('string');
+                    expect(a.timezone.length > 0).toBe(true);
+                    expect(a.utc_offset).toBeDefined();
+                    expect(typeof a.utc_offset).toBe('number');
+                    expect(a.dst_offset).toBeDefined();
+                    expect(typeof a.dst_offset).toBe('number');
+                }),
+                fail = jasmine.createSpy();
+
+            runs(function () {
+                navigator.globalization.getDatePattern(win, fail, {formatLength: 'medium', selector: 'date'});
+            });
+
+            waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
+
+            runs(function () {
+                expect(fail).not.toHaveBeenCalled();
+            });
+        });
+    });    
+
+    describe("getDateNames", function() {
+        it("globalization.spec.1 should exist", function() {
+            expect(typeof navigator.globalization.getDateNames).toBeDefined();
+            expect(typeof navigator.globalization.getDateNames == 'function').toBe(true);
+        });
+        it("globalization.spec.20 getDateNames using default options, success callback should be called with a Properties object", function() {
+            var win = jasmine.createSpy().andCallFake(function(a) {
+                    expect(a).toBeDefined();
+                    expect(typeof a).toBe('object');
+                    expect(a.value).toBeDefined();
+                    expect(a.value instanceof Array).toBe(true);
+                    expect(a.value.length > 0).toBe(true);
+                    expect(typeof a.value[0]).toBe('string');
+                }),
+                fail = jasmine.createSpy();
+
+            runs(function () {
+                navigator.globalization.getDateNames(win, fail);
+            });
+
+            waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
+
+            runs(function () {
+                expect(fail).not.toHaveBeenCalled();
+            });
+        });
+        it("globalization.spec.21 getDateNames using type=narrow and item=days options, success callback should be called with a Properties object", function() {
+            var win = jasmine.createSpy().andCallFake(function(a) {
+                    expect(a).toBeDefined();
+                    expect(typeof a).toBe('object');
+                    expect(a.value).toBeDefined();
+                    expect(a.value instanceof Array).toBe(true);
+                    expect(a.value.length > 0).toBe(true);
+                    expect(typeof a.value[0]).toBe('string');
+                }),
+                fail = jasmine.createSpy();
+
+            runs(function () {
+                navigator.globalization.getDateNames(win, fail, {type: 'narrow', item: 'days'});
+            });
+
+            waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
+
+            runs(function () {
+                expect(fail).not.toHaveBeenCalled();
+            });
+        });
+        it("globalization.spec.22 getDateNames using type=narrow and item=months options, success callback should be called with a Properties object", function() {
+            var win = jasmine.createSpy().andCallFake(function(a) {
+                    expect(a).toBeDefined();
+                    expect(typeof a).toBe('object');
+                    expect(a.value).toBeDefined();
+                    expect(a.value instanceof Array).toBe(true);
+                    expect(a.value.length > 0).toBe(true);
+                    expect(typeof a.value[0]).toBe('string');
+                }),
+                fail = jasmine.createSpy();
+
+            runs(function () {
+                navigator.globalization.getDateNames(win, fail, {type: 'narrow', item: 'months'});
+            });
+
+            waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
+
+            runs(function () {
+                expect(fail).not.toHaveBeenCalled();
+            });
+        });
+        it("globalization.spec.23 getDateNames using type=wide and item=days options, success callback should be called with a Properties object", function() {
+            var win = jasmine.createSpy().andCallFake(function(a) {
+                    expect(a).toBeDefined();
+                    expect(typeof a).toBe('object');
+                    expect(a.value).toBeDefined();
+                    expect(a.value instanceof Array).toBe(true);
+                    expect(a.value.length > 0).toBe(true);
+                    expect(typeof a.value[0]).toBe('string');
+                }),
+                fail = jasmine.createSpy();
+
+            runs(function () {
+                navigator.globalization.getDateNames(win, fail, {type: 'wide', item: 'days'});
+            });
+
+            waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
+
+            runs(function () {
+                expect(fail).not.toHaveBeenCalled();
+            });
+        });
+        it("globalization.spec.24 getDateNames using type=wide and item=months options, success callback should be called with a Properties object", function() {
+            var win = jasmine.createSpy().andCallFake(function(a) {
+                    expect(a).toBeDefined();
+                    expect(typeof a).toBe('object');
+                    expect(a.value).toBeDefined();
+                    expect(a.value instanceof Array).toBe(true);
+                    expect(a.value.length > 0).toBe(true);
+                    expect(typeof a.value[0]).toBe('string');
+                }),
+                fail = jasmine.createSpy();
+
+            runs(function () {
+                navigator.globalization.getDateNames(win, fail, {type: 'wide', item: 'months'});
+            });
+
+            waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
+
+            runs(function () {
+                expect(fail).not.toHaveBeenCalled();
+            });
+        });
+    });
+    
+    describe("isDayLightSavingsTime", function() {
+        it("globalization.spec.1 should exist", function() {
+            expect(typeof navigator.globalization.isDayLightSavingsTime).toBeDefined();
+            expect(typeof navigator.globalization.isDayLightSavingsTime == 'function').toBe(true);
+        });
+        it("globalization.spec.26 isDayLightSavingsTime using default options, success callback should be called with a Properties object", function() {
+            var win = jasmine.createSpy().andCallFake(function(a) {
+                    expect(a).toBeDefined();
+                    expect(typeof a).toBe('object');
+                    expect(a.dst).toBeDefined();
+                    expect(typeof a.dst).toBe('boolean');
+                }),
+                fail = jasmine.createSpy();
+
+            runs(function () {
+                navigator.globalization.isDayLightSavingsTime(new Date(), win, fail);
+            });
+
+            waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
+
+            runs(function () {
+                expect(fail).not.toHaveBeenCalled();
+            });
+        });
+    });
+    
+    describe("getFirstDayOfWeek", function() {
+        it("globalization.spec.1 should exist", function() {
+            expect(typeof navigator.globalization.getFirstDayOfWeek).toBeDefined();
+            expect(typeof navigator.globalization.getFirstDayOfWeek == 'function').toBe(true);
+        });
+        it("globalization.spec.28 getFirstDayOfWeek success callback should be called with a Properties object", function() {
+            var win = jasmine.createSpy().andCallFake(function(a) {
+                    expect(a).toBeDefined();
+                    expect(typeof a).toBe('object');
+                    expect(a.value).toBeDefined();
+                    expect(typeof a.value).toBe('number');
+                }),
+                fail = jasmine.createSpy();
+
+            runs(function () {
+                navigator.globalization.getFirstDayOfWeek(win, fail);
+            });
+
+            waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
+
+            runs(function () {
+                expect(fail).not.toHaveBeenCalled();
+            });
+        });
+    });
+    
+    describe("numberToString", function() {
+        it("globalization.spec.1 should exist", function() {
+            expect(typeof navigator.globalization.numberToString).toBeDefined();
+            expect(typeof navigator.globalization.numberToString == 'function').toBe(true);
+        });
+        it("globalization.spec.30 numberToString using default options, should be called with a Properties object", function() {
+            var win = jasmine.createSpy().andCallFake(function(a) {
+                    expect(a).toBeDefined();
+                    expect(typeof a).toBe('object');
+                    expect(a.value).toBeDefined();
+                    expect(typeof a.value).toBe('string');
+                    expect(a.value.length > 0).toBe(true);
+                }),
+                fail = jasmine.createSpy();
+
+            runs(function () {
+                navigator.globalization.numberToString(3.25, win, fail);
+            });
+
+            waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
+
+            runs(function () {
+                expect(fail).not.toHaveBeenCalled();
+            });
+        });
+        it("globalization.spec.31 numberToString using type=percent options, should be called with a Properties object", function() {
+            var win = jasmine.createSpy().andCallFake(function(a) {
+                    expect(a).toBeDefined();
+                    expect(typeof a).toBe('object');
+                    expect(a.value).toBeDefined();
+                    expect(typeof a.value).toBe('string');
+                    expect(a.value.length > 0).toBe(true);
+                }),
+                fail = jasmine.createSpy();
+
+            runs(function () {
+                navigator.globalization.numberToString(.25, win, fail, {type: 'percent'});
+            });
+
+            waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
+
+            runs(function () {
+                expect(fail).not.toHaveBeenCalled();
+            });
+        });
+        it("globalization.spec.32 numberToString using type=currency options, should be called with a Properties object", function() {
+            var win = jasmine.createSpy().andCallFake(function(a) {
+                    expect(a).toBeDefined();
+                    expect(typeof a).toBe('object');
+                    expect(a.value).toBeDefined();
+                    expect(typeof a.value).toBe('string');
+                    expect(a.value.length > 0).toBe(true);
+                }),
+                fail = jasmine.createSpy();
+
+            runs(function () {
+                navigator.globalization.numberToString(5.20, win, fail, {type: 'currency'});
+            });
+
+            waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
+
+            runs(function () {
+                expect(fail).not.toHaveBeenCalled();
+            });
+        });
+    });
+    
+    describe("stringToNumber", function() {
+        it("globalization.spec.1 should exist", function() {
+            expect(typeof navigator.globalization.stringToNumber).toBeDefined();
+            expect(typeof navigator.globalization.stringToNumber == 'function').toBe(true);
+        });
+        it("globalization.spec.34 stringToNumber using default options, should be called with a Properties object", function() {
+            var win = jasmine.createSpy().andCallFake(function(a) {
+                    expect(a).toBeDefined();
+                    expect(typeof a).toBe('object');
+                    expect(a.value).toBeDefined();
+                    expect(typeof a.value).toBe('number');
+                    expect(a.value > 0).toBe(true);
+                }),
+                fail = jasmine.createSpy();
+
+            var win2 = function(a) {
+                navigator.globalization.stringToNumber(a.value, win, fail);
+            };
+            
+            runs(function () {
+                navigator.globalization.numberToString(3.25, win2, fail);
+            });
+
+            waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
+
+            runs(function () {
+                expect(fail).not.toHaveBeenCalled();
+            });
+        });
+        it("globalization.spec.35 stringToNumber using type=percent options, should be called with a Properties object", function() {
+            var win = jasmine.createSpy().andCallFake(function(a) {
+                    expect(a).toBeDefined();
+                    expect(typeof a).toBe('object');
+                    expect(a.value).toBeDefined();
+                    expect(typeof a.value).toBe('number');
+                    expect(a.value > 0).toBe(true);
+                }),
+                fail = jasmine.createSpy();
+
+            var win2 = function(a) {
+                navigator.globalization.stringToNumber(a.value, win, fail, {type: 'percent'});
+            };
+            
+            runs(function () {
+                navigator.globalization.numberToString(.25, win2, fail, {type: 'percent'});
+            });
+
+            waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
+
+            runs(function () {
+                expect(fail).not.toHaveBeenCalled();
+            });
+        });
+    });
+    
+    describe("getNumberPattern", function() {
+        it("globalization.spec.1 should exist", function() {
+            expect(typeof navigator.globalization.getNumberPattern).toBeDefined();
+            expect(typeof navigator.globalization.getNumberPattern == 'function').toBe(true);
+        });
+        it("globalization.spec.37 getNumberPattern using default options, success callback should be called with a Properties object", function() {
+            var win = jasmine.createSpy().andCallFake(function(a) {
+                    expect(a).toBeDefined();
+                    expect(typeof a).toBe('object');
+                    expect(a.pattern).toBeDefined();
+                    expect(typeof a.pattern).toBe('string');
+                    expect(a.pattern.length > 0).toBe(true);
+                    expect(typeof a.symbol).toBe('string');
+                    expect(typeof a.fraction).toBe('number');
+                    expect(typeof a.rounding).toBe('number');
+                    expect(a.positive).toBeDefined();
+                    expect(typeof a.positive).toBe('string');
+                    expect(a.positive.length >= 0).toBe(true);
+                    expect(a.negative).toBeDefined();
+                    expect(typeof a.negative).toBe('string');
+                    expect(a.negative.length >= 0).toBe(true);
+                    expect(a.decimal).toBeDefined();
+                    expect(typeof a.decimal).toBe('string');
+                    expect(a.decimal.length > 0).toBe(true);
+                    expect(a.grouping).toBeDefined();
+                    expect(typeof a.grouping).toBe('string');
+                    expect(a.grouping.length > 0).toBe(true);
+                }),
+                fail = jasmine.createSpy();
+
+            runs(function () {
+                navigator.globalization.getNumberPattern(win, fail);
+            });
+
+            waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
+
+            runs(function () {
+                expect(fail).not.toHaveBeenCalled();
+            });
+        });
+        it("globalization.spec.38 getNumberPattern using type=percent, success callback should be called with a Properties object", function() {
+            var win = jasmine.createSpy().andCallFake(function(a) {
+                    expect(a).toBeDefined();
+                    expect(typeof a).toBe('object');
+                    expect(a.pattern).toBeDefined();
+                    expect(typeof a.pattern).toBe('string');
+                    expect(a.pattern.length > 0).toBe(true);
+                    expect(typeof a.symbol).toBe('string');
+                    expect(typeof a.fraction).toBe('number');
+                    expect(typeof a.rounding).toBe('number');
+                    expect(a.positive).toBeDefined();
+                    expect(typeof a.positive).toBe('string');
+                    expect(a.positive.length >= 0).toBe(true);
+                    expect(a.negative).toBeDefined();
+                    expect(typeof a.negative).toBe('string');
+                    expect(a.negative.length >= 0).toBe(true);
+                    expect(a.decimal).toBeDefined();
+                    expect(typeof a.decimal).toBe('string');
+                    expect(a.decimal.length > 0).toBe(true);
+                    expect(a.grouping).toBeDefined();
+                    expect(typeof a.grouping).toBe('string');
+                    expect(a.grouping.length > 0).toBe(true);
+                }),
+                fail = jasmine.createSpy();
+
+            runs(function () {
+                navigator.globalization.getNumberPattern(win, fail, {type: 'percent'});
+            });
+
+            waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
+
+            runs(function () {
+                expect(fail).not.toHaveBeenCalled();
+            });
+        });
+        it("globalization.spec.39 getNumberPattern using type=currency, success callback should be called with a Properties object", function() {
+            var win = jasmine.createSpy().andCallFake(function(a) {
+                    expect(a).toBeDefined();
+                    expect(typeof a).toBe('object');
+                    expect(a.pattern).toBeDefined();
+                    expect(typeof a.pattern).toBe('string');
+                    expect(a.pattern.length > 0).toBe(true);
+                    expect(typeof a.symbol).toBe('string');
+                    expect(typeof a.fraction).toBe('number');
+                    expect(typeof a.rounding).toBe('number');
+                    expect(a.positive).toBeDefined();
+                    expect(typeof a.positive).toBe('string');
+                    expect(a.positive.length >= 0).toBe(true);
+                    expect(a.negative).toBeDefined();
+                    expect(typeof a.negative).toBe('string');
+                    expect(a.negative.length >= 0).toBe(true);
+                    expect(a.decimal).toBeDefined();
+                    expect(typeof a.decimal).toBe('string');
+                    expect(a.decimal.length > 0).toBe(true);
+                    expect(a.grouping).toBeDefined();
+                    expect(typeof a.grouping).toBe('string');
+                    expect(a.grouping.length > 0).toBe(true);
+                }),
+                fail = jasmine.createSpy();
+
+            runs(function () {
+                navigator.globalization.getNumberPattern(win, fail, {type: 'currency'});
+            });
+
+            waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
+
+            runs(function () {
+                expect(fail).not.toHaveBeenCalled();
+            });
+        });
+    });
+    
+    describe("getCurrencyPattern", function() {
+        it("globalization.spec.1 should exist", function() {
+            expect(typeof navigator.globalization.getCurrencyPattern).toBeDefined();
+            expect(typeof navigator.globalization.getCurrencyPattern == 'function').toBe(true);
+        });
+        it("globalization.spec.41 getCurrencyPattern using EUR for currency, success callback should be called with a Properties object", function() {
+            var win = jasmine.createSpy().andCallFake(function(a) {
+                    expect(a).toBeDefined();
+                    expect(typeof a).toBe('object');
+                    expect(a.pattern).toBeDefined();
+                    expect(typeof a.pattern).toBe('string');
+                    expect(a.pattern.length > 0).toBe(true);
+                    expect(a.code).toBeDefined();
+                    expect(typeof a.code).toBe('string');
+                    expect(a.code.length > 0).toBe(true);
+                    expect(typeof a.fraction).toBe('number');
+                    expect(typeof a.rounding).toBe('number');                   
+                    expect(a.decimal).toBeDefined();
+                    expect(typeof a.decimal).toBe('string');
+                    expect(a.decimal.length >= 0).toBe(true);                    
+                    expect(a.grouping).toBeDefined();
+                    expect(typeof a.grouping).toBe('string');
+                    expect(a.grouping.length >= 0).toBe(true);
+                }),
+                fail = jasmine.createSpy();
+
+            runs(function () {
+                navigator.globalization.getCurrencyPattern("EUR", win, fail);
+            });
+
+            waitsFor(function () { return win.wasCalled; }, "win never called", Tests.TEST_TIMEOUT);
+
+            runs(function () {
+                expect(fail).not.toHaveBeenCalled();
+            });
+        });
+    });
+});

http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/77ff9a37/www/autotest/tests/localXHR.tests.js
----------------------------------------------------------------------
diff --git a/www/autotest/tests/localXHR.tests.js b/www/autotest/tests/localXHR.tests.js
new file mode 100644
index 0000000..c50105d
--- /dev/null
+++ b/www/autotest/tests/localXHR.tests.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.
+ *
+*/
+
+describe("XMLHttpRequest", function () {
+
+    var createXHR = function (url, bAsync, win, lose) {
+        var xhr = new XMLHttpRequest();
+        xhr.open("GET", url, bAsync);
+        xhr.onload = win;
+        xhr.onerror = lose;
+        xhr.send();
+        return xhr;
+    }
+
+        it("XMLHttpRequest.spec.1 should exist", function () {
+            expect(window.XMLHttpRequest).toBeDefined();
+            expect(window.XMLHttpRequest.UNSENT).toBe(0);
+            expect(window.XMLHttpRequest.OPENED).toBe(1);
+            expect(window.XMLHttpRequest.HEADERS_RECEIVED).toBe(2);
+            expect(window.XMLHttpRequest.LOADING).toBe(3);
+            expect(window.XMLHttpRequest.DONE).toBe(4);
+        });
+
+        it("XMLHttpRequest.spec.2 should be able to create new XHR", function () {
+
+        	var xhr = new XMLHttpRequest();
+        	expect(xhr).toBeDefined();
+
+    // abort
+        	expect(xhr.abort).toBeDefined();
+        	expect(typeof xhr.abort == 'function').toBe(true);
+
+    // getResponseHeader
+        	expect(xhr.getResponseHeader).toBeDefined();
+        	expect(typeof xhr.getResponseHeader == 'function').toBe(true);
+
+    // getAllResponseHeaders
+        	expect(xhr.getAllResponseHeaders).toBeDefined();
+        	expect(typeof xhr.getAllResponseHeaders == 'function').toBe(true);
+
+    // overrideMimeType
+        	expect(xhr.overrideMimeType).toBeDefined();
+        	expect(typeof xhr.overrideMimeType == 'function').toBe(true);
+        	return;
+    // open
+        	expect(xhr.open).toBeDefined();
+        	expect(typeof xhr.open == 'function').toBe(true);
+    // send
+        	expect(xhr.send).toBeDefined();
+        	expect(typeof xhr.send == 'function').toBe(true);
+    // setRequestHeader
+        	expect(xhr.setRequestHeader).toBeDefined();
+        	expect(typeof xhr.setRequestHeader == 'function').toBe(true);
+        });
+
+        it("XMLHttpRequest.spec.2 should be able to load the current page", function () {
+            var win = jasmine.createSpy().andCallFake(function (res) {});
+            var lose = createDoNotCallSpy('xhrFail');
+            var xhr = createXHR("localXHR.html", true, win, lose);
+            waitsForAny(win, lose);
+
+        });
+
+        it("XMLHttpRequest.spec.9 calls onload from successful http get", function () {
+            var win = jasmine.createSpy().andCallFake(function (res) { });
+            var lose = createDoNotCallSpy('xhrFail');
+            var xhr = createXHR("http://cordova-filetransfer.jitsu.com", true, win, lose);
+            waitsForAny(win, lose);
+        });
+
+        it("XMLHttpRequest.spec.3 should be able to load the current page", function () {
+            var win = jasmine.createSpy().andCallFake(function (res) {});
+            var lose = createDoNotCallSpy('xhrFail');
+            var xhr = createXHR(window.location.href, true, win, lose);
+            waitsForAny(win, lose);
+        });
+
+        it("XMLHttpRequest.spec.4 should be able to load the parent folder page ../index.html", function () {
+            var win = jasmine.createSpy().andCallFake(function (res) {});
+            var lose = createDoNotCallSpy('xhrFail');
+            var xhr = createXHR("../index.html", true, win, lose);
+            waitsForAny(win, lose);
+        });
+
+        it("XMLHttpRequest.spec.5 should be able to load the current page ./???.html", function () {
+            var win = jasmine.createSpy().andCallFake(function (res) { });
+            var lose = createDoNotCallSpy('xhrFail');
+            var fileName = window.location.href.split('#')[0].split('/').pop();
+            var xhr = createXHR("./" + fileName, true, win, lose);
+            waitsForAny(win, lose);
+        });
+
+        it("XMLHttpRequest.spec.6 adds hash-path and loads file okay", function () {
+            window.location = window.location.href + "#asd/asd/asdasd";
+            var win = jasmine.createSpy().andCallFake(function (res) { });
+            var lose = createDoNotCallSpy('xhrFail');
+            var xhr = createXHR(window.location.href, true, win, lose);
+            waitsForAny(win, lose);
+        });
+
+    it("XMLHttpRequest.spec.10 overlapping async calls are not muxed", function () {
+
+        var order = "";
+
+        var winA = jasmine.createSpy("spyWinA").andCallFake(function(){
+            order += "A";  
+        });
+        var winB = jasmine.createSpy("spyWinB").andCallFake(function(){
+            order += "B";  
+        });
+        var lose = createDoNotCallSpy('xhrFail');
+        var fileName = window.location.href.split('#')[0].split('/').pop();
+        createXHR(fileName, true, winA, lose);
+        createXHR(fileName, false, winB, lose);
+
+        waitsFor(function () {
+            return lose.wasCalled ||
+                (winA.wasCalled && winB.wasCalled);
+        }, "Expecting both callbacks to be called.", Tests.TEST_TIMEOUT);
+
+        runs(function () {
+            expect(lose).not.toHaveBeenCalled();
+            expect(winA).toHaveBeenCalled();
+            expect(winB).toHaveBeenCalled();
+            console.log("order = " + order);
+        });
+    });
+
+
+});
+
+// only add these tests if we are testing on windows phone
+
+if (/Windows Phone/.exec(navigator.userAgent)) {
+
+    var createXHR = function (url, bAsync, win, lose) {
+        var xhr = new XMLHttpRequest();
+        xhr.open("GET", url, bAsync);
+        xhr.onload = win;
+        xhr.onerror = lose;
+        xhr.send();
+        return xhr;
+    }
+
+    describe("XMLHttpRequest Windows Phone", function () {
+
+        console.log("running special windows tests");
+        it("XMLHttpRequest.spec.7 should be able to load the (WP8 backwards compatability) root page www/index.html", function () {
+            var win = jasmine.createSpy().andCallFake(function (res) { });
+            var lose = createDoNotCallSpy('xhrFail');
+            var xhr = createXHR("www/index.html", true, win, lose);
+            waitsForAny(win, lose);
+        });
+
+        it("XMLHttpRequest.spec.8 should be able to load the (WP7 backwards compatability) root page app/www/index.html", function () {
+            var win = jasmine.createSpy().andCallFake(function (res) { });
+            var lose = createDoNotCallSpy('xhrFail');
+            var xhr = createXHR("app/www/index.html", true, win, lose);
+            waitsForAny(win, lose);
+        });
+
+        it("XMLHttpRequest.spec.11 should be able to load the current page using window.location with extra / [CB-6299]", function () {
+            var path = window.location.protocol + "/" + window.location.toString().substr(window.location.protocol.length);
+            var win = jasmine.createSpy().andCallFake(function (res) { });
+            var lose = createDoNotCallSpy('xhrFail');
+            var xhr = createXHR(path, true, win, lose);
+            waitsForAny(win, lose);
+        });
+
+    });
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/77ff9a37/www/autotest/tests/media.tests.js
----------------------------------------------------------------------
diff --git a/www/autotest/tests/media.tests.js b/www/autotest/tests/media.tests.js
new file mode 100644
index 0000000..393ca00
--- /dev/null
+++ b/www/autotest/tests/media.tests.js
@@ -0,0 +1,207 @@
+/*
+ *
+ * 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('Media', function () {
+	it("should exist", function() {
+        expect(Media).toBeDefined();
+		expect(typeof Media).toBe("function");
+	});
+
+    it("media.spec.1 should have the following properties", function() {
+        var media1 = new Media("dummy");
+        expect(media1.id).toBeDefined();
+        expect(media1.src).toBeDefined();
+        expect(media1._duration).toBeDefined();
+        expect(media1._position).toBeDefined();
+        media1.release();
+    });
+    
+    it("should define constants for Media status", function() {
+        expect(Media).toBeDefined();
+        expect(Media.MEDIA_NONE).toBe(0);
+        expect(Media.MEDIA_STARTING).toBe(1);
+		expect(Media.MEDIA_RUNNING).toBe(2);
+		expect(Media.MEDIA_PAUSED).toBe(3);
+		expect(Media.MEDIA_STOPPED).toBe(4);
+	});
+
+	it("should define constants for Media errors", function() {
+        expect(MediaError).toBeDefined();
+        expect(MediaError.MEDIA_ERR_NONE_ACTIVE).toBe(0);
+        expect(MediaError.MEDIA_ERR_ABORTED).toBe(1);
+		expect(MediaError.MEDIA_ERR_NETWORK).toBe(2);
+		expect(MediaError.MEDIA_ERR_DECODE).toBe(3);
+		expect(MediaError.MEDIA_ERR_NONE_SUPPORTED).toBe(4);
+	});
+
+    it("media.spec.2 should contain a play function", function() {
+        var media1 = new Media();
+        expect(media1.play).toBeDefined();
+        expect(typeof media1.play).toBe('function');
+        media1.release();
+    });
+
+    it("media.spec.3 should contain a stop function", function() {
+        var media1 = new Media();
+        expect(media1.stop).toBeDefined();
+        expect(typeof media1.stop).toBe('function');
+        media1.release();
+    });
+
+    it("media.spec.4 should contain a seekTo function", function() {
+        var media1 = new Media();
+        expect(media1.seekTo).toBeDefined();
+        expect(typeof media1.seekTo).toBe('function');
+        media1.release();
+    });
+
+    it("media.spec.5 should contain a pause function", function() {
+        var media1 = new Media();
+        expect(media1.pause).toBeDefined();
+        expect(typeof media1.pause).toBe('function');
+        media1.release();
+    });
+
+    it("media.spec.6 should contain a getDuration function", function() {
+        var media1 = new Media();
+        expect(media1.getDuration).toBeDefined();
+        expect(typeof media1.getDuration).toBe('function');
+        media1.release();
+    });
+
+    it("media.spec.7 should contain a getCurrentPosition function", function() {
+        var media1 = new Media();
+        expect(media1.getCurrentPosition).toBeDefined();
+        expect(typeof media1.getCurrentPosition).toBe('function');
+        media1.release();
+    });
+
+    it("media.spec.8 should contain a startRecord function", function() {
+        var media1 = new Media();
+        expect(media1.startRecord).toBeDefined();
+        expect(typeof media1.startRecord).toBe('function');
+        media1.release();
+    });
+
+    it("media.spec.9 should contain a stopRecord function", function() {
+        var media1 = new Media();
+        expect(media1.stopRecord).toBeDefined();
+        expect(typeof media1.stopRecord).toBe('function');
+        media1.release();
+    });
+
+    it("media.spec.10 should contain a release function", function() {
+        var media1 = new Media();
+        expect(media1.release).toBeDefined();
+        expect(typeof media1.release).toBe('function');
+        media1.release();
+    });
+
+    it("media.spec.11 should contain a setVolume function", function() {
+        var media1 = new Media();
+        expect(media1.setVolume).toBeDefined();
+        expect(typeof media1.setVolume).toBe('function');
+        media1.release();
+    });
+
+	it("should return MediaError for bad filename", function() {
+		var badMedia = null,
+            win = jasmine.createSpy(),
+            fail = jasmine.createSpy().andCallFake(function (result) {
+                expect(result).toBeDefined();
+                expect(result.code).toBe(MediaError.MEDIA_ERR_ABORTED);
+            });
+
+        //bb10 dialog pops up, preventing tests from running
+        if (cordova.platformId === 'blackberry10') {
+            return;
+        }
+            
+        runs(function () {
+            badMedia = new Media("invalid.file.name", win,fail);
+            badMedia.play();
+        });
+
+        waitsFor(function () { return fail.wasCalled; }, Tests.TEST_TIMEOUT);
+
+        runs(function () {
+            expect(win).not.toHaveBeenCalled();
+            badMedia.release();
+        });
+	});
+
+    it("media.spec.12 position should be set properly", function() {
+        var playcomplete = jasmine.createSpy();
+        var fail = jasmine.createSpy();
+        var mediaState=Media.MEDIA_STOPPED;
+        var statuschange= function(statusCode){
+            mediaState=statusCode;
+        };
+        var media1 = new Media("http://cordova.apache.org/downloads/BlueZedEx.mp3",playcomplete,fail,statuschange),
+            test = jasmine.createSpy().andCallFake(function(position) {
+                    console.log("position = " + position);
+                    expect(position).toBeGreaterThan(0.0);
+                    media1.stop()
+                    media1.release();
+                });
+
+        media1.play();
+
+        if (cordova.platformId !== 'blackberry10') {
+            waitsFor(function () { return mediaState==Media.MEDIA_RUNNING; }, 10000);
+        } else {
+            waits(5000);
+        }
+
+        // make sure we are at least one second into the file
+        waits(1000);
+        runs(function () {
+            expect(fail).not.toHaveBeenCalled();
+             // note that the file is about 60 seconds long and we kill the play almost immediately
+             // as a result, the playcomplete should not happen
+            expect(playcomplete).not.toHaveBeenCalled();
+            media1.getCurrentPosition(test, function () {});
+        });
+
+        waitsFor(function () { return test.wasCalled || fail.wasCalled; }, Tests.TEST_TIMEOUT);
+    });
+
+    it("media.spec.13 duration should be set properly", function() {
+
+        if (cordova.platformId === 'blackberry10') {
+            return;
+        }
+
+        var win = jasmine.createSpy();
+        var fail = jasmine.createSpy();
+        var mediaState=Media.MEDIA_STOPPED;
+        var statuschange= function(statusCode){
+            mediaState=statusCode;
+        };
+        var media1 = new Media("http://cordova.apache.org/downloads/BlueZedEx.mp3",win,fail,statuschange);
+        media1.play();
+        waitsFor(function () { return mediaState==Media.MEDIA_RUNNING; }, 10000);
+        runs(function () {
+            expect(media1.getDuration()).toBeGreaterThan(0.0);
+            expect(fail).not.toHaveBeenCalled();
+        });
+    });
+});

http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/77ff9a37/www/autotest/tests/network.tests.js
----------------------------------------------------------------------
diff --git a/www/autotest/tests/network.tests.js b/www/autotest/tests/network.tests.js
new file mode 100644
index 0000000..bf3a940
--- /dev/null
+++ b/www/autotest/tests/network.tests.js
@@ -0,0 +1,56 @@
+/*
+ *
+ * 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('Network (navigator.connection)', function () {
+    it("network.spec.1 should exist", function() {
+        expect(navigator.network && navigator.network.connection).toBeDefined();
+        expect(navigator.connection).toBeDefined();
+    });
+
+    it("network.spec.2 should be set to a valid value", function() {
+        var validValues = {
+            'unknown': 1,
+            'ethernet': 1,
+            'wifi': 1,
+            '2g': 1,
+            'cellular': 1,
+            '3g': 1,
+            '4g': 1,
+            'none': 1
+        };
+        expect(validValues[navigator.connection.type]).toBe(1);
+    });
+
+    it("network.spec.3 should have the same value in deprecated and non-deprecated apis", function() {
+        expect(navigator.network.connection.type).toBe(navigator.connection.type);
+    });
+
+    it("network.spec.4 should define constants for connection status", function() {
+        expect(Connection.UNKNOWN).toBe("unknown");
+        expect(Connection.ETHERNET).toBe("ethernet");
+        expect(Connection.WIFI).toBe("wifi");
+        expect(Connection.CELL_2G).toBe("2g");
+        expect(Connection.CELL_3G).toBe("3g");
+        expect(Connection.CELL_4G).toBe("4g");
+        expect(Connection.NONE).toBe("none");
+        expect(Connection.CELL).toBe("cellular");
+    });
+});

http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/77ff9a37/www/autotest/tests/notification.tests.js
----------------------------------------------------------------------
diff --git a/www/autotest/tests/notification.tests.js b/www/autotest/tests/notification.tests.js
new file mode 100644
index 0000000..016bcfb
--- /dev/null
+++ b/www/autotest/tests/notification.tests.js
@@ -0,0 +1,46 @@
+/*
+ *
+ * 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('Notification (navigator.notification)', function () {
+	it("should exist", function() {
+                expect(navigator.notification).toBeDefined();
+	});
+
+	it("should contain a beep function", function() {
+		expect(typeof navigator.notification.beep).toBeDefined();
+		expect(typeof navigator.notification.beep).toBe("function");
+	});
+
+	it("should contain an alert function", function() {
+		expect(typeof navigator.notification.alert).toBeDefined();
+		expect(typeof navigator.notification.alert).toBe("function");
+	});
+
+	it("should contain a confirm function", function() {
+		expect(typeof navigator.notification.confirm).toBeDefined();
+		expect(typeof navigator.notification.confirm).toBe("function");
+	});
+	
+	it("should contain a prompt function", function() {
+		expect(typeof navigator.notification.prompt).toBeDefined();
+		expect(typeof navigator.notification.prompt).toBe("function");
+	});
+});

http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/77ff9a37/www/autotest/tests/platform.tests.js
----------------------------------------------------------------------
diff --git a/www/autotest/tests/platform.tests.js b/www/autotest/tests/platform.tests.js
new file mode 100644
index 0000000..4a1c1a4
--- /dev/null
+++ b/www/autotest/tests/platform.tests.js
@@ -0,0 +1,31 @@
+/*
+ *
+ * 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('Platform (cordova)', function () {
+    it("platform.spec.1 should exist", function() {
+        expect(cordova).toBeDefined();
+    });
+
+    it("platform.spec.2 exec method should exist", function() {
+        expect(cordova.exec).toBeDefined();
+        expect(typeof cordova.exec).toBe('function');
+    });
+});

http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/77ff9a37/www/autotest/tests/splashscreen.tests.js
----------------------------------------------------------------------
diff --git a/www/autotest/tests/splashscreen.tests.js b/www/autotest/tests/splashscreen.tests.js
new file mode 100644
index 0000000..a57cb9f
--- /dev/null
+++ b/www/autotest/tests/splashscreen.tests.js
@@ -0,0 +1,36 @@
+/*
+ *
+ * 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('Splashscreen (cordova)', function () {
+    it("splashscreen.spec.1 should exist", function() {
+        expect(navigator.splashscreen).toBeDefined();
+    });
+
+    it("splashscreen.spec.2 exec method should exist", function() {
+        expect(navigator.splashscreen.show).toBeDefined();
+        expect(typeof navigator.splashscreen.show).toBe('function');
+    });
+    
+    it("splashscreen.spec.3 exec method should exist", function() {
+        expect(navigator.splashscreen.hide).toBeDefined();
+        expect(typeof navigator.splashscreen.hide).toBe('function');
+    });
+});

http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/77ff9a37/www/autotest/tests/storage.tests.js
----------------------------------------------------------------------
diff --git a/www/autotest/tests/storage.tests.js b/www/autotest/tests/storage.tests.js
new file mode 100644
index 0000000..4f4bd5b
--- /dev/null
+++ b/www/autotest/tests/storage.tests.js
@@ -0,0 +1,201 @@
+/*
+ *
+ * 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("Session Storage", function () {
+    it("storage.spec.1 should exist", function () {
+        expect(window.sessionStorage).toBeDefined();
+        expect(typeof window.sessionStorage.length).not.toBe('undefined');
+        expect(typeof(window.sessionStorage.key)).toBe('function');
+        expect(typeof(window.sessionStorage.getItem)).toBe('function');
+        expect(typeof(window.sessionStorage.setItem)).toBe('function');
+        expect(typeof(window.sessionStorage.removeItem)).toBe('function');
+        expect(typeof(window.sessionStorage.clear)).toBe('function');
+    });
+
+    it("storage.spec.2 check length", function () {
+        expect(window.sessionStorage.length).toBe(0);
+        window.sessionStorage.setItem("key","value");
+        expect(window.sessionStorage.length).toBe(1);
+        window.sessionStorage.removeItem("key");   
+        expect(window.sessionStorage.length).toBe(0);
+    });
+
+    it("storage.spec.3 check key", function () {
+        expect(window.sessionStorage.key(0)).toBe(null);
+        window.sessionStorage.setItem("test","value");
+        expect(window.sessionStorage.key(0)).toBe("test");
+        window.sessionStorage.removeItem("test");   
+        expect(window.sessionStorage.key(0)).toBe(null);
+    });
+
+    it("storage.spec.4 check getItem", function() {
+        expect(window.sessionStorage.getItem("item")).toBe(null);
+        window.sessionStorage.setItem("item","value");
+        expect(window.sessionStorage.getItem("item")).toBe("value");
+        window.sessionStorage.removeItem("item");   
+        expect(window.sessionStorage.getItem("item")).toBe(null);
+    });
+
+    it("storage.spec.5 check setItem", function() {
+        expect(window.sessionStorage.getItem("item")).toBe(null);
+        window.sessionStorage.setItem("item","value");
+        expect(window.sessionStorage.getItem("item")).toBe("value");
+        window.sessionStorage.setItem("item","newval");
+        expect(window.sessionStorage.getItem("item")).toBe("newval");
+        window.sessionStorage.removeItem("item");   
+        expect(window.sessionStorage.getItem("item")).toBe(null);
+    });
+
+    it("storage.spec.6 can remove an item", function () {
+        expect(window.sessionStorage.getItem("item")).toBe(null);
+        window.sessionStorage.setItem("item","value");
+        expect(window.sessionStorage.getItem("item")).toBe("value");
+        window.sessionStorage.removeItem("item");   
+        expect(window.sessionStorage.getItem("item")).toBe(null);
+    });
+
+    it("storage.spec.7 check clear", function() {
+        window.sessionStorage.setItem("item1","value");
+        window.sessionStorage.setItem("item2","value");
+        window.sessionStorage.setItem("item3","value");
+        expect(window.sessionStorage.length).toBe(3);
+        window.sessionStorage.clear();
+        expect(window.sessionStorage.length).toBe(0);
+    });
+
+    it("storage.spec.8 check dot notation", function() {
+        expect(window.sessionStorage.item).not.toBeDefined();
+        window.sessionStorage.item = "value";
+        expect(window.sessionStorage.item).toBe("value");
+        window.sessionStorage.removeItem("item");   
+        expect(window.sessionStorage.item).not.toBeDefined();
+    });
+
+    describe("Local Storage", function () {
+        it("storage.spec.9 should exist", function() {
+            expect(window.localStorage).toBeDefined();
+            expect(window.localStorage.length).toBeDefined();
+            expect(typeof window.localStorage.key).toBe("function");
+            expect(typeof window.localStorage.getItem).toBe("function");
+            expect(typeof window.localStorage.setItem).toBe("function");
+            expect(typeof window.localStorage.removeItem).toBe("function");
+            expect(typeof window.localStorage.clear).toBe("function");
+        });  
+
+        it("storage.spec.10 check length", function() {
+            expect(window.localStorage.length).toBe(0);
+            window.localStorage.setItem("key","value");
+            expect(window.localStorage.length).toBe(1);
+            window.localStorage.removeItem("key");   
+            expect(window.localStorage.length).toBe(0);
+        });
+
+        it("storage.spec.11 check key", function() {
+            expect(window.localStorage.key(0)).toBe(null);
+            window.localStorage.setItem("test","value");
+            expect(window.localStorage.key(0)).toBe("test");
+            window.localStorage.removeItem("test");   
+            expect(window.localStorage.key(0)).toBe(null);
+        });
+
+        it("storage.spec.4 check getItem", function() {
+            expect(window.localStorage.getItem("item")).toBe(null);
+            window.localStorage.setItem("item","value");
+            expect(window.localStorage.getItem("item")).toBe("value");
+            window.localStorage.removeItem("item");   
+            expect(window.localStorage.getItem("item")).toBe(null);
+        });
+
+        it("storage.spec.5 check setItem", function() {
+            expect(window.localStorage.getItem("item")).toBe(null);
+            window.localStorage.setItem("item","value");
+            expect(window.localStorage.getItem("item")).toBe("value");
+            window.localStorage.setItem("item","newval");
+            expect(window.localStorage.getItem("item")).toBe("newval");
+            window.localStorage.removeItem("item");   
+            expect(window.localStorage.getItem("item")).toBe(null);
+        });
+
+        it("storage.spec.14 check removeItem", function() {
+            expect(window.localStorage.getItem("item")).toBe(null);
+            window.localStorage.setItem("item","value");
+            expect(window.localStorage.getItem("item")).toBe("value");
+            window.localStorage.removeItem("item");   
+            expect(window.localStorage.getItem("item")).toBe(null);
+        });
+
+        it("storage.spec.7 check clear", function() {
+            expect(window.localStorage.getItem("item1")).toBe(null);
+            expect(window.localStorage.getItem("item2")).toBe(null);
+            expect(window.localStorage.getItem("item3")).toBe(null);
+            window.localStorage.setItem("item1","value");
+            window.localStorage.setItem("item2","value");
+            window.localStorage.setItem("item3","value");
+            expect(window.localStorage.getItem("item1")).toBe("value");
+            expect(window.localStorage.getItem("item2")).toBe("value");
+            expect(window.localStorage.getItem("item3")).toBe("value");
+            expect(window.localStorage.length).toBe(3);
+            window.localStorage.clear();
+            expect(window.localStorage.length).toBe(0);
+            expect(window.localStorage.getItem("item1")).toBe(null);
+            expect(window.localStorage.getItem("item2")).toBe(null);
+            expect(window.localStorage.getItem("item3")).toBe(null);
+        });
+
+        it("storage.spec.8 check dot notation", function() {
+            expect(window.localStorage.item).not.toBeDefined();
+            window.localStorage.item = "value";
+            expect(window.localStorage.item).toBe("value");
+            window.localStorage.removeItem("item");   
+            expect(window.localStorage.item).not.toBeDefined();
+        });
+    });
+
+    describe("HTML 5 Storage", function () {
+        it("storage.spec.9 should exist", function() {
+            expect(window.openDatabase);
+            
+        });
+        
+        it("storage.spec.17 should contain an openDatabase function", function() {
+            expect(window.openDatabase).toBeDefined();
+            expect(typeof window.openDatabase == 'function').toBe(true);
+        });
+
+        it("storage.spec.18 Should be able to create and drop tables", function() {
+            var win = jasmine.createSpy('win');
+            var fail1 = createDoNotCallSpy('fail1');
+            var fail2 = createDoNotCallSpy('fail2');
+            var db = openDatabase("Database", "1.0", "HTML5 Database API example", 5*1024*1024);
+            db.transaction(function(t) {
+                t.executeSql('CREATE TABLE IF NOT EXISTS foo(id int, name varchar(255));');
+                t.executeSql('CREATE TABLE IF NOT EXISTS foo2(id int, name varchar(255));');
+            }, fail1, step2);
+            function step2() {
+              db.transaction(function(t) {
+                  t.executeSql('DROP TABLE foo;');
+                  t.executeSql('DROP TABLE foo2');
+              }, fail2, win);
+            }
+            waitsForAny(win, fail1, fail2);
+        });
+    });
+});

http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/77ff9a37/www/autotest/tests/vibration.tests.js
----------------------------------------------------------------------
diff --git a/www/autotest/tests/vibration.tests.js b/www/autotest/tests/vibration.tests.js
new file mode 100644
index 0000000..18e75f2
--- /dev/null
+++ b/www/autotest/tests/vibration.tests.js
@@ -0,0 +1,31 @@
+/*
+ *
+ * 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('Vibration (navigator.notification.vibrate)', function () {
+	it("navigator.notification should exist", function() {
+                expect(navigator.notification).toBeDefined();
+	});
+
+	it("should contain a vibrate function", function() {
+		expect(typeof navigator.notification.vibrate).toBeDefined();
+		expect(typeof navigator.notification.vibrate).toBe("function");
+	});
+});

http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/77ff9a37/www/autotest/tests/whitelist.tests.js
----------------------------------------------------------------------
diff --git a/www/autotest/tests/whitelist.tests.js b/www/autotest/tests/whitelist.tests.js
new file mode 100644
index 0000000..fde24cc
--- /dev/null
+++ b/www/autotest/tests/whitelist.tests.js
@@ -0,0 +1,168 @@
+/*
+ *
+ * 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('Whitelist API (cordova.whitelist)', function () {
+	it("should exist", function() {
+        expect(cordova.whitelist).toBeDefined();
+	});
+
+    describe("Match function", function() {
+        function expectMatchWithResult(result) {
+            return (function(url, patterns, description) {
+                description = description || ((result ? "should accept " : "should reject ") + url + " for " + JSON.stringify(patterns));
+                it(description, function() {
+                    var cb = jasmine.createSpy();
+                    runs(function() {
+                        cordova.whitelist.match(url, patterns, cb);
+                    });
+                    waitsFor(function() { return cb.wasCalled; }, "success callback never called", Tests.TEST_TIMEOUT);
+                    runs(function() {
+                        expect(cb).toHaveBeenCalledWith(result);
+                    });
+                });
+            });
+        }
+
+        var itShouldMatch = expectMatchWithResult(true);
+        var itShouldNotMatch = expectMatchWithResult(false);
+
+        it("should exist", function() {
+            expect(cordova.whitelist.match).toBeDefined();
+            expect(typeof cordova.whitelist.match).toBe("function");
+        });
+
+        itShouldMatch('http://www.apache.org/',['*'], "should accept any domain for *");
+        itShouldNotMatch('http://www.apache.org/',[], "should not accept any domain for []");
+
+        itShouldMatch('http://apache.org/', ['http://*.apache.org']);
+        itShouldMatch('http://www.apache.org/', ['http://*.apache.org']);
+        itShouldMatch('http://www.apache.org/some/path', ['http://*.apache.org']);
+        itShouldMatch('http://some.domain.under.apache.org/', ['http://*.apache.org']);
+        itShouldMatch('http://user:pass@apache.org/', ['http://*.apache.org']);
+        itShouldMatch('http://user:pass@www.apache.org/', ['http://*.apache.org']);
+        itShouldMatch('http://www.apache.org/?some=params', ['http://*.apache.org']);
+        itShouldNotMatch('http://apache.com/', ['http://*.apache.org']);
+        itShouldNotMatch('http://www.evil.com/?url=www.apache.org', ['http://*.apache.org']);
+        itShouldNotMatch('http://www.evil.com/?url=http://www.apache.org', ['http://*.apache.org']);
+        itShouldNotMatch('http://www.evil.com/?url=http%3A%2F%2Fwww%2Eapache%2Eorg', ['http://*.apache.org']);
+        itShouldNotMatch('https://apache.org/', ['http://*.apache.org']);
+        itShouldNotMatch('http://www.apache.org:pass@evil.com/', ['http://*.apache.org']);
+        itShouldNotMatch('http://www.apache.org.evil.com/', ['http://*.apache.org']);
+
+        itShouldMatch('http://www.apache.org/',['http://*.apache.org','https://*.apache.org']);
+        itShouldMatch('https://www.apache.org/',['http://*.apache.org','https://*.apache.org']);
+        itShouldNotMatch('ftp://www.apache.org/',['http://*.apache.org','https://*.apache.org']);
+        itShouldNotMatch('http://www.apache.com/',['http://*.apache.org','https://*.apache.org']);
+
+        itShouldMatch('http://www.apache.org/',['http://www.apache.org']);
+        itShouldNotMatch('http://build.apache.org/',['http://www.apache.org']);
+        itShouldNotMatch('http://apache.org/',['http://www.apache.org']);
+
+        itShouldMatch('http://www.apache.org/', ['http://*/*']);
+        itShouldMatch('http://www.apache.org/foo/bar.html', ['http://*/*']);
+
+        itShouldMatch('http://www.apache.org/foo', ['http://*/foo*']);
+        itShouldMatch('http://www.apache.org/foo/bar.html', ['http://*/foo*']);
+        itShouldNotMatch('http://www.apache.org/', ['http://*/foo*']);
+
+        itShouldMatch('file:///foo', ['file:///*']);
+
+        itShouldMatch('file:///foo', ['file:///foo*']);
+        itShouldMatch('file:///foo/bar.html', ['file:///foo*']);
+        itShouldNotMatch('file:///etc/foo', ['file:///foo*']);
+        itShouldNotMatch('http://www.apache.org/foo', ['file:///foo*']);
+
+        itShouldMatch('http://www.apache.org/', ['*://www.apache.org/*']);
+        itShouldMatch('https://www.apache.org/', ['*://www.apache.org/*']);
+        itShouldMatch('ftp://www.apache.org/', ['*://www.apache.org/*']);
+        itShouldMatch('file://www.apache.org/', ['*://www.apache.org/*']);
+        itShouldMatch('content://www.apache.org/', ['*://www.apache.org/*']);
+        itShouldMatch('foo://www.apache.org/', ['*://www.apache.org/*']);
+        itShouldNotMatch('http://www.apache.com/', ['*://www.apache.org/*']);
+
+        itShouldMatch('http://www.apache.org/', ['*.apache.org']);
+        itShouldMatch('https://www.apache.org/', ['*.apache.org']);
+        itShouldNotMatch('ftp://www.apache.org/', ['*.apache.org']);
+
+        itShouldMatch('http://www.apache.org:81/', ['http://www.apache.org:81/*']);
+        itShouldMatch('http://user:pass@www.apache.org:81/foo/bar.html', ['http://www.apache.org:81/*']);
+        itShouldNotMatch('http://www.apache.org:80/', ['http://www.apache.org:81/*']);
+        itShouldNotMatch('http://www.apache.org/', ['http://www.apache.org:81/*']);
+        itShouldNotMatch('http://www.apache.org:foo/', ['http://www.apache.org:81/*']);
+        itShouldNotMatch('http://www.apache.org:81@www.apache.org/', ['http://www.apache.org:81/*']);
+        itShouldNotMatch('http://www.apache.org:81@www.evil.com/', ['http://www.apache.org:81/*']);
+
+        itShouldMatch('http://www.APAche.org/', ['*.apache.org']);
+        itShouldMatch('http://WWw.apache.org/', ['*.apache.org']);
+        itShouldMatch('http://www.apache.org/', ['*.APACHE.ORG']);
+        itShouldMatch('HTTP://www.apache.org/', ['*.apache.org']);
+        itShouldMatch('HTTP://www.apache.org/', ['http://*.apache.org']);
+        itShouldMatch('http://www.apache.org/', ['HTTP://*.apache.org']);
+
+        itShouldMatch('http://www.apache.org/foo/', ['*://*.apache.org/foo/*']);
+        itShouldMatch('http://www.apache.org/foo/bar', ['*://*.apache.org/foo/*']);
+        itShouldNotMatch('http://www.apache.org/bar/foo/', ['*://*.apache.org/foo/*']);
+        itShouldNotMatch('http://www.apache.org/Foo/', ['*://*.apache.org/foo/*']);
+        itShouldNotMatch('http://www.apache.org/Foo/bar', ['*://*.apache.org/foo/*']);
+
+    });
+
+    describe("Test function", function() {
+        function expectTestWithResult(result) {
+            return (function(url, description) {
+                description = description || ((result ? "should accept " : "should reject ") + url);
+                it(description, function() {
+                    var cb = jasmine.createSpy();
+                    runs(function() {
+                        cordova.whitelist.test(url, cb);
+                    });
+                    waitsFor(function() { return cb.wasCalled; }, "success callback never called", Tests.TEST_TIMEOUT);
+                    runs(function() {
+                        expect(cb).toHaveBeenCalledWith(result);
+                    });
+                });
+            });
+        }
+
+        var itShouldAccept = expectTestWithResult(true);
+        var itShouldReject = expectTestWithResult(false);
+
+        it("should exist", function() {
+            expect(cordova.whitelist.test).toBeDefined();
+            expect(typeof cordova.whitelist.test).toBe("function");
+        });
+
+        itShouldAccept('http://apache.org');
+        itShouldAccept('http://apache.org/');
+        itShouldAccept('http://www.apache.org/');
+        itShouldAccept('http://www.apache.org/some/path');
+        itShouldAccept('http://some.domain.under.apache.org/');
+        itShouldAccept('http://user:pass@apache.org/');
+        itShouldAccept('http://user:pass@www.apache.org/');
+        itShouldAccept('https://www.apache.org/');
+        itShouldReject('ftp://www.apache.org/');
+        itShouldReject('http://www.apache.com/');
+        itShouldReject('http://www.apache.org:pass@evil.com/');
+        itShouldReject('http://www.apache.org.evil.com/');
+        itShouldAccept('file:///foo');
+        itShouldAccept('content:///foo');
+    });
+});


Mime
View raw message