blob: a802be2d45306b88d2a7f3a0ac322489309561a0 [file] [log] [blame]
// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
// 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.
import "../runner/browser/post_message_channel.dart";
import "../runner/plugin/remote_platform_helpers.dart";
import "../util/stack_trace_mapper.dart";
/// Bootstraps a browser test to communicate with the test runner.
///
/// This should NOT be used directly, instead use the `test/pub_serve`
/// transformer which will bootstrap your test and call this method.
void internalBootstrapBrowserTest(Function getMain()) {
var channel =
serializeSuite(getMain, hidePrints: false, beforeLoad: () async {
var serialized = await suiteChannel("test.browser.mapper").stream.first;
if (serialized == null) return;
setStackTraceMapper(StackTraceMapper.deserialize(serialized));
});
postMessageChannel().pipe(channel);
}