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

Unified Diff: tests/compiler/dart2js/embedded_category_api_boundary_test.dart

Issue 1395863002: Introduce the "Embedded" category. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Fix analyzer test Created 5 years, 2 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 | « tests/compiler/dart2js/categories_test.dart ('k') | tests/compiler/dart2js/library_resolution_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/compiler/dart2js/embedded_category_api_boundary_test.dart
diff --git a/tests/compiler/dart2js/embedded_category_api_boundary_test.dart b/tests/compiler/dart2js/embedded_category_api_boundary_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..cbd973e2a499b57f0c6bf2a42c89fc0e7348cc0d
--- /dev/null
+++ b/tests/compiler/dart2js/embedded_category_api_boundary_test.dart
@@ -0,0 +1,48 @@
+// Copyright (c) 2015, the Fletch project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE.md file.
+
+/// Tests that analyzing everything from the libraries that are public from the
+/// embedded category does not cause elements from other libraries to be
+/// processed.
+library embedded_category_boundary_test;
+
+import 'package:expect/expect.dart';
+import 'package:async_helper/async_helper.dart';
+import 'package:compiler/src/compiler.dart';
+import 'package:compiler/src/elements/elements.dart';
+import 'package:sdk_library_metadata/libraries.dart';
+
+import 'analyze_helper.dart';
+
+main() async {
+ List<Uri> uriList = new List<Uri>();
+ libraries.forEach((String name, LibraryInfo info) {
+ if (info.categories.contains(Category.embedded)) {
+ uriList.add(new Uri(scheme: 'dart', path: name));
+ }
+ });
+ asyncTest(() async {
+ analyze(uriList, {},
+ checkResults: checkResults, analyzeMain: true, analyzeAll: false);
+ });
+}
+
+/// These elements are currently escaping from dart:async via
+/// `core._Resource#_readAsStream`.
+Set<String> whiteList = new Set.from([
+ "function(StreamController#addError)",
+ "getter(StreamController#stream)",
+ "setter(StreamController#onListen)"
+]);
+
+bool checkResults(Compiler compiler, CollectingDiagnosticHandler handler) {
+ return compiler.enqueuer.resolution.processedElements
+ .every((Element element) {
+ if (whiteList.contains("$element")) return true;
+ LibraryInfo info = libraries[element.library.canonicalUri.path];
+ bool isAllowedInEmbedded =
+ info.isInternal || info.categories.contains(Category.embedded);
+ return isAllowedInEmbedded;
+ });
+}
« no previous file with comments | « tests/compiler/dart2js/categories_test.dart ('k') | tests/compiler/dart2js/library_resolution_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698