Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run respec2html on example files in test suite #553

Merged
merged 4 commits into from Jan 12, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 8 additions & 8 deletions examples/getusermedia.html
Expand Up @@ -118,7 +118,7 @@ <h2>Terminology</h2>
the track is ended for any reason.</p>

<p>On the <code><a>MediaStreamTrack</a></code> object,
sources are represented by a <code><a>sourceType</a></code>
sources are represented by a <code>sourceType</code>
attribute. The behavior of APIs associated with the source's
capabilities and state change depending on the source
type.</p>
Expand All @@ -132,7 +132,7 @@ <h2>Terminology</h2>
the same answer).</p>
</dd>

<dt><dfn title="state">State (Source State)</dfn></dt>
<dt><dfn data-lt="state">State (Source State)</dfn></dt>
<dd>
<p>State refers to the immediate, current value of the
source's (optionally constrained) capabilities. State is
Expand All @@ -155,7 +155,7 @@ <h2>Terminology</h2>
defined in this spec.</p>
</dd>

<dt><dfn title="capabilities"
<dt><dfn
id="dfn-capabilities">Capabilities</dfn></dt>
<dd>
<p>Source capabilities are the intrinsic "features" of a
Expand All @@ -178,7 +178,7 @@ <h2>Terminology</h2>
session.</p>
</dd>

<dt><dfn title="constraints"
<dt><dfn
id="dfn-constraints">Constraints</dfn></dt>

<dd>
Expand Down Expand Up @@ -541,7 +541,7 @@ <h3>Interface Definition</h3>

<li>
<p>If <var>track</var> has no source attached
(<code><a>sourceType</a></code> is "none") or if the source is
(<code>sourceType</code> is "none") or if the source is
provided by an <code>RTCPeerConnection</code>, then abort these
steps.</p>
</li>
Expand Down Expand Up @@ -600,7 +600,7 @@ <h3>Interface Definition</h3>
track). Once a track enters this state, it never exits it.</p>

<p>For example, a video track in a
<code><a>MediaStream</a></code> ends if the user unplugs the
<code>MediaStream</code> ends if the user unplugs the
USB web camera that acts as the track's media source.</p>
</dd>
</dl>
Expand All @@ -620,13 +620,13 @@ <h2>Track Source Types</h2>
<dt>camera</dt>

<dd>A valid source type only for
<code><a>VideoStreamTrack</a></code>s. The source is a local
<code>VideoStreamTrack</code>s. The source is a local
video-producing camera source.</dd>

<dt>microphone</dt>

<dd>A valid source type only for
<code><a>AudioStreamTrack</a></code>s. The source is a local
<code>AudioStreamTrack</code>s. The source is a local
audio-producing microphone source.</dd>

</dl>
Expand Down
5 changes: 0 additions & 5 deletions examples/getusermedia.js
Expand Up @@ -27,11 +27,6 @@ var respecConfig = {
// if this is a LCWD, uncomment and set the end of its review period
// lcEnd: "2009-08-05",

// if you want to have extra CSS, append them to this list
// it is recommended that the respec.css stylesheet be kept
extraCSS: ["http://dev.w3.org/2009/dap/ReSpec.js/css/respec.css"],
//extraCSS: ["../../../2009/dap/ReSpec.js/css/respec.css"],

// editors, add as many as you like
// only "name" is required
editors: [
Expand Down
4 changes: 3 additions & 1 deletion examples/prtest.html
Expand Up @@ -21,7 +21,9 @@
, publishDate: "2013-01-17"
, prEnd: "2013-02-18"
, lcEnd: "2012-12-15"
, implReport: "http://www.fjhirsch.com/"
, previousPublishDate: "2013-01-15"
, previousMaturity: "CR"
, implementationReportURI: "http://www.fjhirsch.com/"
};
</script>
</head>
Expand Down
13 changes: 6 additions & 7 deletions examples/webidl-contiguous.html
Expand Up @@ -34,7 +34,7 @@
attribute DOMString attr;
};
</pre>
<p link-for="Foo">The <dfn data-lt="Foo.attr">attr</dfn> attribute's getter must...</p>
<p link-for="Foo">The <dfn data-for="Foo">attr</dfn> attribute's getter must...</p>
<section>
<h2>Introduction</h2>

