Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2331)

Unified Diff: remoting/webapp/unittests/base_unittest.js

Issue 877993002: Implement base.IPC (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Ready for Checkin Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/webapp/js_proto/chrome_proto.js ('k') | remoting/webapp/unittests/chrome_mocks.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/webapp/unittests/base_unittest.js
diff --git a/remoting/webapp/unittests/base_unittest.js b/remoting/webapp/unittests/base_unittest.js
index a37715c30962c2e143851cabfe2a9ede69f1b6d1..27d9b1810e6fda4501f45709ba0aa762e80431c9 100644
--- a/remoting/webapp/unittests/base_unittest.js
+++ b/remoting/webapp/unittests/base_unittest.js
@@ -41,6 +41,35 @@ test('values(obj) should return an array containing the values of |obj|',
notEqual(output.indexOf('b'), -1, '"b" should be in the output');
});
+test('deepCopy(obj) should return null on NaN and undefined',
+ function() {
+ QUnit.equal(base.deepCopy(NaN), null);
+ QUnit.equal(base.deepCopy(undefined), null);
+});
+
+test('deepCopy(obj) should copy primitive types recursively',
+ function() {
+ QUnit.equal(base.deepCopy(1), 1);
+ QUnit.equal(base.deepCopy('hello'), 'hello');
+ QUnit.equal(base.deepCopy(false), false);
+ QUnit.equal(base.deepCopy(null), null);
+ QUnit.deepEqual(base.deepCopy([1, 2]), [1, 2]);
+ QUnit.deepEqual(base.deepCopy({'key': 'value'}), {'key': 'value'});
+ QUnit.deepEqual(base.deepCopy(
+ {'key': {'key_nested': 'value_nested'}}),
+ {'key': {'key_nested': 'value_nested'}}
+ );
+ QUnit.deepEqual(base.deepCopy([1, [2, [3]]]), [1, [2, [3]]]);
+});
+
+test('modify the original after deepCopy(obj) should not affect the copy',
+ function() {
+ var original = [1, 2, 3, 4];
+ var copy = base.deepCopy(original);
+ original[2] = 1000;
+ QUnit.deepEqual(copy, [1, 2, 3, 4]);
+});
+
test('dispose(obj) should invoke the dispose method on |obj|',
function() {
var obj = {
« no previous file with comments | « remoting/webapp/js_proto/chrome_proto.js ('k') | remoting/webapp/unittests/chrome_mocks.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698