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

Unified Diff: pkg/analyzer2dart/test/tree_shaker_test.dart

Issue 524463006: Use MockSdk to speed-up tests. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rollback r39701 Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analyzer2dart/test/driver_test.dart ('k') | pkg/pkg.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer2dart/test/tree_shaker_test.dart
diff --git a/pkg/analyzer2dart/test/tree_shaker_test.dart b/pkg/analyzer2dart/test/tree_shaker_test.dart
index 5794cbee663b72953a78dabb031f09fdac38ccd3..cd5b8dd1fdb4d2032d86b63df5ce72a7ccbd100e 100644
--- a/pkg/analyzer2dart/test/tree_shaker_test.dart
+++ b/pkg/analyzer2dart/test/tree_shaker_test.dart
@@ -2,8 +2,11 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+import 'package:analysis_testing/mock_sdk.dart';
import 'package:analyzer/src/generated/ast.dart';
import 'package:analyzer/src/generated/element.dart';
+import 'package:analyzer/src/generated/sdk.dart';
+import 'package:analyzer/src/generated/source.dart';
import 'package:unittest/unittest.dart';
import '../lib/src/closed_world.dart';
@@ -115,9 +118,11 @@ class TreeShakerTestHelper {
* Create a TreeShakerTestHelper based on the given file contents.
*/
TreeShakerTestHelper(String contents) {
- Driver driver = new Driver();
- world =
- driver.computeWorld(driver.resolveEntryPoint(driver.setFakeRoot(contents)));
+ DartSdk sdk = new MockSdk();
+ Driver driver = new Driver(sdk);
+ Source rootSource = driver.setFakeRoot(contents);
+ FunctionElement entryPoint = driver.resolveEntryPoint(rootSource);
+ world = driver.computeWorld(entryPoint);
world.executableElements.forEach(
(ExecutableElement element, Declaration node) {
if (element is FunctionElement) {
« no previous file with comments | « pkg/analyzer2dart/test/driver_test.dart ('k') | pkg/pkg.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698