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

Unified Diff: tests/html/utils.dart

Issue 2980303002: Revert "Remove several packages from DEPS" (Closed)
Patch Set: Created 3 years, 5 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 | « DEPS ('k') | tests/lib_strong/html/utils.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/html/utils.dart
diff --git a/tests/html/utils.dart b/tests/html/utils.dart
index 4209f9bd3ea1d962bf36b9e82a7316eba5c41d9b..8d941d7b3ad1ddf3a3a352a7e6003263a4e363cd 100644
--- a/tests/html/utils.dart
+++ b/tests/html/utils.dart
@@ -5,6 +5,7 @@ import 'dart:html';
import 'dart:js' as js;
import 'dart:typed_data';
import 'package:unittest/unittest.dart';
+export 'package:web_components/polyfill.dart';
/**
* Verifies that [actual] has the same graph structure as [expected].
@@ -166,54 +167,3 @@ void upgradeCustomElements(Node node) {
js.context['CustomElements'].callMethod('upgradeAll', [node]);
}
}
-
-/**
- * A future that completes once all custom elements in the initial HTML page
- * have been upgraded.
- *
- * This is needed because the native implementation can update the elements
- * while parsing the HTML document, but the custom element polyfill cannot,
- * so it completes this future once all elements are upgraded.
- */
-// TODO(jmesserly): rename to webComponentsReady to match the event?
-Future customElementsReady = () {
- if (_isReady) return new Future.value();
-
- // Not upgraded. Wait for the polyfill to fire the WebComponentsReady event.
- // Note: we listen on document (not on document.body) to allow this polyfill
- // to be loaded in the HEAD element.
- return document.on['WebComponentsReady'].first;
-}();
-
-// Return true if we are using the polyfill and upgrade is complete, or if we
-// have native document.register and therefore the browser took care of it.
-// Otherwise return false, including the case where we can't find the polyfill.
-bool get _isReady {
- // If we don't have dart:js, assume things are ready
- if (js.context == null) return true;
-
- var customElements = js.context['CustomElements'];
- if (customElements == null) {
- // Return true if native document.register, otherwise false.
- // (Maybe the polyfill isn't loaded yet. Wait for it.)
- return document.supportsRegisterElement;
- }
-
- return customElements['ready'] == true;
-}
-
-/**
- * *Note* this API is primarily intended for tests. In other code it is better
- * to write it in a style that works with or without the polyfill, rather than
- * using this method.
- *
- * Synchronously trigger evaluation of pending lifecycle events, which otherwise
- * need to wait for a [MutationObserver] to signal the changes in the polyfill.
- * This method can be used to resolve differences in timing between native and
- * polyfilled custom elements.
- */
-void customElementsTakeRecords([Node node]) {
- var customElements = js.context['CustomElements'];
- if (customElements == null) return;
- customElements.callMethod('takeRecords', [node]);
-}
« no previous file with comments | « DEPS ('k') | tests/lib_strong/html/utils.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698