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

Unified Diff: remoting/webapp/base/js/host_options_unittest.js

Issue 1366093003: Improve HostOptions unit tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Improve unit tests. Created 5 years, 3 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/webapp/base/js/host_options_unittest.js
diff --git a/remoting/webapp/base/js/host_options_unittest.js b/remoting/webapp/base/js/host_options_unittest.js
index a6b1d461d01f22b80f1d152f59471f6242276224..7e4a948adef2dc63ba8e3cdb306f4156e4e6be32 100644
--- a/remoting/webapp/base/js/host_options_unittest.js
+++ b/remoting/webapp/base/js/host_options_unittest.js
@@ -56,6 +56,7 @@ QUnit.test('Loading a non-existent host yields default values',
QUnit.test('Saving and loading a host preserves the saved values',
function(assert) {
var options = new remoting.HostOptions('host-id');
+ var optionsNew = new remoting.HostOptions('host-id');
Jamie 2015/09/26 00:40:41 Loading into the same object as we saved would tri
kelvinp 2015/09/28 18:36:40 Nit: optionsLoaded may be a more descriptive name.
Jamie 2015/09/28 21:33:48 Done.
options.setShrinkToFit(false);
options.setResizeToClient(false);
options.setDesktopScale(2);
@@ -67,18 +68,20 @@ QUnit.test('Saving and loading a host preserves the saved values',
var optionsCopy = base.deepCopy(options);
return options.save().then(function() {
- return options.load();
+ return optionsNew.load();
}).then(function() {
- assert.deepEqual(optionsCopy, base.deepCopy(options));
+ assert.deepEqual(optionsCopy, base.deepCopy(optionsNew));
});
});
QUnit.test('Saving a host ignores unset values',
function(assert) {
var options = new remoting.HostOptions('host-id');
+ options.setShrinkToFit(false);
var optionsCopy = base.deepCopy(options);
+ var optionsEmpty = new remoting.HostOptions('host-id');
Jamie 2015/09/26 00:40:41 This test wasn't really testing anything previousl
- return options.save().then(function() {
+ return optionsEmpty.save().then(function() {
return options.load();
}).then(function() {
assert.deepEqual(optionsCopy, base.deepCopy(options));
@@ -104,3 +107,17 @@ QUnit.test('Old-style (string-formatted) key remappings are parsed correctly',
assert.deepEqual(options1, options2);
});
});
+
+QUnit.test('New options are loaded and saved without updating the code',
+ function(assert) {
+ var options = new remoting.HostOptions('host-id');
+ var optionsNew = new remoting.HostOptions('host-id');
+ options['undefined-option'] = 42;
+ var optionsCopy = base.deepCopy(options);
+
+ return options.save().then(function() {
+ return optionsNew.load();
+ }).then(function() {
+ assert.deepEqual(optionsCopy, base.deepCopy(optionsNew));
kelvinp 2015/09/28 18:36:40 Nit: maybe good to assert options['undefined-optio
Jamie 2015/09/28 21:33:48 Done.
+ });
+});
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698