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

Side by Side Diff: mojo/public/bindings/js/codec_unittests.js

Issue 68323004: Port Mojo's sample_service.cc to JavaScript (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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
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 "gtest", 6 "gtest",
7 "mojo/public/bindings/js/codec", 7 "mojo/public/bindings/js/codec",
8 "mojo/public/bindings/js/test/sample_service" 8 "mojo/public/bindings/sample/mojom/sample_service"
9 ], function(gtest, codec, sample) { 9 ], function(gtest, codec, sample) {
10 testBar(); 10 testBar();
11 testFoo(); 11 testFoo();
12 testAlign();
12 this.result = "PASS"; 13 this.result = "PASS";
13 14
14 function barMatches(bar, expected) { 15 function barMatches(bar, expected) {
15 gtest.expectEqual(bar.alpha, expected.alpha, 16 gtest.expectEqual(bar.alpha, expected.alpha,
16 "bar.alpha is " + bar.alpha); 17 "bar.alpha is " + bar.alpha);
17 gtest.expectEqual(bar.beta, expected.beta, 18 gtest.expectEqual(bar.beta, expected.beta,
18 "bar.beta is " + bar.beta); 19 "bar.beta is " + bar.beta);
19 gtest.expectEqual(bar.gamma, expected.gamma, 20 gtest.expectEqual(bar.gamma, expected.gamma,
20 "bar.gamma is " + bar.gamma); 21 "bar.gamma is " + bar.gamma);
21 } 22 }
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 var actualExtraBarsJSON = JSON.stringify(foo2.extra_bars); 155 var actualExtraBarsJSON = JSON.stringify(foo2.extra_bars);
155 var expectedExtraBarsJSON = JSON.stringify(foo.extra_bars); 156 var expectedExtraBarsJSON = JSON.stringify(foo.extra_bars);
156 gtest.expectEqual(actualExtraBarsJSON, expectedExtraBarsJSON, 157 gtest.expectEqual(actualExtraBarsJSON, expectedExtraBarsJSON,
157 actualExtraBarsJSON); 158 actualExtraBarsJSON);
158 159
159 gtest.expectEqual(foo2.name, foo.name, 160 gtest.expectEqual(foo2.name, foo.name,
160 "foo2.name is " + foo2.name); 161 "foo2.name is " + foo2.name);
161 162
162 equalsArray(foo2.files, foo.files, "foo2.files"); 163 equalsArray(foo2.files, foo.files, "foo2.files");
163 } 164 }
165
166 function testAlign() {
167 var aligned = [
168 0, // 0
169 8, // 1
170 8, // 2
171 8, // 3
172 8, // 4
173 8, // 5
174 8, // 6
175 8, // 7
176 8, // 8
177 16, // 9
178 16, // 10
179 16, // 11
180 16, // 12
181 16, // 13
182 16, // 14
183 16, // 15
184 16, // 16
185 24, // 17
186 24, // 18
187 24, // 19
188 24, // 20
189 ];
190 for (var i = 0; i < aligned.length; ++i) {
191 gtest.expectEqual(codec.align(i), aligned[i],
192 "codec.align(" + i + ") is " + codec.align(i));
193 }
194 }
164 }); 195 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698