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

Side by Side Diff: tests/compiler/dart2js/serialization_impact_test.dart

Issue 1934883002: Refactor unittests (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 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_impact_test;
6
7 import 'dart:async';
8 import 'package:async_helper/async_helper.dart';
9 import 'package:compiler/src/commandline_options.dart';
10 import 'package:compiler/src/common/resolution.dart';
11 import 'package:compiler/src/compiler.dart';
12 import 'package:compiler/src/elements/elements.dart';
13 import 'package:compiler/src/filenames.dart';
14 import 'package:compiler/src/serialization/equivalence.dart';
15 import 'memory_compiler.dart';
16 import 'serialization_helper.dart';
17 import 'serialization_test_helper.dart';
18
19 main(List<String> args) {
20 Arguments arguments = new Arguments.from(args);
21 asyncTest(() async {
22 String serializedData = await serializeDartCore(arguments: arguments);
23 if (arguments.filename != null) {
24 Uri entryPoint = Uri.base.resolve(nativeToUriPath(arguments.filename));
25 await check(serializedData, entryPoint);
26 } else {
27 Uri entryPoint = Uri.parse('memory:main.dart');
28 await check(serializedData, entryPoint,
29 sourceFiles: {'main.dart': 'main() {}'},
30 verbose: arguments.verbose);
31 }
32 });
33 }
34
35 Future check(
36 String serializedData,
37 Uri entryPoint,
38 {Map<String, String> sourceFiles: const <String, String>{},
39 bool verbose: false}) async {
40
41 Compiler compilerNormal = compilerFor(
42 memorySourceFiles: sourceFiles,
43 options: [Flags.analyzeAll]);
44 compilerNormal.resolution.retainCachesForTesting = true;
45 await compilerNormal.run(entryPoint);
46
47 Compiler compilerDeserialized = compilerFor(
48 memorySourceFiles: sourceFiles,
49 options: [Flags.analyzeAll]);
50 compilerDeserialized.resolution.retainCachesForTesting = true;
51 deserialize(compilerDeserialized, serializedData);
52 await compilerDeserialized.run(entryPoint);
53
54 checkAllImpacts(compilerNormal, compilerDeserialized, verbose: verbose);
55 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/serialization_helper.dart ('k') | tests/compiler/dart2js/serialization_library_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698