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

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

Issue 164873002: Fix bug with using enums as default values in mojom. We were previously (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/enum_declaration.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 "mojom/sample_import", 10 "mojom/sample_import",
11 ], function(console, hexdump, expect, sample, imported) { 11 "mojom/sample_import2",
12 ], function(console, hexdump, expect, sample, imported, imported2) {
12 13
13 var global = this; 14 var global = this;
14 15
15 // Set this variable to true to print the binary message in hex. 16 // Set this variable to true to print the binary message in hex.
16 var dumpMessageAsHex = false; 17 var dumpMessageAsHex = false;
17 18
18 function makeFoo() { 19 function makeFoo() {
19 var bar = new sample.Bar(); 20 var bar = new sample.Bar();
20 bar.alpha = 20; 21 bar.alpha = 20;
21 bar.beta = 40; 22 bar.beta = 40;
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 expect(full.people[0].age).toBe(32); 111 expect(full.people[0].age).toBe(32);
111 expect(full.people[0].names.length).toBe(2); 112 expect(full.people[0].names.length).toBe(2);
112 expect(full.people[0].names[0]).toBe("Bob"); 113 expect(full.people[0].names[0]).toBe("Bob");
113 expect(full.people[0].names[1]).toBe("Bobby"); 114 expect(full.people[0].names[1]).toBe("Bobby");
114 expect(full.people[0].height).toBe(6*12); 115 expect(full.people[0].height).toBe(6*12);
115 116
116 expect(full.point.x).toBe(7); 117 expect(full.point.x).toBe(7);
117 expect(full.point.y).toBe(15); 118 expect(full.point.y).toBe(15);
118 119
119 expect(full.shape_masks.length).toBe(1); 120 expect(full.shape_masks.length).toBe(1);
120 // TODO(mpcomplete): This is broken. 121 expect(full.shape_masks[0]).toBe(1 << imported.Shape.SHAPE_RECTANGLE);
121 // http://crbug.com/320082
122 // expect(full.shape_masks[0]).toBe(1 << imported.Shape.SHAPE_RECTANGLE);
123 122
124 //expect(full.thing.shape).toBe(imported.Shape.SHAPE_RECTANGLE); 123 expect(full.thing.shape).toBe(imported.Shape.SHAPE_CIRCLE);
125 //expect(full.thing.color).toBe(imported.Color.COLOR_RED); 124 expect(full.thing.color).toBe(imported2.Color.COLOR_BLACK);
126 } 125 }
127 126
128 function ServiceImpl() { 127 function ServiceImpl() {
129 } 128 }
130 129
131 ServiceImpl.prototype = Object.create(sample.ServiceStub.prototype); 130 ServiceImpl.prototype = Object.create(sample.ServiceStub.prototype);
132 131
133 ServiceImpl.prototype.frobinate = function(foo, baz, port) { 132 ServiceImpl.prototype.frobinate = function(foo, baz, port) {
134 checkFoo(foo); 133 checkFoo(foo);
135 expect(baz).toBe(sample.ServiceStub.BazOptions.BAZ_EXTRA); 134 expect(baz).toBe(sample.ServiceStub.BazOptions.BAZ_EXTRA);
(...skipping 16 matching lines...) Expand all
152 var serviceProxy = new sample.ServiceProxy(receiver); 151 var serviceProxy = new sample.ServiceProxy(receiver);
153 152
154 checkDefaultValues(); 153 checkDefaultValues();
155 154
156 var foo = makeFoo(); 155 var foo = makeFoo();
157 checkFoo(foo); 156 checkFoo(foo);
158 157
159 var port = 10; 158 var port = 10;
160 serviceProxy.frobinate(foo, sample.ServiceProxy.BazOptions.BAZ_EXTRA, port); 159 serviceProxy.frobinate(foo, sample.ServiceProxy.BazOptions.BAZ_EXTRA, port);
161 }); 160 });
OLDNEW
« no previous file with comments | « no previous file | mojo/public/bindings/generators/cpp_templates/enum_declaration.tmpl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698