diff options
-rw-r--r-- | chrome/test/data/nacl/bad/ppapi_bad.html | 6 | ||||
-rw-r--r-- | chrome/test/data/nacl/bad/ppapi_bad.js | 5 | ||||
-rw-r--r-- | ppapi/native_client/tools/browser_tester/browserdata/nacltest.js | 8 |
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? |