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

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

Issue 1094993002: Fix tests and analysis warnings and release 0.12.0-beta.9. (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 | « pubspec.yaml ('k') | test/runner/browser/content_shell_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") 5 @TestOn("vm")
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:io'; 8 import 'dart:io';
9 9
10 import 'package:test/test.dart'; 10 import 'package:test/test.dart';
11 import 'package:test/src/runner/browser/chrome.dart'; 11 import 'package:test/src/runner/browser/chrome.dart';
12 import 'package:test/src/util/io.dart'; 12 import 'package:test/src/util/io.dart';
13 import 'package:shelf/shelf.dart' as shelf; 13 import 'package:shelf/shelf.dart' as shelf;
14 import 'package:shelf/shelf_io.dart' as shelf_io; 14 import 'package:shelf/shelf_io.dart' as shelf_io;
15 import 'package:shelf_web_socket/shelf_web_socket.dart'; 15 import 'package:shelf_web_socket/shelf_web_socket.dart';
16 16
17 import '../../utils.dart';
18
17 void main() { 19 void main() {
18 group("running JavaScript", () { 20 group("running JavaScript", () {
19 // The JavaScript to serve in the server. We use actual JavaScript here to 21 // The JavaScript to serve in the server. We use actual JavaScript here to
20 // avoid the pain of compiling to JS in a test 22 // avoid the pain of compiling to JS in a test
21 var javaScript; 23 var javaScript;
22 24
23 var servePage = (request) { 25 var servePage = (request) {
24 var path = request.url.path; 26 var path = request.url.path;
25 27
26 // We support both shelf 0.5.x and 0.6.x. The former has a leading "/" 28 // We support both shelf 0.5.x and 0.6.x. The former has a leading "/"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 webSocket.addEventListener("open", function() { 75 webSocket.addEventListener("open", function() {
74 webSocket.send("loaded!"); 76 webSocket.send("loaded!");
75 }); 77 });
76 '''; 78 ''';
77 var chrome = new Chrome(baseUrlForAddress(server.address, server.port)); 79 var chrome = new Chrome(baseUrlForAddress(server.address, server.port));
78 80
79 return webSockets.first.then((webSocket) { 81 return webSockets.first.then((webSocket) {
80 return webSocket.first.then( 82 return webSocket.first.then(
81 (message) => expect(message, equals("loaded!"))); 83 (message) => expect(message, equals("loaded!")));
82 }).whenComplete(chrome.close); 84 }).whenComplete(chrome.close);
83 }); 85 },
86 // It's not clear why, but this test in particular seems to time out
87 // when run in parallel with many other tests.
88 timeout: new Timeout.factor(2));
84 89
85 test("doesn't preserve state across runs", () { 90 test("doesn't preserve state across runs", () {
86 javaScript = ''' 91 javaScript = '''
87 localStorage.setItem("data", "value"); 92 localStorage.setItem("data", "value");
88 93
89 var webSocket = new WebSocket(window.location.href.replace("http://", "ws://")); 94 var webSocket = new WebSocket(window.location.href.replace("http://", "ws://"));
90 webSocket.addEventListener("open", function() { 95 webSocket.addEventListener("open", function() {
91 webSocket.send("done"); 96 webSocket.send("done");
92 }); 97 });
93 '''; 98 ''';
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 return shelf_io.serve(expectAsync((_) {}, count: 0), 'localhost', 0) 133 return shelf_io.serve(expectAsync((_) {}, count: 0), 'localhost', 0)
129 .then((server) { 134 .then((server) {
130 var chrome = new Chrome(baseUrlForAddress(server.address, server.port)); 135 var chrome = new Chrome(baseUrlForAddress(server.address, server.port));
131 return chrome.close().whenComplete(server.close); 136 return chrome.close().whenComplete(server.close);
132 }); 137 });
133 }); 138 });
134 139
135 test("reports an error in onExit", () { 140 test("reports an error in onExit", () {
136 var chrome = new Chrome("http://dart-lang.org", 141 var chrome = new Chrome("http://dart-lang.org",
137 executable: "_does_not_exist"); 142 executable: "_does_not_exist");
138 expect(chrome.onExit, throwsA(new isInstanceOf<ProcessException>())); 143 expect(chrome.onExit, throwsA(isApplicationException(startsWith(
144 "Failed to start Chrome: No such file or directory"))));
139 }); 145 });
140 } 146 }
OLDNEW
« no previous file with comments | « pubspec.yaml ('k') | test/runner/browser/content_shell_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698