| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 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 | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library dart2js.reserialization_test; | 5 library dart2js.reserialization_test; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'package:async_helper/async_helper.dart'; | 8 import 'package:async_helper/async_helper.dart'; |
| 9 import 'package:compiler/src/compiler.dart'; | 9 import 'package:compiler/src/compiler.dart'; |
| 10 import 'package:compiler/src/diagnostics/invariant.dart'; | 10 import 'package:compiler/src/diagnostics/invariant.dart'; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 } | 31 } |
| 32 | 32 |
| 33 Future testReserialization(Uri entryPoint) async { | 33 Future testReserialization(Uri entryPoint) async { |
| 34 SerializationResult result1 = await serialize(entryPoint); | 34 SerializationResult result1 = await serialize(entryPoint); |
| 35 Compiler compiler1 = result1.compiler; | 35 Compiler compiler1 = result1.compiler; |
| 36 SerializedData serializedData1 = result1.serializedData; | 36 SerializedData serializedData1 = result1.serializedData; |
| 37 Iterable<LibraryElement> libraries1 = compiler1.libraryLoader.libraries; | 37 Iterable<LibraryElement> libraries1 = compiler1.libraryLoader.libraries; |
| 38 | 38 |
| 39 SerializationResult result2 = await serialize(entryPoint, | 39 SerializationResult result2 = await serialize(entryPoint, |
| 40 memorySourceFiles: serializedData1.toMemorySourceFiles(), | 40 memorySourceFiles: serializedData1.toMemorySourceFiles(), |
| 41 resolutionInputs: serializedData1.toUris()); | 41 resolutionInputs: serializedData1.toUris(), |
| 42 deserializeCompilationDataForTesting: true); |
| 42 Compiler compiler2 = result2.compiler; | 43 Compiler compiler2 = result2.compiler; |
| 43 SerializedData serializedData2 = result2.serializedData; | 44 SerializedData serializedData2 = result2.serializedData; |
| 44 Iterable<LibraryElement> libraries2 = compiler2.libraryLoader.libraries; | 45 Iterable<LibraryElement> libraries2 = compiler2.libraryLoader.libraries; |
| 45 | 46 |
| 46 SerializationResult result3 = await serialize(entryPoint, | 47 SerializationResult result3 = await serialize(entryPoint, |
| 47 memorySourceFiles: serializedData2.toMemorySourceFiles(), | 48 memorySourceFiles: serializedData2.toMemorySourceFiles(), |
| 48 resolutionInputs: serializedData2.toUris()); | 49 resolutionInputs: serializedData2.toUris(), |
| 50 deserializeCompilationDataForTesting: true); |
| 49 Compiler compiler3 = result3.compiler; | 51 Compiler compiler3 = result3.compiler; |
| 50 Iterable<LibraryElement> libraries3 = compiler3.libraryLoader.libraries; | 52 Iterable<LibraryElement> libraries3 = compiler3.libraryLoader.libraries; |
| 51 | 53 |
| 52 for (LibraryElement library1 in libraries1) { | 54 for (LibraryElement library1 in libraries1) { |
| 53 LibraryElement library2 = libraries2.firstWhere((LibraryElement library2) { | 55 LibraryElement library2 = libraries2.firstWhere((LibraryElement library2) { |
| 54 return library2.canonicalUri == library1.canonicalUri; | 56 return library2.canonicalUri == library1.canonicalUri; |
| 55 }); | 57 }); |
| 56 Expect.isNotNull(library2, | 58 Expect.isNotNull(library2, |
| 57 "No library found for ${library1.canonicalUri}."); | 59 "No library found for ${library1.canonicalUri}."); |
| 58 checkLibraryContent('library1', 'library2', 'library', library1, library2); | 60 checkLibraryContent('library1', 'library2', 'library', library1, library2); |
| 59 | 61 |
| 60 LibraryElement library3 = libraries3.firstWhere((LibraryElement library3) { | 62 LibraryElement library3 = libraries3.firstWhere((LibraryElement library3) { |
| 61 return library3.canonicalUri == library1.canonicalUri; | 63 return library3.canonicalUri == library1.canonicalUri; |
| 62 }); | 64 }); |
| 63 Expect.isNotNull(library3, | 65 Expect.isNotNull(library3, |
| 64 "No library found for ${library1.canonicalUri}."); | 66 "No library found for ${library1.canonicalUri}."); |
| 65 checkLibraryContent('library1', 'library3', 'library', library1, library3); | 67 checkLibraryContent('library1', 'library3', 'library', library1, library3); |
| 66 } | 68 } |
| 67 | 69 |
| 68 checkAllResolvedAsts(compiler1, compiler2); | 70 checkAllResolvedAsts(compiler1, compiler2); |
| 69 checkAllResolvedAsts(compiler1, compiler3); | 71 checkAllResolvedAsts(compiler1, compiler3); |
| 70 | 72 |
| 71 checkAllImpacts(compiler1, compiler2); | 73 checkAllImpacts(compiler1, compiler2); |
| 72 checkAllImpacts(compiler1, compiler3); | 74 checkAllImpacts(compiler1, compiler3); |
| 73 } | 75 } |
| OLD | NEW |