2 <!-- This Source Code Form is subject to the terms of the Mozilla Public
3 - License, v. 2.0. If a copy of the MPL was not distributed with this
4 - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
5 <?xml-stylesheet href=
"chrome://mochikit/content/tests/SimpleTest/test.css"
7 <window title=
"Test chrome harness functions"
8 xmlns=
"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
9 <script src=
"chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
10 <script src=
"chrome://mochikit/content/chrome-harness.js"></script>
11 <script type=
"application/javascript">
13 add_task(async function test() {
14 SimpleTest.doesThrow(function () {
15 getTestFilePath(
"/test_chromeGetTestFile.xhtml")
16 },
"getTestFilePath rejects absolute paths");
19 IOUtils.exists(getTestFilePath(
"test_chromeGetTestFile.xhtml"))
20 .then(function (exists) {
21 ok(exists,
"getTestFilePath consider the path as being relative");
24 IOUtils.exists(getTestFilePath(
"./test_chromeGetTestFile.xhtml"))
25 .then(function (exists) {
26 ok(exists,
"getTestFilePath also accepts explicit relative path");
29 IOUtils.exists(getTestFilePath(
"./test_chromeGetTestFileTypo.xhtml"))
30 .then(function (exists) {
31 ok(!exists,
"getTestFilePath do not throw if the file doesn't exists");
34 IOUtils.readUTF8(getTestFilePath(
"test-dir/test-file"))
35 .then(function (content) {
36 is(content,
"foo\n",
"getTestFilePath can reach sub-folder files 1/2");
39 IOUtils.readUTF8(getTestFilePath(
"./test-dir/test-file"))
40 .then(function (content) {
41 is(content,
"foo\n",
"getTestFilePath can reach sub-folder files 2/2");