Skip to content
Permalink
Browse files
added missing test page, only run windows phone tests on windows phone
  • Loading branch information
purplecabbage committed Aug 27, 2013
1 parent 376416a commit fdf656813e7dbe61ca8c28e28aa69b1c66436980
Show file tree
Hide file tree
Showing 2 changed files with 102 additions and 12 deletions.
@@ -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>
@@ -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);
});
});
});
}

0 comments on commit fdf6568

Please sign in to comment.