| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 'use strict'; | 5 'use strict'; |
| 6 | 6 |
| 7 // This file provides | 7 // This file provides |
| 8 // |spellcheck_test(sample, tester, expectedText, opt_title)| asynchronous test | 8 // |spellcheck_test(sample, tester, expectedText, opt_title)| asynchronous test |
| 9 // to W3C test harness for easier writing of spellchecker test cases. | 9 // to W3C test harness for easier writing of spellchecker test cases. |
| 10 // | 10 // |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 * @param {number} retryInterval | 283 * @param {number} retryInterval |
| 284 */ | 284 */ |
| 285 function verifyMarkers( | 285 function verifyMarkers( |
| 286 testObject, sample, expectedText, remainingRetry, retryInterval) { | 286 testObject, sample, expectedText, remainingRetry, retryInterval) { |
| 287 assert_not_equals( | 287 assert_not_equals( |
| 288 window.internals, undefined, | 288 window.internals, undefined, |
| 289 'window.internals is required for running automated spellcheck tests.'); | 289 'window.internals is required for running automated spellcheck tests.'); |
| 290 | 290 |
| 291 /** @type {!MarkerSerializer} */ | 291 /** @type {!MarkerSerializer} */ |
| 292 const serializer = new MarkerSerializer({ | 292 const serializer = new MarkerSerializer({ |
| 293 spelling: '_', | 293 spelling: '#', |
| 294 grammar: '~'}); | 294 grammar: '~'}); |
| 295 | 295 |
| 296 try { | 296 try { |
| 297 assert_equals(serializer.serialize(sample.document), expectedText); | 297 assert_equals(serializer.serialize(sample.document), expectedText); |
| 298 testObject.done(); | 298 testObject.done(); |
| 299 } catch (error) { | 299 } catch (error) { |
| 300 if (remainingRetry <= 0) | 300 if (remainingRetry <= 0) |
| 301 throw error; | 301 throw error; |
| 302 | 302 |
| 303 // Force invoking idle time spellchecker in case it has not been run yet. | 303 // Force invoking idle time spellchecker in case it has not been run yet. |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 expectedText: expectedText, args: args}); | 428 expectedText: expectedText, args: args}); |
| 429 return; | 429 return; |
| 430 } | 430 } |
| 431 | 431 |
| 432 invokeSpellcheckTest(input, tester, expectedText, args); | 432 invokeSpellcheckTest(input, tester, expectedText, args); |
| 433 } | 433 } |
| 434 | 434 |
| 435 // Export symbols | 435 // Export symbols |
| 436 window.spellcheck_test = spellcheckTest; | 436 window.spellcheck_test = spellcheckTest; |
| 437 })(); | 437 })(); |
| OLD | NEW |