Expand Down Expand Up @@ -99,13 +99,12 @@ <h2>Introduction</h2>
and/or <code>title</code> attributes directly on the <code>&lt;dfn></code> or
<code>&lt;a></code> tag, similarly to when
<a href="../guide.html#definitions-and-linking">defining or
linking to a non-IDL term</a>. The <dfn for="Dahut" title="turnAround">
linking to a non-IDL term</a>. The <dfn for="Dahut">
<code>turnAround</code> member of the <code>Dahut</code> interface</dfn> can
be defined with <code>&lt;dfn for="Dahut"
title="turnAround">&lt;code>turnAround&lt;/code> member of the
be defined with <code>&lt;dfn for="Dahut">&lt;code>turnAround&lt;/code> member of the
&lt;code>Dahut&lt;/code> interface&lt;/dfn></code>. We can also link to
<a for="Dahut" title="LEVROGYROUS">some constant</a> with
<code>&lt;a for="Dahut" title="LEVROGYROUS">some constant&lt;/a></code>.
<a for="Dahut" data-lt="LEVROGYROUS">some constant</a> with
<code>&lt;a for="Dahut" data-lt="LEVROGYROUS">some constant&lt;/a></code>.
</p>
</section>
<section>
Expand Down Expand Up @@ -253,7 +252,7 @@ <h2>Constants</h2>
};
</pre>
<p id="const-basic-doc">
<dfn for="ConstTest">rambaldi</dfn> is a constant and so are <dfn for="ConstTest">why</dfn> and <dfn for="ConstTest" title="inf">this other thing</dfn>.
<dfn for="ConstTest">rambaldi</dfn> is a constant and so are <dfn for="ConstTest">why</dfn> and <dfn for="ConstTest" data-lt="inf">this other thing</dfn>.
</p>
</section>
<section>
Expand Down
50 changes: 47 additions & 3 deletions tests/headless.js
Expand Up @@ -14,27 +14,71 @@ var app = express();
app.use(express.static(dir));
app.listen(PORT);

var counter = 0;

function done() {
counter--;
if (!counter) {
process.exit(0);
}
}

function runPhantom () {
if (process.env.TRACE) {
console.log("PhantomJS version:");
var childProcess = exec('phantomjs -v', function () {});
childProcess.stdout.pipe(process.stdout);
childProcess.stderr.pipe(process.stderr);
}
var childProcess = exec('phantomjs --ssl-protocol=any --ignore-ssl-errors=yes ./tests/phantom.js ' + (process.argv.slice(2).join(" ")), function () {});
counter++;
var childProcess = exec('phantomjs --ssl-protocol=tlsv1 ./tests/phantom.js ' + (process.argv.slice(2).join(" ")), function () {});
childProcess.stdout.pipe(process.stdout);
childProcess.stderr.pipe(process.stderr);
childProcess.on('exit', function (code) {
process.exit(code);
childProcess.on('exit', function(code) {
if (code > 0) {
process.exit(code);
}
done();
});
}

function buildFailureReporter(source) {
return function(code) {
if (code > 0) {
console.error("Running respec2html on " + source + " failed");
process.exit(code);
} else {
console.log("Success building " + source);
}
done();
}
}

function runRespec2html () {
var fs = require("fs");
// Run respec2html.js on each example file (except "embedder.html")
// and stops in error if any of them reports a warning or an error
var sources = fs.readdirSync("examples").filter(function(n) { return n.match(/\.html$/) && n !== "embedder.html" ;});
sources.forEach(function(s) {
// We use --delay 1 since the examples use the non-compiled version
// of respec, which takes a bit longer to load
var cmd = 'phantomjs --ssl-protocol=tlsv1 ./tools/respec2html.js --delay 1 -w -e examples/' + s;
console.log("Running " + cmd);
counter++;
var childProcess = exec(cmd, function () {});
childProcess.stderr.pipe(process.stderr);
childProcess.on('exit', buildFailureReporter(s));
});
}

if (!process.env.TRAVIS) {
builder.buildW3C(false, function () {
console.log("Script built");
runPhantom();
runRespec2html();
});
}
else {
runPhantom();
runRespec2html();
}
8 changes: 7 additions & 1 deletion tools/respec2html.js
Expand Up @@ -13,6 +13,7 @@ var page = require("webpage").create()
, ignoreScripts = false
, errors = []
, warnings = []
, delay = 0
;

// report console.error on stderr
Expand All @@ -31,6 +32,10 @@ if (args.indexOf("-w") !== -1) {
reportWarnings = true;
}

if (args.indexOf("--delay") !== -1) {
delay = args.splice(args.indexOf("--delay"), 2)[1];
}

if (args.indexOf("--exclude-script") !== -1) {
var idx = args.indexOf("--exclude-script");
var values = args.splice(idx, 2);
Expand Down Expand Up @@ -83,7 +88,7 @@ page.open(source, function (status) {
}
else {
console.error("Loading " + source);
page.evaluateAsync(function () {
setTimeout(function() { page.evaluateAsync(function () {
$.ajaxSetup({timeout: 4000});
function saveToPhantom () {
require(["core/ui", "ui/save-html"], function (ui, saver) {
Expand All @@ -93,6 +98,7 @@ page.open(source, function (status) {
}
if (document.respecDone) saveToPhantom();
else respecEvents.sub("end-all", saveToPhantom);
}, delay*1000);
});
timer = setInterval(function () {
if (timeout === 0) {
Expand Down