Reviewers: felix8a,
Description:
* Added support for URL templates to 'bare' and 'driver' URLs.
* Fixed single-string catalog comments being discarded.
* Fixed some explicitly defined groups being incorrectly presented as
mini groups.
* apitaming-tests.json did not flag its tests as manual.
* apitaming-tests.json is less repetitive and has correctly formatted
labels.
Please review this at https://codereview.appspot.com/10883044/
Affected files:
M tests/com/google/caja/plugin/apitaming-tests.json
M tests/com/google/caja/plugin/catalog-parser.js
Index: tests/com/google/caja/plugin/apitaming-tests.json
===================================================================
--- tests/com/google/caja/plugin/apitaming-tests.json (revision 5469)
+++ tests/com/google/caja/plugin/apitaming-tests.json (working copy)
@@ -2,32 +2,27 @@
{
"label": "apitaming",
"mode": "none",
- "tests":
- [
- {
- "bare":
"../apitaming/tests-index.html?testsList=maps-list.json&cajaServer=/caja",
- "label": "API taming Maps individual list"
- },
- {
- "bare":
"../apitaming/tests-index.html?testsList=picker-list.json&cajaServer=/caja",
- "label": "API taming Picker individual list"
- },
- {
- "bare":
"../apitaming/tests-index.html?testsList=visualization-list.json&cajaServer=/caja",
- "label": "API taming GViz individual list"
- },
- {
- "bare":
"../apitaming/tests-side-by-side.html?testsList=maps-list.json&cajaServer=/caja",
- "label": "API taming Maps all (large/slow page)"
- },
- {
- "bare":
"../apitaming/tests-side-by-side.html?testsList=picker-list.json&cajaServer=/caja",
- "label": "API taming Picker all (large/slow page)"
- },
- {
- "bare":
"../apitaming/tests-side-by-side.html?testsList=visualization-list.json&cajaServer=/caja",
- "label": "API taming GViz all (large/slow page)"
- }
- ]
+ "manual": true,
+ "tests": [
+ {
+ "label": "individual",
+ "bare-template":
"../apitaming/tests-index.html?testsList=*-list.json&cajaServer=/caja",
+ "tests": [
+ { "bare": "maps" },
+ { "bare": "picker" },
+ { "bare": "visualization" }
+ ]
+ },
+ {
+ "label": "all",
+ "comment": "large/slow page",
+ "bare-template":
"../apitaming/tests-side-by-side.html?testsList=*-list.json&cajaServer=/caja",
+ "tests": [
+ { "bare": "maps" },
+ { "bare": "picker" },
+ { "bare": "visualization" }
+ ]
+ }
+ ]
}
]
Index: tests/com/google/caja/plugin/catalog-parser.js
===================================================================
--- tests/com/google/caja/plugin/catalog-parser.js (revision 5469)
+++ tests/com/google/caja/plugin/catalog-parser.js (working copy)
@@ -35,18 +35,24 @@
* <dt>bare
* <dd>The document to load. Defaults to 'browser-test-case.html'.
*
+ * <dt>bare-template
+ * <dd>If 'bare-template' is present, the 'bare' field is transformed by
+ * substituting it in place of all '*' characters in the 'bare-template'.
This
+ * is mainly useful when inherited.
+ *
* <dt>driver
* <dd>The test driver to load, when applicable; corresponds to URL
parameter
- * 'test-driver'(see browser-test-case.js).
+ * 'test-driver' (see browser-test-case.js).
*
+ * <dt>driver-template
+ * <dd>Template for 'driver' URL in the same format as 'bare-template'.
+ *
* <dt>guest
* <dd>The guest content to load, when applicable; corresponds to URL
parameter
* 'test-case' (see browser-test-case.js).
*
* <dt>guest-template
- * <dd>If 'guest-template' is present, the 'guest' field is transformed by
- * substituting it in place of all '*' characters in the 'guest-template'.
This
- * is mainly useful when inherited.
+ * <dd>Template for 'guest' URL in the same format as 'bare-template'.
*
* <dt>params
* <dd>A record containing additional URL parameters (will be escaped).
This
@@ -151,25 +157,25 @@
function onlyVariesMode(record) {
if ('params' in record || 'guest' in record || 'driver' in record ||
- 'bare' in record) {
+ 'bare' in record || 'tests' in record) {
return false;
}
return true;
}
- function calcGuestURL(record) {
- var guest = record.guest;
- if ('guest-template' in record) {
- guest = record['guest-template'].replace(/\*/g, guest);
+ function deriveURL(record, name) {
+ var url = record[name];
+ if ((name + '-template') in record) {
+ url = record[name + '-template'].replace(/\*/g, url);
}
- return guest;
+ return url;
}
function addPossibleUncajoled(record) {
// TODO(kpreid): Using this as a proxy for 'this is a third-party test'
if ('expected-pass' in record && 'guest' in record) {
record.tests.push({
- 'bare': calcGuestURL(record),
+ 'bare': deriveURL(record, 'guest'),
'label': 'uncajoled',
'manual': true,
'params': {
@@ -226,7 +232,10 @@
validateKeys(longLabel, record, [
'label', 'comment', 'tests',
- 'bare', 'driver', 'guest', 'guest-template', 'params',
+ 'bare', 'bare-template',
+ 'driver', 'driver-template',
+ 'guest', 'guest-template',
+ 'params',
'mode', 'minified', 'expected-pass',
'manual', 'disabled', 'failureIsAnOption',
'_mini']);
@@ -253,7 +262,7 @@
// format comment
var comment = (merged.comment || {}) instanceof Array
? merged.comment.join('\n')
- : '';
+ : merged.comment || '';
// Split leaves into virtual children
var newSplits = splits;
@@ -311,13 +320,13 @@
var outPath = 'browser-test-case.html';
var outParams = {};
if ('guest' in merged) {
- outParams['test-case'] = calcGuestURL(merged);
+ outParams['test-case'] = deriveURL(merged, 'guest');
}
if ('driver' in merged) {
- outParams['test-driver'] = merged.driver;
+ outParams['test-driver'] = deriveURL(merged, 'driver');
}
if ('bare' in merged) {
- outPath = merged.bare;
+ outPath = deriveURL(merged, 'bare');
}
if (mode !== 'none') {
outParams['es5'] = String(mode === 'es5');
--
---
You received this message because you are subscribed to the Google Groups "Google Caja Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.