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

Side by Side Diff: lib/src/runner/browser/browser_manager.dart

Issue 1086213002: Support a @Timeout annotation. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Fix isolate_listener_test. 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/backend/metadata.dart ('k') | lib/src/runner/browser/iframe_listener.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 library test.runner.browser.browser_manager; 5 library test.runner.browser.browser_manager;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:convert'; 8 import 'dart:convert';
9 9
10 import 'package:http_parser/http_parser.dart'; 10 import 'package:http_parser/http_parser.dart';
(...skipping 20 matching lines...) Expand all
31 /// [webSocket]. 31 /// [webSocket].
32 BrowserManager(CompatibleWebSocket webSocket) 32 BrowserManager(CompatibleWebSocket webSocket)
33 : _channel = new MultiChannel( 33 : _channel = new MultiChannel(
34 webSocket.map(JSON.decode), 34 webSocket.map(JSON.decode),
35 mapSink(webSocket, JSON.encode)); 35 mapSink(webSocket, JSON.encode));
36 36
37 /// Tells the browser the load a test suite from the URL [url]. 37 /// Tells the browser the load a test suite from the URL [url].
38 /// 38 ///
39 /// [url] should be an HTML page with a reference to the JS-compiled test 39 /// [url] should be an HTML page with a reference to the JS-compiled test
40 /// suite. [path] is the path of the original test suite file, which is used 40 /// suite. [path] is the path of the original test suite file, which is used
41 /// for reporting. 41 /// for reporting. [metadata] is the parsed metadata for the test suite.
42 Future<Suite> loadSuite(String path, Uri url) { 42 Future<Suite> loadSuite(String path, Uri url, Metadata metadata) {
43 url = url.replace(
44 fragment: Uri.encodeFull(JSON.encode(metadata.serialize())));
45
43 var suiteChannel = _channel.virtualChannel(); 46 var suiteChannel = _channel.virtualChannel();
44 _channel.sink.add({ 47 _channel.sink.add({
45 "command": "loadSuite", 48 "command": "loadSuite",
46 "url": url.toString(), 49 "url": url.toString(),
47 "channel": suiteChannel.id 50 "channel": suiteChannel.id,
kevmoo 2015/04/15 22:29:08 extra comma?
nweiz 2015/04/15 22:58:21 Done.
48 }); 51 });
49 52
50 // Create a nested MultiChannel because the iframe will be using a channel 53 // Create a nested MultiChannel because the iframe will be using a channel
51 // wrapped within the host's channel. 54 // wrapped within the host's channel.
52 suiteChannel = new MultiChannel(suiteChannel.stream, suiteChannel.sink); 55 suiteChannel = new MultiChannel(suiteChannel.stream, suiteChannel.sink);
53 56
54 // The stream may close before emitting a value if the browser is killed 57 // The stream may close before emitting a value if the browser is killed
55 // prematurely (e.g. via Control-C). 58 // prematurely (e.g. via Control-C).
56 return maybeFirst(suiteChannel.stream).then((response) { 59 return maybeFirst(suiteChannel.stream).then((response) {
57 if (response == null) return null; 60 if (response == null) return null;
58 61
59 if (response["type"] == "loadException") { 62 if (response["type"] == "loadException") {
60 return new Future.error(new LoadException(path, response["message"])); 63 return new Future.error(new LoadException(path, response["message"]));
61 } else if (response["type"] == "error") { 64 } else if (response["type"] == "error") {
62 var asyncError = RemoteException.deserialize(response["error"]); 65 var asyncError = RemoteException.deserialize(response["error"]);
63 return new Future.error( 66 return new Future.error(
64 new LoadException(path, asyncError.error), 67 new LoadException(path, asyncError.error),
65 asyncError.stackTrace); 68 asyncError.stackTrace);
66 } 69 }
67 70
68 return new Suite(response["tests"].map((test) { 71 return new Suite(response["tests"].map((test) {
69 var metadata = new Metadata.deserialize(test['metadata']); 72 var testMetadata = new Metadata.deserialize(test['metadata']);
70 var testChannel = suiteChannel.virtualChannel(test['channel']); 73 var testChannel = suiteChannel.virtualChannel(test['channel']);
71 return new IframeTest(test['name'], metadata, testChannel); 74 return new IframeTest(test['name'], testMetadata, testChannel);
72 }), path: path); 75 }), metadata: metadata, path: path);
73 }); 76 });
74 } 77 }
75 } 78 }
OLDNEW
« no previous file with comments | « lib/src/backend/metadata.dart ('k') | lib/src/runner/browser/iframe_listener.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698