mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
The bindings, core, and application libraries are now referred to as, e.g.: package:mojo/public/dart/core.dart Since the handle watcher remains in the snapshot, it no longer refers to types defined in core.dart. References to types defined in core.dart are also removed from mojo_natives.cc. In Dart packaged apps, the SDK is zipped up under mojo/public/dart. For embedder tests, the SDK is copied into the generated source output directory. A base_dir parameter is added to the 'dart_package' and 'mojom' GN macros so that consumers of the Mojo SDK can all import using the same URIs regardless of where the SDK lives in their source trees. BUG= R=erg@chromium.org Review URL: https://codereview.chromium.org/1027603002
47 lines
1.4 KiB
Plaintext
47 lines
1.4 KiB
Plaintext
#!mojo mojo:sky_viewer
|
|
<sky>
|
|
<script>
|
|
import '/sky/framework/embedder.dart';
|
|
import 'dart:async';
|
|
import 'dart:typed_data';
|
|
import "dart:sky.internals" as internals;
|
|
|
|
import 'package:mojo/public/dart/bindings.dart';
|
|
import 'package:mojo/public/dart/core.dart';
|
|
import 'package:mojo/services/network/public/interfaces/network_service.mojom.dart';
|
|
import 'package:mojo/services/network/public/interfaces/url_loader.mojom.dart';
|
|
|
|
Future<String> run(url) async {
|
|
var networkService= new NetworkServiceProxy.unbound();
|
|
embedder.connectToService("mojo:network_service", networkService);
|
|
|
|
var urlLoader = new UrlLoaderProxy.unbound();
|
|
networkService.ptr.createUrlLoader(urlLoader);
|
|
|
|
var urlRequest = new UrlRequest()
|
|
..url = url
|
|
..autoFollowRedirects = true;
|
|
var urlResponse = await urlLoader.ptr.start(urlRequest);
|
|
|
|
urlLoader.close();
|
|
networkService.close();
|
|
|
|
print("url => ${urlResponse.response.url}");
|
|
print("status_line => ${urlResponse.response.statusLine}");
|
|
print("mime_type => ${urlResponse.response.mimeType}");
|
|
|
|
ByteData bodyData =
|
|
await DataPipeDrainer.drainHandle(urlResponse.response.body);
|
|
print("read ${bodyData.lengthInBytes} bytes");
|
|
|
|
return new String.fromCharCodes(new Uint8List.view(bodyData.buffer));
|
|
}
|
|
|
|
main() async {
|
|
var url = "http://127.0.0.1:8000/sky/tests/services/resources/pass.txt";
|
|
var result = await run(url);
|
|
internals.notifyTestComplete(result);
|
|
}
|
|
</script>
|
|
</sky>
|