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

Side by Side Diff: mojo/apps/js/bindings/sample_service_unittests.js

Issue 139613005: Support default values for complex objects in mojom. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | mojo/public/bindings/generators/cpp_templates/struct_builder_definition.tmpl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 define([ 5 define([
6 "console", 6 "console",
7 "mojo/apps/js/test/hexdump", 7 "mojo/apps/js/test/hexdump",
8 "gin/test/expect", 8 "gin/test/expect",
9 "mojom/sample_service" 9 "mojom/sample_service"
10 ], function(console, hexdump, expect, sample) { 10 ], function(console, hexdump, expect, sample) {
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 expect(bar.alpha).toBe(255); 91 expect(bar.alpha).toBe(255);
92 92
93 var foo = new sample.Foo(); 93 var foo = new sample.Foo();
94 expect(foo.name).toBe("Fooby"); 94 expect(foo.name).toBe("Fooby");
95 expect(foo.a).toBeTruthy(); 95 expect(foo.a).toBeTruthy();
96 96
97 expect(foo.data.length).toBe(3); 97 expect(foo.data.length).toBe(3);
98 expect(foo.data[0]).toBe(1); 98 expect(foo.data[0]).toBe(1);
99 expect(foo.data[1]).toBe(2); 99 expect(foo.data[1]).toBe(2);
100 expect(foo.data[2]).toBe(3); 100 expect(foo.data[2]).toBe(3);
101
102 var inner = new sample.DefaultsTestInner();
103 expect(inner.names.length).toBe(1);
104 expect(inner.names[0]).toBe("Jim");
105 expect(inner.height).toBe(6*12);
106
107 var full = new sample.DefaultsTest();
108 expect(full.people.length).toBe(1);
109 expect(full.people[0].age).toBe(32);
110 expect(full.people[0].names.length).toBe(2);
111 expect(full.people[0].names[0]).toBe("Bob");
112 expect(full.people[0].names[1]).toBe("Bobby");
113 expect(full.people[0].height).toBe(6*12);
101 } 114 }
102 115
103 function ServiceImpl() { 116 function ServiceImpl() {
104 } 117 }
105 118
106 ServiceImpl.prototype = Object.create(sample.ServiceStub.prototype); 119 ServiceImpl.prototype = Object.create(sample.ServiceStub.prototype);
107 120
108 ServiceImpl.prototype.frobinate = function(foo, baz, port) { 121 ServiceImpl.prototype.frobinate = function(foo, baz, port) {
109 checkFoo(foo); 122 checkFoo(foo);
110 expect(baz).toBe(sample.ServiceStub.BazOptions.BAZ_EXTRA); 123 expect(baz).toBe(sample.ServiceStub.BazOptions.BAZ_EXTRA);
(...skipping 16 matching lines...) Expand all
127 var serviceProxy = new sample.ServiceProxy(receiver); 140 var serviceProxy = new sample.ServiceProxy(receiver);
128 141
129 checkDefaultValues(); 142 checkDefaultValues();
130 143
131 var foo = makeFoo(); 144 var foo = makeFoo();
132 checkFoo(foo); 145 checkFoo(foo);
133 146
134 var port = 10; 147 var port = 10;
135 serviceProxy.frobinate(foo, sample.ServiceProxy.BazOptions.BAZ_EXTRA, port); 148 serviceProxy.frobinate(foo, sample.ServiceProxy.BazOptions.BAZ_EXTRA, port);
136 }); 149 });
OLDNEW
« no previous file with comments | « no previous file | mojo/public/bindings/generators/cpp_templates/struct_builder_definition.tmpl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698