Chromium Code Reviews| Index: chrome/test/data/webui/test_api.js |
| diff --git a/chrome/test/data/webui/test_api.js b/chrome/test/data/webui/test_api.js |
| index 6bf21775e2e49e6fedada2cc0cfb97356b50ecda..7052722a954c3e2899fa0a1300246eb6146b5503 100644 |
| --- a/chrome/test/data/webui/test_api.js |
| +++ b/chrome/test/data/webui/test_api.js |
| @@ -1628,7 +1628,7 @@ var testing = {}; |
| } |
| /** |
| - * Mock4JS matcher object that matches the actual agrument and the expected |
| + * Mock4JS matcher object that matches the actual argument and the expected |
| * value iff their JSON represenations are same. |
| * @param {Object} expectedValue Expected value. |
| * @constructor |
| @@ -1659,7 +1659,7 @@ var testing = {}; |
| }; |
| /** |
| - * Builds a MatchJSON agrument matcher for a given expected value. |
| + * Builds a MatchJSON argument matcher for a given expected value. |
| * @param {Object} expectedValue Expected value. |
| * @return {MatchJSON} Resulting Mock4JS matcher. |
| */ |
| @@ -1667,6 +1667,46 @@ var testing = {}; |
| return new MatchJSON(expectedValue); |
| } |
| + /** |
| + * Mock4JS matcher object that matches the actual argument and the expected |
| + * value iff the the string representation of the actual argument is equal to |
| + * the expected value. |
| + * @param {string} expectedValue Expected value. |
|
arv (Not doing code reviews)
2013/09/03 22:54:50
useless description
vadimt
2013/09/03 23:17:37
Done.
|
| + * @constructor |
| + */ |
| + function MatchToString(expectedValue) { |
| + this.expectedValue_ = expectedValue; |
| + } |
| + |
| + MatchToString.prototype = { |
| + /** |
| + * Checks that the the string representation of the actual argument matches |
| + * the expected value. |
| + * @param {Object} actualArgument The argument to match. |
|
arv (Not doing code reviews)
2013/09/03 22:54:50
{*}
vadimt
2013/09/03 23:17:37
Done.
|
| + * @return {boolean} Result of the comparison. |
| + */ |
| + argumentMatches: function(actualArgument) { |
| + return this.expectedValue_ === actualArgument.toString(); |
|
arv (Not doing code reviews)
2013/09/03 22:54:50
String(actualArgument)
vadimt
2013/09/03 23:17:37
The rest of the file uses toString(). Unless I'm m
arv (Not doing code reviews)
2013/09/04 15:00:22
They are not equivalent.
value.toString()
fails
vadimt
2013/09/04 17:13:25
Done.
|
| + }, |
| + |
| + /** |
| + * Describes the matcher. |
| + * @return {string} Description of this Mock4JS matcher. |
| + */ |
| + describe: function() { |
| + return 'eqToString("' + this.expectedValue_ + '")'; |
| + }, |
| + }; |
| + |
| + /** |
| + * Builds a MatchToString argument matcher for a given expected value. |
| + * @param {Object} expectedValue Expected value. |
| + * @return {MatchToString} Resulting Mock4JS matcher. |
| + */ |
| + function eqToString(expectedValue) { |
| + return new MatchToString(expectedValue); |
| + } |
| + |
| // Exports. |
| testing.Test = Test; |
| exports.testDone = testDone; |
| @@ -1684,6 +1724,7 @@ var testing = {}; |
| exports.callFunctionWithSavedArgs = callFunctionWithSavedArgs; |
| exports.callGlobalWithSavedArgs = callGlobalWithSavedArgs; |
| exports.eqJSON = eqJSON; |
| + exports.eqToString = eqToString; |
| exports.expectTrue = createExpect(assertTrue); |
| exports.expectFalse = createExpect(assertFalse); |
| exports.expectGE = createExpect(assertGE); |