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

Unified Diff: mojo/public/bindings/sample/sample_service_unittests.js

Issue 138143003: Support default values for POD struct fields in mojom IDL. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 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
Index: mojo/public/bindings/sample/sample_service_unittests.js
diff --git a/mojo/public/bindings/sample/sample_service_unittests.js b/mojo/public/bindings/sample/sample_service_unittests.js
index b518deb8db4e91d343fa5a12a84ffc2f69a442d8..1a8400a3652f976217511c7eb4400a3898140d09 100644
--- a/mojo/public/bindings/sample/sample_service_unittests.js
+++ b/mojo/public/bindings/sample/sample_service_unittests.js
@@ -85,6 +85,16 @@ define([
expect(foo.source).toBe(0xFFFF);
}
+ // Check that values are set to the defaults if we don't override them.
+ function checkDefaultValues() {
+ var bar = new sample.Bar();
+ expect(bar.alpha).toBe(255);
+
+ var foo = new sample.Foo();
+ expect(foo.name).toBe("Fooby");
+ expect(foo.a).toBeTruthy();
+ }
+
function ServiceImpl() {
}
@@ -111,6 +121,8 @@ define([
var receiver = new SimpleMessageReceiver();
var serviceProxy = new sample.ServiceProxy(receiver);
+ checkDefaultValues();
+
var foo = makeFoo();
checkFoo(foo);

Powered by Google App Engine
This is Rietveld 408576698