Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 if (window.testRunner) | 1 if (window.testRunner) |
| 2 testRunner.overridePreference("WebKitWebAudioEnabled", "1"); | 2 testRunner.overridePreference("WebKitWebAudioEnabled", "1"); |
| 3 | 3 |
| 4 function writeString(s, a, offset) { | 4 function writeString(s, a, offset) { |
| 5 for (var i = 0; i < s.length; ++i) { | 5 for (var i = 0; i < s.length; ++i) { |
| 6 a[offset + i] = s.charCodeAt(i); | 6 a[offset + i] = s.charCodeAt(i); |
| 7 } | 7 } |
| 8 } | 8 } |
| 9 | 9 |
| 10 function writeInt16(n, a, offset) { | 10 function writeInt16(n, a, offset) { |
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 422 var type = typeof value; | 422 var type = typeof value; |
| 423 this._assert(type === 'number' || type === 'string', | 423 this._assert(type === 'number' || type === 'string', |
| 424 'value should be number or string for'); | 424 'value should be number or string for'); |
| 425 | 425 |
| 426 if (this.target === value) | 426 if (this.target === value) |
| 427 this._testFailed('should not be equal to ' + value); | 427 this._testFailed('should not be equal to ' + value); |
| 428 else | 428 else |
| 429 this._testPassed('is not equal to ' + value); | 429 this._testPassed('is not equal to ' + value); |
| 430 }; | 430 }; |
| 431 | 431 |
| 432 // Check if |target| is greater than or equal to |value|. | |
| 433 // | |
| 434 // Example: | |
| 435 // Should("SNR", snr).greaterThanOrEqualTo(100); | |
| 436 // Result: | |
| 437 // "PASS SNR exceeds 100" | |
|
hongchan
2015/07/22 21:01:19
We previously agreed to add the example message fr
Raymond Toy
2015/07/23 15:33:09
Done.
| |
| 438 ShouldModel.prototype.beGreaterThanOrEqualTo = function (value) { | |
| 439 var type = typeof value; | |
| 440 this._assert(type === 'number' || type === 'string', | |
| 441 'value should be number or string for'); | |
| 442 | |
| 443 if (this.target >= value) | |
| 444 this._testPassed("is greater than or equal to " + value); | |
| 445 else | |
| 446 this._testFailed("(" + this.target + ") is not greater than or equal to " + value); | |
| 447 } | |
| 448 | |
| 432 // Check if |func| throws an exception with a certain |errorType| correctly. | 449 // Check if |func| throws an exception with a certain |errorType| correctly. |
| 433 // |errorType| is optional. | 450 // |errorType| is optional. |
| 434 // | 451 // |
| 435 // Example: | 452 // Example: |
| 436 // Should('A bad code', function () { var a = b; }).throw(); | 453 // Should('A bad code', function () { var a = b; }).throw(); |
| 437 // Result: | 454 // Result: |
| 438 // "PASS A bad code threw an exception." | 455 // "PASS A bad code threw an exception." |
| 439 // Example: | 456 // Example: |
| 440 // Should('var c = d', function () { var c = d; }).throw('ReferenceError'); | 457 // Should('var c = d', function () { var c = d; }).throw('ReferenceError'); |
| 441 // "PASS var c = d threw ReferenceError." | 458 // "PASS var c = d threw ReferenceError." |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 647 if (opts.hasOwnProperty('numberOfErrorLog')) | 664 if (opts.hasOwnProperty('numberOfErrorLog')) |
| 648 _opts.numberOfErrorLog = opts.numberOfErrorLog; | 665 _opts.numberOfErrorLog = opts.numberOfErrorLog; |
| 649 if (opts.hasOwnProperty('numberOfArrayLog')) | 666 if (opts.hasOwnProperty('numberOfArrayLog')) |
| 650 _opts.numberOfArrayLog = opts.numberOfArrayLog; | 667 _opts.numberOfArrayLog = opts.numberOfArrayLog; |
| 651 } | 668 } |
| 652 | 669 |
| 653 return new ShouldModel(desc, target, _opts); | 670 return new ShouldModel(desc, target, _opts); |
| 654 }; | 671 }; |
| 655 | 672 |
| 656 })(); | 673 })(); |
| OLD | NEW |