Rationalize embedder.dart and shell.dart

This patch combines embedder.dart and shell.dart into one thing. We should now
handle a bunch of error cases better.

  * embedder.connectToApplication has moved to shell.connectToApplication,
    matching the rest of the mojo universe.
  * embedder.connecttoService has moved to shell.connnectToService (and merged
    with shell.requestService).
  * shell.requestService is now shell.connectToService, matching the rest of
    the mojo universe.
  * serviceRegistry has moved from embedder.serviceRegistry to a top-level
    getter.

Fixes #1803
This commit is contained in:
Adam Barth
2015-10-29 10:47:34 -07:00
parent 856ee97892
commit fab160cfce
12 changed files with 84 additions and 112 deletions

View File

@@ -4,13 +4,13 @@ import 'package:flutter/src/services/shell.dart' as shell;
// of Mojo services.
class _ServiceMocker {
_ServiceMocker() {
shell.overrideRequestService = _requestService;
shell.overrideConnectToService = _connectToService;
}
// Map of interface names to mock implementations.
Map<String, Object> _interfaceMock = new Map<String, Object>();
bool _requestService(String url, dynamic proxy) {
bool _connectToService(String url, dynamic proxy) {
Object mock = _interfaceMock[proxy.impl.name];
if (mock != null) {
// Replace the proxy's implementation of the service interface with the