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

Side by Side Diff: pkg/front_end/test/src/incremental/file_state_test.dart

Issue 2939823002: Extract computing UnlinkedUnit(s) and cache them in ByteStore. (Closed)
Patch Set: Created 3 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
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, 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 import 'dart:async'; 5 import 'dart:async';
6 6
7 import 'package:front_end/memory_file_system.dart'; 7 import 'package:front_end/memory_file_system.dart';
8 import 'package:front_end/src/fasta/translate_uri.dart'; 8 import 'package:front_end/src/fasta/translate_uri.dart';
9 import 'package:front_end/src/incremental/byte_store.dart';
9 import 'package:front_end/src/incremental/file_state.dart'; 10 import 'package:front_end/src/incremental/file_state.dart';
10 import 'package:test/test.dart'; 11 import 'package:test/test.dart';
11 import 'package:test_reflective_loader/test_reflective_loader.dart'; 12 import 'package:test_reflective_loader/test_reflective_loader.dart';
12 13
13 import 'mock_sdk.dart'; 14 import 'mock_sdk.dart';
14 15
15 main() { 16 main() {
16 defineReflectiveSuite(() { 17 defineReflectiveSuite(() {
17 defineReflectiveTests(FileSystemStateTest); 18 defineReflectiveTests(FileSystemStateTest);
18 }); 19 });
19 } 20 }
20 21
21 @reflectiveTest 22 @reflectiveTest
22 class FileSystemStateTest { 23 class FileSystemStateTest {
24 final byteStore = new MemoryByteStore();
23 final fileSystem = new MemoryFileSystem(Uri.parse('file:///')); 25 final fileSystem = new MemoryFileSystem(Uri.parse('file:///'));
24 final TranslateUri uriTranslator = new TranslateUri({}, {}, {}); 26 final TranslateUri uriTranslator = new TranslateUri({}, {}, {});
25 FileSystemState fsState; 27 FileSystemState fsState;
26 28
27 Uri _coreUri; 29 Uri _coreUri;
28 List<Uri> _newFileUris = <Uri>[]; 30 List<Uri> _newFileUris = <Uri>[];
29 31
30 void setUp() { 32 void setUp() {
31 Map<String, Uri> dartLibraries = createSdkFiles(fileSystem); 33 Map<String, Uri> dartLibraries = createSdkFiles(fileSystem);
32 uriTranslator.dartLibraries.addAll(dartLibraries); 34 uriTranslator.dartLibraries.addAll(dartLibraries);
33 _coreUri = Uri.parse('dart:core'); 35 _coreUri = Uri.parse('dart:core');
34 expect(_coreUri, isNotNull); 36 expect(_coreUri, isNotNull);
35 fsState = new FileSystemState(fileSystem, uriTranslator, <int>[], (uri) { 37 fsState = new FileSystemState(byteStore, fileSystem, uriTranslator, <int>[],
38 (uri) {
36 _newFileUris.add(uri); 39 _newFileUris.add(uri);
37 return new Future.value(); 40 return new Future.value();
38 }); 41 });
39 } 42 }
40 43
41 test_apiSignature() async { 44 test_apiSignature() async {
42 var path = '/a.dart'; 45 var path = '/a.dart';
43 var uri = writeFile(path, ''); 46 var uri = writeFile(path, '');
44 FileState file = await fsState.getFile(uri); 47 FileState file = await fsState.getFile(uri);
45 48
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 Uri _writeFileDirectives(String path, 511 Uri _writeFileDirectives(String path,
509 {List<String> imports: const [], List<String> exports: const []}) { 512 {List<String> imports: const [], List<String> exports: const []}) {
510 return writeFile( 513 return writeFile(
511 path, 514 path,
512 ''' 515 '''
513 ${imports.map((uri) => 'import "$uri";').join('\n')} 516 ${imports.map((uri) => 'import "$uri";').join('\n')}
514 ${exports.map((uri) => 'export "$uri";').join('\n')} 517 ${exports.map((uri) => 'export "$uri";').join('\n')}
515 '''); 518 ''');
516 } 519 }
517 } 520 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698