Updated Branches: refs/heads/master 376416a3c -> ab9ba6a0a
added missing test page, only run windows phone tests on windows phone Project: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/commit/fdf65681 Tree: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/tree/fdf65681 Diff: http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/diff/fdf65681 Branch: refs/heads/master Commit: fdf656813e7dbe61ca8c28e28aa69b1c66436980 Parents: 376416a Author: purplecabbage <[email protected]> Authored: Tue Aug 27 15:51:21 2013 -0700 Committer: purplecabbage <[email protected]> Committed: Tue Aug 27 15:51:21 2013 -0700 ---------------------------------------------------------------------- autotest/pages/localXHR.html | 70 +++++++++++++++++++++++++++++++++++ autotest/tests/localXHR.tests.js | 44 ++++++++++++++++------ 2 files changed, 102 insertions(+), 12 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/fdf65681/autotest/pages/localXHR.html ---------------------------------------------------------------------- diff --git a/autotest/pages/localXHR.html b/autotest/pages/localXHR.html new file mode 100644 index 0000000..2e64007 --- /dev/null +++ b/autotest/pages/localXHR.html @@ -0,0 +1,70 @@ +<!DOCTYPE html> +<!-- + + 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. + +--> + + +<html> +<head> + <title>Cordova: Local XHR Specs</title> + + <meta name="viewport" content="width=device-width, height=device-height, user-scalable=yes, initial-scale=1.0;" /> + + <!-- Load jasmine --> + <link href="../jasmine.css" rel="stylesheet"/> + <script type="text/javascript" src="../jasmine.js"></script> + <script type="text/javascript" src="../html/HtmlReporterHelpers.js"></script> + <script type="text/javascript" src="../html/HtmlReporter.js"></script> + <script type="text/javascript" src="../html/ReporterView.js"></script> + <script type="text/javascript" src="../html/SpecView.js"></script> + <script type="text/javascript" src="../html/SuiteView.js"></script> + <script type="text/javascript" src="../html/TrivialReporter.js"></script> + + <!-- Source --> + <script type="text/javascript" src="../../cordova-incl.js"></script> + + <!-- Load Test Runner --> + <script type="text/javascript" src="../test-runner.js"></script> + + <!-- Tests --> + <script type="text/javascript" src="../tests/localXHR.tests.js"></script> + + <script type="text/javascript"> + document.addEventListener('deviceready', function () { + var jasmineEnv = jasmine.getEnv(); + jasmineEnv.updateInterval = 1000; + + var htmlReporter = new jasmine.HtmlReporter(); + + jasmineEnv.addReporter(htmlReporter); + + jasmineEnv.specFilter = function (spec) { + return htmlReporter.specFilter(spec); + }; + + jasmineEnv.execute(); + }, false); + </script> +</head> + +<body> + <a href="javascript:" class="backBtn" onclick="backHome();">Back</a> +</body> +</html> http://git-wip-us.apache.org/repos/asf/cordova-mobile-spec/blob/fdf65681/autotest/tests/localXHR.tests.js ---------------------------------------------------------------------- diff --git a/autotest/tests/localXHR.tests.js b/autotest/tests/localXHR.tests.js index 3713603..e0bab1e 100644 --- a/autotest/tests/localXHR.tests.js +++ b/autotest/tests/localXHR.tests.js @@ -93,17 +93,37 @@ describe("XMLHttpRequest", function () { waitsForAny(win, lose); }); - it("XMLHttpRequest.spec.5 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.6 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); +}); + +// 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.5 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.6 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); + }); }); -}); \ No newline at end of file +} \ No newline at end of file
