summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjfb <jfb@chromium.org>2015-01-08 14:55:33 -0800
committerCommit bot <commit-bot@chromium.org>2015-01-08 22:56:22 +0000
commit590ddf258330b9f3c7a77d41a040a847d37f9045 (patch)
tree4bd2d0847dd95e77d933fdc1e6dc40685072f921
parentede8b4f5262e31859198e85981461fe9d2504e0a (diff)
downloadchromium_src-590ddf258330b9f3c7a77d41a040a847d37f9045.zip
chromium_src-590ddf258330b9f3c7a77d41a040a847d37f9045.tar.gz
chromium_src-590ddf258330b9f3c7a77d41a040a847d37f9045.tar.bz2
NaCl test: allow testing using regular expressions
The change in: https://codereview.chromium.org/807643002 Causes the PNaCl translator to output some debug information on failure, but it's currently non-deterministic. This causes the DEPS roll of NaCl into Chrome to fail: https://codereview.chromium.org/831233003 This CL allows testing the string against a regular expression instead, and updates this specific string to be a regular expression instead (which will match the current error message as well as the new one). R= mseaborn@chromium.org, bradnelson@chromium.org TEST= try bots BUG= blocked DEPS roll of NaCl into Chrome Review URL: https://codereview.chromium.org/833123003 Cr-Commit-Position: refs/heads/master@{#310621}
-rw-r--r--chrome/test/data/nacl/bad/ppapi_bad.html6
-rw-r--r--chrome/test/data/nacl/bad/ppapi_bad.js5
-rw-r--r--ppapi/native_client/tools/browser_tester/browserdata/nacltest.js8
3 files changed, 17 insertions, 2 deletions
diff --git a/chrome/test/data/nacl/bad/ppapi_bad.html b/chrome/test/data/nacl/bad/ppapi_bad.html
index 01a3e6a..d756d5b 100644
--- a/chrome/test/data/nacl/bad/ppapi_bad.html
+++ b/chrome/test/data/nacl/bad/ppapi_bad.html
@@ -55,7 +55,11 @@ function declareTests(tester) {
'ppapi_bad_magic.nmf',
mime_type,
is_pnacl
- ? 'NaCl module load failed: PnaclCoordinator: PNaCl Translator Error: Invalid PNaCl bitcode header'
+ // Use a regular expression here: the translator outputs debug
+ // information in the error message.
+ ? new RegExp('NaCl module load failed: PnaclCoordinator: ' +
+ 'PNaCl Translator Error: .*' +
+ 'Invalid PNaCl bitcode header')
: 'NaCl module load failed: Bad ELF header magic number');
// 'nonexistent_nexe' loads a manifest, then tries to load a nonexistent nexe.
diff --git a/chrome/test/data/nacl/bad/ppapi_bad.js b/chrome/test/data/nacl/bad/ppapi_bad.js
index bcd3fb0..8114cf8 100644
--- a/chrome/test/data/nacl/bad/ppapi_bad.js
+++ b/chrome/test/data/nacl/bad/ppapi_bad.js
@@ -37,7 +37,10 @@ function badLoadTest(tester, id, src, type, error_string) {
});
test.expectEvent(module, 'error', function(e) {
test.assertEqual(module.readyState, 4);
- test.assertEqual(module.lastError, error_string);
+ if (error_string instanceof RegExp)
+ test.assertRegexMatches(module.lastError, error_string);
+ else
+ test.assertEqual(module.lastError, error_string);
test.expectEvent(module, 'loadend', function(e) {
removeModule(module);
test.pass();
diff --git a/ppapi/native_client/tools/browser_tester/browserdata/nacltest.js b/ppapi/native_client/tools/browser_tester/browserdata/nacltest.js
index 59a13400..bb0671d 100644
--- a/ppapi/native_client/tools/browser_tester/browserdata/nacltest.js
+++ b/ppapi/native_client/tools/browser_tester/browserdata/nacltest.js
@@ -410,6 +410,14 @@ function assertArraysEqual(a, b, message, test_status) {
}
+function assertRegexMatches(str, re, message, test_status) {
+ if (!str.match(re)) {
+ fail(message, toString(str) + ' doesn\'t match ' + toString(re.toString()),
+ test_status);
+ }
+}
+
+
// Ideally there'd be some way to identify what exception was thrown, but JS
// exceptions are fairly ad-hoc.
// TODO(ncbray) allow manual validation of exception types?