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

Side by Side Diff: tests/compiler/dart2js_extra/deferred_fail_and_retry_test.dart

Issue 2345083003: dart2js: run dartfmt on tests (Closed)
Patch Set: revert another multipart test Created 4 years, 3 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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 // Test that when a deferred import fails to load, it is possible to retry. 5 // Test that when a deferred import fails to load, it is possible to retry.
6 6
7 import "deferred_fail_and_retry_lib.dart" deferred as lib; 7 import "deferred_fail_and_retry_lib.dart" deferred as lib;
8 import "package:expect/expect.dart"; 8 import "package:expect/expect.dart";
9 import "package:async_helper/async_helper.dart"; 9 import "package:async_helper/async_helper.dart";
10 import "dart:js" as js; 10 import "dart:js" as js;
11 11
12 main() { 12 main() {
13 // We patch document.body.appendChild to change the script src on first 13 // We patch document.body.appendChild to change the script src on first
14 // invocation. 14 // invocation.
15 js.context.callMethod("eval", [""" 15 js.context.callMethod("eval", [
16 """
16 if (self.document) { 17 if (self.document) {
17 oldAppendChild = document.body.appendChild; 18 oldAppendChild = document.body.appendChild;
18 document.body.appendChild = function(element) { 19 document.body.appendChild = function(element) {
19 element.src = "non_existing.js"; 20 element.src = "non_existing.js";
20 document.body.appendChild = oldAppendChild; 21 document.body.appendChild = oldAppendChild;
21 document.body.appendChild(element); 22 document.body.appendChild(element);
22 } 23 }
23 } 24 }
24 if (self.load) { 25 if (self.load) {
25 oldLoad = load; 26 oldLoad = load;
26 load = function(uri) { 27 load = function(uri) {
27 load = oldLoad; 28 load = oldLoad;
28 load("non_existing.js"); 29 load("non_existing.js");
29 } 30 }
30 } 31 }
31 """]); 32 """
33 ]);
32 34
33 asyncStart(); 35 asyncStart();
34 lib.loadLibrary().then((_) { 36 lib.loadLibrary().then((_) {
35 Expect.fail("Library should not have loaded"); 37 Expect.fail("Library should not have loaded");
36 }, onError: (error) { 38 }, onError: (error) {
37 lib.loadLibrary().then((_) { 39 lib.loadLibrary().then((_) {
38 Expect.equals("loaded", lib.foo()); 40 Expect.equals("loaded", lib.foo());
39 }, onError: (error) { 41 }, onError: (error) {
40 Expect.fail("Library should have loaded this time"); 42 Expect.fail("Library should have loaded this time");
41 }).whenComplete(() { 43 }).whenComplete(() {
42 asyncEnd(); 44 asyncEnd();
43 }); 45 });
44 }); 46 });
45 } 47 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698