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

Side by Side Diff: tests/compiler/dart2js/serialization/native_data_test.dart

Issue 2057993003: Serialize NativeBehavior for elements (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Cleanup. Created 4 years, 6 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
(Empty)
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 library dart2js.serialization.native_data_test;
6
7 import 'dart:async';
8 import 'package:async_helper/async_helper.dart';
9 import 'package:compiler/src/common/names.dart';
10 import 'package:compiler/src/commandline_options.dart';
11 import 'package:compiler/src/compiler.dart';
12 import 'package:compiler/src/js_backend/js_backend.dart';
13 import 'package:compiler/src/js_backend/native_data.dart';
14 import 'package:compiler/src/filenames.dart';
15 import 'package:compiler/src/serialization/equivalence.dart';
16 import '../memory_compiler.dart';
17 import 'helper.dart';
18 import 'test_helper.dart';
19
20 main(List<String> args) {
21 asyncTest(() async {
22 Arguments arguments = new Arguments.from(args);
23 Uri uri = Uris.dart_html;
24 if (arguments.filename != null) {
25 uri = Uri.base.resolve(nativeToUriPath(arguments.filename));
26 }
27 await checkNativeData(uri, verbose: arguments.verbose);
28 });
29 }
30
31 Future checkNativeData(Uri uri, {bool verbose: false}) async {
32 print('------------------------------------------------------------------');
33 print('analyze normal: $uri');
34 print('------------------------------------------------------------------');
35 SerializationResult result = await serialize(uri);
36 Compiler compiler1 = result.compiler;
37 SerializedData serializedData = result.serializedData;
38
39 print('------------------------------------------------------------------');
40 print('analyze deserialized: $uri');
41 print('------------------------------------------------------------------');
42 Compiler compiler2 = compilerFor(
43 memorySourceFiles: serializedData.toMemorySourceFiles(),
44 resolutionInputs: serializedData.toUris(),
45 options: [Flags.analyzeAll]);
46 await compiler2.run(uri);
47
48 JavaScriptBackend backend1 = compiler1.backend;
49 JavaScriptBackend backend2 = compiler2.backend;
50 NativeData nativeData1 = backend1.nativeData;
51 NativeData nativeData2 = backend2.nativeData;
52
53 checkMaps(
54 nativeData1.jsInteropNames,
55 nativeData2.jsInteropNames,
56 "NativeData.jsInteropNames",
57 areElementsEquivalent,
58 equality,
59 verbose: verbose);
60
61 checkMaps(
62 nativeData1.nativeMemberName,
63 nativeData2.nativeMemberName,
64 "NativeData.nativeMemberName",
65 areElementsEquivalent,
66 equality,
67 verbose: verbose);
68
69 checkMaps(
70 nativeData1.nativeClassTagInfo,
71 nativeData2.nativeClassTagInfo,
72 "NativeData.nativeClassTagInfo",
73 areElementsEquivalent,
74 equality,
75 verbose: verbose);
76
77 checkMaps(
78 nativeData1.nativeMethodBehavior,
79 nativeData2.nativeMethodBehavior,
80 "NativeData.nativeMethodBehavior",
81 areElementsEquivalent,
82 testNativeBehavior,
83 verbose: verbose);
84
85 checkMaps(
86 nativeData1.nativeFieldLoadBehavior,
87 nativeData2.nativeFieldLoadBehavior,
88 "NativeData.nativeFieldLoadBehavior",
89 areElementsEquivalent,
90 testNativeBehavior,
91 verbose: verbose);
92
93 checkMaps(
94 nativeData1.nativeFieldStoreBehavior,
95 nativeData2.nativeFieldStoreBehavior,
96 "NativeData.nativeFieldStoreBehavior",
97 areElementsEquivalent,
98 testNativeBehavior,
99 verbose: verbose);
100 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/serialization/model_test.dart ('k') | tests/compiler/dart2js/serialization/test_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698