OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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:io'; | 6 import 'dart:io'; |
7 | 7 |
8 import 'package:mojom/src/command_runner.dart'; | 8 import 'package:mojom/src/command_runner.dart'; |
9 import 'package:mojom/src/utils.dart'; | 9 import 'package:mojom/src/utils.dart'; |
10 import 'package:path/path.dart' as path; | 10 import 'package:path/path.dart' as path; |
11 import 'package:unittest/unittest.dart'; | 11 import 'package:unittest/unittest.dart'; |
12 | 12 |
13 final singlePacakgeMojomContents = ''' | 13 final singlePacakgeMojomContents = ''' |
14 [DartPackage="single_package"] | 14 [DartPackage="single_package"] |
15 module single_package; | 15 module single_package; |
16 struct SinglePackage { | 16 struct SinglePackage { |
17 int32 thingo; | 17 int32 thingo; |
18 }; | 18 }; |
19 '''; | 19 '''; |
20 | 20 |
21 Future runCommand(List<String> args) { | 21 Future runCommand(List<String> args) { |
22 return new MojomCommandRunner().run(args); | 22 return new MojomCommandRunner().run(args); |
23 } | 23 } |
24 | 24 |
25 main() async { | 25 main() async { |
26 String mojoSdk; | 26 String mojoSdk; |
27 if (Platform.environment['MOJO_SDK'] != null) { | 27 if (Platform.environment['MOJO_SDK'] != null) { |
28 mojoSdk = Platform.environment['MOJO_SDK']; | 28 mojoSdk = Platform.environment['MOJO_SDK']; |
29 } else { | 29 } else { |
30 mojoSdk = path.normalize( | 30 mojoSdk = path.normalize(path.join( |
31 path.join(path.dirname(Platform.script.path), '..', '..', '..')); | 31 path.dirname(Platform.script.path), '..', '..', '..', '..', 'public')); |
32 } | 32 } |
33 if (!await new Directory(mojoSdk).exists()) { | 33 if (!await new Directory(mojoSdk).exists()) { |
34 fail("Could not find the Mojo SDK"); | 34 fail("Could not find the Mojo SDK"); |
35 } | 35 } |
36 | 36 |
37 final scriptPath = path.dirname(Platform.script.path); | 37 final scriptPath = path.dirname(Platform.script.path); |
38 | 38 |
39 // //test_mojoms/mojom | 39 // //test_mojoms/mojom |
40 final testMojomPath = path.join(scriptPath, 'test_mojoms'); | 40 final testMojomPath = path.join(scriptPath, 'test_mojoms'); |
41 | 41 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 singlePackageLibPath, 'single_package', 'single_package.mojom.dart'); | 109 singlePackageLibPath, 'single_package', 'single_package.mojom.dart'); |
110 final resultFile = new File(resultPath); | 110 final resultFile = new File(resultPath); |
111 expect(await resultFile.exists(), isTrue); | 111 expect(await resultFile.exists(), isTrue); |
112 | 112 |
113 // There should be no stray .mojoms file haning around. | 113 // There should be no stray .mojoms file haning around. |
114 final mojomsFile = new File(singlePackageMojomsPath); | 114 final mojomsFile = new File(singlePackageMojomsPath); |
115 expect(await mojomsFile.exists(), isFalse); | 115 expect(await mojomsFile.exists(), isFalse); |
116 }); | 116 }); |
117 }); | 117 }); |
118 } | 118 } |
OLD | NEW |