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

Unified Diff: lib/src/runner/browser/iframe_test.dart

Issue 971103002: Add BrowserManager and IframeTest for communicating with browser tests. (Closed) Base URL: git@github.com:dart-lang/unittest@master
Patch Set: Fix errors Created 5 years, 10 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 | « lib/src/runner/browser/browser_manager.dart ('k') | lib/src/utils.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/runner/browser/iframe_test.dart
diff --git a/lib/src/runner/isolate_test.dart b/lib/src/runner/browser/iframe_test.dart
similarity index 57%
copy from lib/src/runner/isolate_test.dart
copy to lib/src/runner/browser/iframe_test.dart
index 7914ca75732b42a4fcf7ee656620515be7bed0a5..e4aee5282384ecf711ae2d81ef41e2c58045615d 100644
--- a/lib/src/runner/isolate_test.dart
+++ b/lib/src/runner/browser/iframe_test.dart
@@ -2,40 +2,37 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-library unittest.runner.isolate_test;
-
-import 'dart:isolate';
-
-import '../backend/live_test.dart';
-import '../backend/live_test_controller.dart';
-import '../backend/state.dart';
-import '../backend/suite.dart';
-import '../backend/test.dart';
-import '../util/remote_exception.dart';
-
-/// A test in another isolate.
-class IsolateTest implements Test {
+library unittest.runner.browser.iframe_test;
+
+import '../../backend/live_test.dart';
+import '../../backend/live_test_controller.dart';
+import '../../backend/state.dart';
+import '../../backend/suite.dart';
+import '../../backend/test.dart';
+import '../../util/multi_channel.dart';
+import '../../util/remote_exception.dart';
+
+/// A test in a running iframe.
+class IframeTest implements Test {
final String name;
- /// The port on which to communicate with the remote test.
- final SendPort _sendPort;
+ /// The channel used to communicate with the test's [IframeListener].
+ final MultiChannel _channel;
- IsolateTest(this.name, this._sendPort);
+ IframeTest(this.name, this._channel);
- /// Loads a single runnable instance of this test.
LiveTest load(Suite suite) {
- var receivePort;
var controller;
controller = new LiveTestController(suite, this, () {
controller.setState(const State(Status.running, Result.success));
- receivePort = new ReceivePort();
- _sendPort.send({
+ var testChannel = _channel.virtualChannel();
+ _channel.sink.add({
'command': 'run',
- 'reply': receivePort.sendPort
+ 'channel': testChannel.id
});
- receivePort.listen((message) {
+ testChannel.stream.listen((message) {
if (message['type'] == 'error') {
var asyncError = RemoteException.deserialize(message['error']);
controller.addError(asyncError.error, asyncError.stackTrace);
@@ -49,8 +46,6 @@ class IsolateTest implements Test {
controller.completer.complete();
}
});
- }, onClose: () {
- if (receivePort != null) receivePort.close();
});
return controller.liveTest;
}
« no previous file with comments | « lib/src/runner/browser/browser_manager.dart ('k') | lib/src/utils.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698