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

Side by Side Diff: test/runner/browser/internet_explorer_test.dart

Issue 1088933006: Add IE support. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Code review changes Created 5 years, 8 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
« no previous file with comments | « lib/src/runner/browser/server.dart ('k') | test/runner/runner_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 @TestOn("vm && mac-os") 5 @TestOn("vm && windows")
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:test/test.dart'; 9 import 'package:test/test.dart';
10 import 'package:test/src/runner/browser/safari.dart'; 10 import 'package:test/src/runner/browser/internet_explorer.dart';
11 import 'package:test/src/util/io.dart'; 11 import 'package:test/src/util/io.dart';
12 import 'package:shelf/shelf.dart' as shelf; 12 import 'package:shelf/shelf.dart' as shelf;
13 import 'package:shelf/shelf_io.dart' as shelf_io; 13 import 'package:shelf/shelf_io.dart' as shelf_io;
14 import 'package:shelf_web_socket/shelf_web_socket.dart'; 14 import 'package:shelf_web_socket/shelf_web_socket.dart';
15 15
16 import '../../io.dart'; 16 import '../../io.dart';
17 import '../../utils.dart'; 17 import '../../utils.dart';
18 18
19 void main() { 19 void main() {
20 group("running JavaScript", () { 20 group("running JavaScript", () {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 }); 62 });
63 63
64 tearDown(() { 64 tearDown(() {
65 if (server != null) server.close(); 65 if (server != null) server.close();
66 66
67 javaScript = null; 67 javaScript = null;
68 server = null; 68 server = null;
69 webSockets = null; 69 webSockets = null;
70 }); 70 });
71 71
72 test("starts Safari with the given URL", () { 72 test("starts IE with the given URL", () {
73 javaScript = ''' 73 javaScript = '''
74 var webSocket = new WebSocket(window.location.href.replace("http://", "ws://")); 74 var webSocket = new WebSocket(window.location.href.replace("http://", "ws://"));
75 webSocket.addEventListener("open", function() { 75 webSocket.addEventListener("open", function() {
76 webSocket.send("loaded!"); 76 webSocket.send("loaded!");
77 }); 77 });
78 '''; 78 ''';
79 var safari = new Safari(baseUrlForAddress(server.address, server.port)); 79 var ie = new InternetExplorer(
80 baseUrlForAddress(server.address, server.port));
80 81
81 return webSockets.first.then((webSocket) { 82 return webSockets.first.then((webSocket) {
82 return webSocket.first.then( 83 return webSocket.first.then(
83 (message) => expect(message, equals("loaded!"))); 84 (message) => expect(message, equals("loaded!")));
84 }).whenComplete(safari.close); 85 }).whenComplete(ie.close);
85 });
86
87 test("doesn't preserve state across runs", () {
88 javaScript = '''
89 localStorage.setItem("data", "value");
90
91 var webSocket = new WebSocket(window.location.href.replace("http://", "ws://"));
92 webSocket.addEventListener("open", function() {
93 webSocket.send("done");
94 });
95 ''';
96 var safari = new Safari(baseUrlForAddress(server.address, server.port));
97
98 var first = true;
99 webSockets.listen(expectAsync((webSocket) {
100 if (first) {
101 // The first request will set local storage data. We can't kill the
102 // old safari and start a new one until we're sure that that has
103 // finished.
104 webSocket.first.then((_) {
105 safari.close();
106
107 javaScript = '''
108 var webSocket = new WebSocket(window.location.href.replace("http://", "ws://"));
109 webSocket.addEventListener("open", function() {
110 webSocket.send(localStorage.getItem("data"));
111 });
112 ''';
113 safari = new Safari(baseUrlForAddress(server.address, server.port));
114 first = false;
115 });
116 } else {
117 // The second request will return the local storage data. This should
118 // be null, indicating that no data was saved between runs.
119 expect(
120 webSocket.first
121 .then((message) => expect(message, equals('null')))
122 .whenComplete(safari.close),
123 completes);
124 }
125 }, count: 2));
126 }); 86 });
127 }); 87 });
128 88
129 test("a process can be killed synchronously after it's started", () { 89 test("a process can be killed synchronously after it's started", () {
130 return shelf_io.serve(expectAsync((_) {}, count: 0), 'localhost', 0) 90 return shelf_io.serve(expectAsync((_) {}, count: 0), 'localhost', 0)
131 .then((server) { 91 .then((server) {
132 var safari = new Safari(baseUrlForAddress(server.address, server.port)); 92 var ie = new InternetExplorer(
133 return safari.close().whenComplete(server.close); 93 baseUrlForAddress(server.address, server.port));
94 return ie.close().whenComplete(server.close);
134 }); 95 });
135 }); 96 });
136 97
137 test("reports an error in onExit", () { 98 test("reports an error in onExit", () {
138 var safari = new Safari("http://dart-lang.org", 99 var ie = new InternetExplorer("http://dart-lang.org",
139 executable: "_does_not_exist"); 100 executable: "_does_not_exist");
140 expect(safari.onExit, throwsA(isApplicationException(startsWith( 101 expect(ie.onExit, throwsA(isApplicationException(startsWith(
141 "Failed to start Safari: $noSuchFileMessage")))); 102 "Failed to start Internet Explorer: $noSuchFileMessage"))));
142 }); 103 });
143 } 104 }
OLDNEW
« no previous file with comments | « lib/src/runner/browser/server.dart ('k') | test/runner/runner_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698