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

Unified Diff: mojo/public/tests/bindings/sample_service_unittest.cc

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/tests/bindings/sample_service_unittest.cc
diff --git a/mojo/public/tests/bindings/sample_service_unittest.cc b/mojo/public/tests/bindings/sample_service_unittest.cc
index 6f3a2bac3d222f28e06373f71b65d6a64bbed027..b6a75e5d283aab1801f21108da7876891bbc3c98 100644
--- a/mojo/public/tests/bindings/sample_service_unittest.cc
+++ b/mojo/public/tests/bindings/sample_service_unittest.cc
@@ -309,4 +309,18 @@ TEST(BindingsSampleTest, Basic) {
service->Frobinate(foo, Service::BAZ_EXTRA, port0.Pass());
}
+TEST(BindingsSampleTest, DefaultValues) {
+ mojo::Environment env;
+ SimpleMessageReceiver receiver;
+ mojo::AllocationScope scope;
+
+ Bar bar = Bar::Builder().Finish();
+ EXPECT_EQ(255, bar.alpha());
+
+ Foo foo = Foo::Builder().Finish();
+ ASSERT_FALSE(foo.name().is_null());
+ EXPECT_EQ("Fooby", foo.name().To<std::string>());
+ EXPECT_TRUE(foo.a());
+}
+
} // namespace sample

Powered by Google App Engine
This is Rietveld 408576698