Modify paths of web resources to work with test resources more buried.
This commit is contained in:
parent
2454354b59
commit
2793532599
@ -1,6 +1,6 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"name":"Firefox 5",
|
"name":"firefox5",
|
||||||
"path":"/Applications/Firefox.app",
|
"path":"/Applications/Firefox.app",
|
||||||
"type":"firefox"
|
"type":"firefox"
|
||||||
}
|
}
|
||||||
|
18
test/test.py
18
test/test.py
@ -5,6 +5,9 @@ from urlparse import urlparse
|
|||||||
|
|
||||||
USAGE_EXAMPLE = "%prog"
|
USAGE_EXAMPLE = "%prog"
|
||||||
|
|
||||||
|
# The local web server uses the git repo as the document root.
|
||||||
|
DOC_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__),".."))
|
||||||
|
|
||||||
ANAL = True
|
ANAL = True
|
||||||
DEFAULT_MANIFEST_FILE = 'test_manifest.json'
|
DEFAULT_MANIFEST_FILE = 'test_manifest.json'
|
||||||
DEFAULT_BROWSER_MANIFEST_FILE = 'browser_manifest.json'
|
DEFAULT_BROWSER_MANIFEST_FILE = 'browser_manifest.json'
|
||||||
@ -73,15 +76,14 @@ class PDFTestHandler(BaseHTTPRequestHandler):
|
|||||||
|
|
||||||
def do_GET(self):
|
def do_GET(self):
|
||||||
url = urlparse(self.path)
|
url = urlparse(self.path)
|
||||||
|
print "GET",url
|
||||||
# Ignore query string
|
# Ignore query string
|
||||||
path, _ = url.path, url.query
|
path, _ = url.path, url.query
|
||||||
cwd = os.getcwd()
|
path = os.path.abspath(os.path.realpath(DOC_ROOT + os.sep + path))
|
||||||
path = os.path.abspath(os.path.realpath(cwd + os.sep + path))
|
prefix = os.path.commonprefix(( path, DOC_ROOT ))
|
||||||
cwd = os.path.abspath(cwd)
|
|
||||||
prefix = os.path.commonprefix(( path, cwd ))
|
|
||||||
_, ext = os.path.splitext(path)
|
_, ext = os.path.splitext(path)
|
||||||
|
|
||||||
if not (prefix == cwd
|
if not (prefix == DOC_ROOT
|
||||||
and os.path.isfile(path)
|
and os.path.isfile(path)
|
||||||
and ext in MIMEs):
|
and ext in MIMEs):
|
||||||
self.send_error(404)
|
self.send_error(404)
|
||||||
@ -146,7 +148,7 @@ def makeBrowserCommands(browserManifestFile):
|
|||||||
|
|
||||||
def setUp(options):
|
def setUp(options):
|
||||||
# Only serve files from a pdf.js clone
|
# Only serve files from a pdf.js clone
|
||||||
assert not ANAL or os.path.isfile('pdf.js') and os.path.isdir('.git')
|
assert not ANAL or os.path.isfile('../pdf.js') and os.path.isdir('../.git')
|
||||||
|
|
||||||
State.masterMode = options.masterMode
|
State.masterMode = options.masterMode
|
||||||
if options.masterMode and os.path.isdir(TMPDIR):
|
if options.masterMode and os.path.isdir(TMPDIR):
|
||||||
@ -191,13 +193,11 @@ def setUp(options):
|
|||||||
|
|
||||||
State.remaining = len(manifestList)
|
State.remaining = len(manifestList)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for b in testBrowsers:
|
for b in testBrowsers:
|
||||||
print 'Launching', b.name
|
print 'Launching', b.name
|
||||||
qs = 'browser='+ urllib.quote(b.name) +'&manifestFile='+ urllib.quote(options.manifestFile)
|
qs = 'browser='+ urllib.quote(b.name) +'&manifestFile='+ urllib.quote(options.manifestFile)
|
||||||
subprocess.Popen(( os.path.abspath(os.path.realpath(b.path)),
|
subprocess.Popen(( os.path.abspath(os.path.realpath(b.path)),
|
||||||
'http://localhost:8080/test_slave.html?'+ qs))
|
'http://localhost:8080/test/test_slave.html?'+ qs))
|
||||||
|
|
||||||
|
|
||||||
def check(task, results, browser):
|
def check(task, results, browser):
|
||||||
|
@ -1,21 +1,21 @@
|
|||||||
[
|
[
|
||||||
{ "id": "tracemonkey-eq",
|
{ "id": "tracemonkey-eq",
|
||||||
"file": "tests/tracemonkey.pdf",
|
"file": "pdfs/tracemonkey.pdf",
|
||||||
"rounds": 1,
|
"rounds": 1,
|
||||||
"type": "eq"
|
"type": "eq"
|
||||||
},
|
},
|
||||||
{ "id": "tracemonkey-fbf",
|
{ "id": "tracemonkey-fbf",
|
||||||
"file": "tests/tracemonkey.pdf",
|
"file": "pdfs/tracemonkey.pdf",
|
||||||
"rounds": 2,
|
"rounds": 2,
|
||||||
"type": "fbf"
|
"type": "fbf"
|
||||||
},
|
},
|
||||||
{ "id": "html5-canvas-cheat-sheet-load",
|
{ "id": "html5-canvas-cheat-sheet-load",
|
||||||
"file": "tests/canvas.pdf",
|
"file": "pdfs/canvas.pdf",
|
||||||
"rounds": 1,
|
"rounds": 1,
|
||||||
"type": "load"
|
"type": "load"
|
||||||
},
|
},
|
||||||
{ "id": "pdfspec-load",
|
{ "id": "pdfspec-load",
|
||||||
"file": "tests/pdf.pdf",
|
"file": "pdfs/pdf.pdf",
|
||||||
"link": true,
|
"link": true,
|
||||||
"rounds": 1,
|
"rounds": 1,
|
||||||
"type": "load"
|
"type": "load"
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>pdf.js test slave</title>
|
<title>pdf.js test slave</title>
|
||||||
<script type="text/javascript" src="pdf.js"></script>
|
<script type="text/javascript" src="/pdf.js"></script>
|
||||||
<script type="text/javascript" src="fonts.js"></script>
|
<script type="text/javascript" src="/fonts.js"></script>
|
||||||
<script type="text/javascript" src="glyphlist.js"></script>
|
<script type="text/javascript" src="/glyphlist.js"></script>
|
||||||
<script type="application/javascript">
|
<script type="application/javascript">
|
||||||
var browser, canvas, currentTask, currentTaskIdx, failure, manifest, pdfDoc, stdout;
|
var browser, canvas, currentTask, currentTaskIdx, failure, manifest, pdfDoc, stdout;
|
||||||
|
|
||||||
@ -137,7 +137,7 @@ function sendTaskResult(snapshot) {
|
|||||||
|
|
||||||
var r = new XMLHttpRequest();
|
var r = new XMLHttpRequest();
|
||||||
// (The POST URI is ignored atm.)
|
// (The POST URI is ignored atm.)
|
||||||
r.open("POST", "submit_task_results", false);
|
r.open("POST", "/submit_task_results", false);
|
||||||
r.setRequestHeader("Content-Type", "application/json");
|
r.setRequestHeader("Content-Type", "application/json");
|
||||||
// XXX async
|
// XXX async
|
||||||
r.send(JSON.stringify(result));
|
r.send(JSON.stringify(result));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user