| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 /** | 5 /** |
| 6 * Asserts that a given argument's value is undefined. | 6 * Asserts that a given argument's value is undefined. |
| 7 * @param {object} a The argument to check. | 7 * @param {object} a The argument to check. |
| 8 */ | 8 */ |
| 9 function assertUndefined(a) { | 9 function assertUndefined(a) { |
| 10 if (a !== undefined) { | 10 if (a !== undefined) { |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 * @param {string=} opt_message Message used for errors. | 73 * @param {string=} opt_message Message used for errors. |
| 74 */ | 74 */ |
| 75 function assertEqualsJSON(expected, actual, opt_message) { | 75 function assertEqualsJSON(expected, actual, opt_message) { |
| 76 if (JSON.stringify(actual) !== JSON.stringify(expected)) { | 76 if (JSON.stringify(actual) !== JSON.stringify(expected)) { |
| 77 throw new Error((opt_message ? opt_message + '\n' : '') + | 77 throw new Error((opt_message ? opt_message + '\n' : '') + |
| 78 'Expected ' + JSON.stringify(expected) + '\n' + | 78 'Expected ' + JSON.stringify(expected) + '\n' + |
| 79 'Got ' + JSON.stringify(actual)); | 79 'Got ' + JSON.stringify(actual)); |
| 80 } | 80 } |
| 81 } | 81 } |
| 82 | 82 |
| 83 /** |
| 84 * Asserts that two ArrayBuffers have the same content. |
| 85 * @param {ArrayBuffer} arrayBufA The expected ArrayBuffer. |
| 86 * @param {ArrayBuffer} arrayBufB The test ArrayBuffer. |
| 87 */ |
| 88 function assertArrayBuffersEquals(arrayBufA, arrayBufB) { |
| 89 var view1 = new Uint8Array(arrayBufA); |
| 90 var view2 = new Uint8Array(arrayBufB); |
| 91 assertEquals(JSON.stringify(view1), JSON.stringify(view2)); |
| 92 } |
| 93 |
| 94 /** |
| 95 * Asserts that two Arrays have the same content. |
| 96 * @param {ArrayBuffer} arrayA The expected array. |
| 97 * @param {ArrayBuffer} arrayB The test array. |
| 98 */ |
| 99 function assertArraysEquals(arrayA, arrayB) { |
| 100 assertEquals(JSON.stringify(arrayA), JSON.stringify(arrayB)); |
| 101 } |
| 102 |
| 83 assertSame = assertEquals; | 103 assertSame = assertEquals; |
| 84 assertNotSame = assertNotEquals; | 104 assertNotSame = assertNotEquals; |
| OLD | NEW |