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

Side by Side Diff: mojo/dart/unittests/embedder_tests/bindings_generation_test.dart

Issue 2112313002: Dart: Fixes enum array encoding (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 years, 5 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 import 'dart:async'; 5 import 'dart:async';
6 import 'dart:isolate'; 6 import 'dart:isolate';
7 import 'dart:typed_data'; 7 import 'dart:typed_data';
8 import 'dart:convert'; 8 import 'dart:convert';
9 9
10 import 'package:mojo/bindings.dart' as bindings; 10 import 'package:mojo/bindings.dart' as bindings;
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 238
239 Expect.equals(32, s2.objectUnion.fPodUnion.fUint32); 239 Expect.equals(32, s2.objectUnion.fPodUnion.fUint32);
240 } 240 }
241 241
242 testUnionsToString() { 242 testUnionsToString() {
243 var podUnion = new unions.PodUnion(); 243 var podUnion = new unions.PodUnion();
244 podUnion.fUint32 = 32; 244 podUnion.fUint32 = 32;
245 Expect.equals("PodUnion(fUint32: 32)", podUnion.toString()); 245 Expect.equals("PodUnion(fUint32: 32)", podUnion.toString());
246 } 246 }
247 247
248 testSerializeEnumArray() {
249 var s = new regression.ContainsNullableArrayOfEnum();
250 s.arrayOfEnums = [
251 regression.NormalEnum.first,
252 regression.NormalEnum.second,
253 regression.NormalEnum.second,
254 regression.NormalEnum.first,
255 ];
256
257 var message = messageOfStruct(s);
258 var s2 = regression.ContainsNullableArrayOfEnum.deserialize(message.payload);
259 for (int i = 0; i < s.arrayOfEnums.length; i++) {
260 Expect.equals(s.arrayOfEnums[i], s2.arrayOfEnums[i]);
261 }
262 }
263
248 testUnions() { 264 testUnions() {
249 testSerializePodUnions(); 265 testSerializePodUnions();
250 testSerializeStructInUnion(); 266 testSerializeStructInUnion();
251 testSerializeArrayInUnion(); 267 testSerializeArrayInUnion();
252 testSerializeMapInUnion(); 268 testSerializeMapInUnion();
253 testSerializeUnionInArray(); 269 testSerializeUnionInArray();
254 testSerializeUnionInMap(); 270 testSerializeUnionInMap();
255 testSerializeUnionInUnion(); 271 testSerializeUnionInUnion();
256 testUnionsToString(); 272 testUnionsToString();
273 testSerializeEnumArray();
257 } 274 }
258 275
259 class CheckEnumCapsImpl implements regression.CheckEnumCaps { 276 class CheckEnumCapsImpl implements regression.CheckEnumCaps {
260 regression.CheckEnumCapsStub _stub; 277 regression.CheckEnumCapsStub _stub;
261 278
262 CheckEnumCapsImpl(core.MojoMessagePipeEndpoint endpoint) { 279 CheckEnumCapsImpl(core.MojoMessagePipeEndpoint endpoint) {
263 _stub = new regression.CheckEnumCapsStub.fromEndpoint(endpoint, this); 280 _stub = new regression.CheckEnumCapsStub.fromEndpoint(endpoint, this);
264 } 281 }
265 282
266 setEnumWithInternalAllCaps(regression.EnumWithInternalAllCaps e) {} 283 setEnumWithInternalAllCaps(regression.EnumWithInternalAllCaps e) {}
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
749 testUnions(); 766 testUnions();
750 testValidateMojomTypes(); 767 testValidateMojomTypes();
751 testCamelCase(); 768 testCamelCase();
752 testSerializeErrorMessage(); 769 testSerializeErrorMessage();
753 await testEnums(); 770 await testEnums();
754 await testAwaitCallResponse(); 771 await testAwaitCallResponse();
755 await runOnClosedTest(); 772 await runOnClosedTest();
756 await testRegression551(); 773 await testRegression551();
757 await testServiceName(); 774 await testServiceName();
758 } 775 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698