Mojo JS Bindings: merge Application, Shell, ServiceProvider with Sky
Enable Sky applications to be written in terms of the Application, Shell, ServiceProvider classes. Add a shellProxyHandle() method to the Sky Internals class. It returns a message pipe handle that the JS Shell class will assume ownership of. BUG= R=abarth@chromium.org Review URL: https://codereview.chromium.org/837283002
This commit is contained in:
parent
619808fe2f
commit
5233793bd5
@ -5,28 +5,26 @@
|
||||
<import src="/mojo/public/sky/connection.sky" as="connection" />
|
||||
<import src="/mojo/services/network/public/interfaces/network_service.mojom.sky" as="net" />
|
||||
<import src="/mojo/services/network/public/interfaces/url_loader.mojom.sky" as="loader" />
|
||||
<import src="/mojo/services/public/sky/application.sky" as="application" />
|
||||
<script>
|
||||
describe('Mojo network_service', function() {
|
||||
this.enableTimeouts(false);
|
||||
|
||||
it('should be able to fetch text files', function(done) {
|
||||
var netServiceHandle = internals.connectToService(
|
||||
"mojo:network_service", "mojo::NetworkService");
|
||||
var netConnection = new connection.Connection(
|
||||
netServiceHandle,
|
||||
net.NetworkService.stubClass,
|
||||
net.NetworkService.proxyClass);
|
||||
var urlLoaderPipe = new core.createMessagePipe();
|
||||
netConnection.remote.createURLLoader(urlLoaderPipe.handle1);
|
||||
var urlLoaderConnection = new connection.Connection(
|
||||
urlLoaderPipe.handle0,
|
||||
loader.URLLoader.stubClass,
|
||||
loader.URLLoader.proxyClass);
|
||||
var app = new application.Application(internals.passShellProxyHandle());
|
||||
var netService = app.shell.connectToService(
|
||||
"mojo:network_service", net.NetworkService);
|
||||
|
||||
var urlLoader;
|
||||
netService.createURLLoader(function(urlLoaderProxy) {
|
||||
urlLoader = urlLoaderProxy;
|
||||
});
|
||||
|
||||
var urlRequest = new loader.URLRequest();
|
||||
urlRequest.url = "http://127.0.0.1:8000/sky/tests/services/resources/pass.txt";
|
||||
urlRequest.method = "GET";
|
||||
urlRequest.auto_follow_redirects = true;
|
||||
var urlRequestPromise = urlLoaderConnection.remote.start(urlRequest);
|
||||
var urlRequestPromise = urlLoader.start(urlRequest);
|
||||
urlRequestPromise.then(function(result) {
|
||||
console.log("url => " + result.response["url"]);
|
||||
console.log("status_line => " + result.response["status_line"]);
|
||||
|
@ -54,6 +54,8 @@ class SkyDebugger(object):
|
||||
parser.add_argument('--use-osmesa', action='store_true',
|
||||
default=self._in_chromoting())
|
||||
parser.add_argument('url_or_path', nargs='?', type=str)
|
||||
parser.add_argument('--show-command', action='store_true',
|
||||
help='Display the shell command and exit')
|
||||
configuration.add_arguments(parser)
|
||||
args = parser.parse_args()
|
||||
|
||||
@ -89,6 +91,15 @@ class SkyDebugger(object):
|
||||
subprocess.check_call(shell_command)
|
||||
else:
|
||||
subprocess.check_call(shell_command)
|
||||
if args.show_command:
|
||||
print " ".join(shell_command)
|
||||
else:
|
||||
subprocess.check_call(shell_command)
|
||||
|
||||
def shutdown(self):
|
||||
print "Quitting"
|
||||
if self._sky_server:
|
||||
self._sky_server.terminate()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
Loading…
x
Reference in New Issue
Block a user