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..9a177c560d19016f116cfc69ee1ffde9abed28de 100644 |
| --- a/chrome/test/data/webui/test_api.js |
| +++ b/chrome/test/data/webui/test_api.js |
| @@ -1667,6 +1667,46 @@ var testing = {}; |
| return new MatchJSON(expectedValue); |
| } |
| + /** |
| + * Mock4JS matcher object that matches the actual agrument and the expected |
| + * value iff the string representation of the actual argument is equal to the |
| + * expected value. |
| + * @param {string} expectedValue Expected value. |
| + * @constructor |
| + */ |
| + function MatchToString(expectedValue) { |
| + this.expectedValue_ = expectedValue; |
| + } |
| + |
| + MatchToString.prototype = { |
| + /** |
| + * Checks that the string representation of the actual argument, and the |
|
skare_
2013/08/29 00:26:14
nit: no comma before 'and'
vadimt
2013/08/29 00:35:32
I did this to avoid this interpretation:
the strin
skare_
2013/08/29 00:48:09
sort of, but I'm not witholding an lg over it or a
vadimt
2013/08/29 18:03:43
Done.
|
| + * expected value are same. |
|
skare_
2013/08/29 00:48:09
though if not changing the above, s/are same/are t
vadimt
2013/08/29 18:03:43
Done.
|
| + * @param {Object} actualArgument The argument to match. |
| + * @return {boolean} Result of the comparison. |
| + */ |
| + argumentMatches: function(actualArgument) { |
| + return this.expectedValue_ === actualArgument.toString(); |
| + }, |
| + |
| + /** |
| + * Describes the matcher. |
| + * @return {string} Description of this Mock4JS matcher. |
| + */ |
| + describe: function() { |
| + return 'eqToString("' + this.expectedValue_ + '")'; |
| + }, |
| + }; |
| + |
| + /** |
| + * Builds a MatchToString agrument 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); |