Fix warnings.
Format files.
diff --git a/bin/multiplex.dart b/bin/multiplex.dart
index 05c3b67..69b87f5 100644
--- a/bin/multiplex.dart
+++ b/bin/multiplex.dart
@@ -14,11 +14,12 @@
main(List<String> argv) async {
var args = (new ArgParser()
- ..addFlag('verbose', abbr: 'v', defaultsTo: false, negatable: false)
- ..addFlag('model_dom', defaultsTo: false, negatable: true)
- ..addOption('chrome_host', defaultsTo: 'localhost')
- ..addOption('chrome_port', defaultsTo: '9222')
- ..addOption('listen_port', defaultsTo: '9223')).parse(argv);
+ ..addFlag('verbose', abbr: 'v', defaultsTo: false, negatable: false)
+ ..addFlag('model_dom', defaultsTo: false, negatable: true)
+ ..addOption('chrome_host', defaultsTo: 'localhost')
+ ..addOption('chrome_port', defaultsTo: '9222')
+ ..addOption('listen_port', defaultsTo: '9223'))
+ .parse(argv);
hierarchicalLoggingEnabled = true;
diff --git a/lib/dom_model.dart b/lib/dom_model.dart
index bf34846..f395974 100644
--- a/lib/dom_model.dart
+++ b/lib/dom_model.dart
@@ -43,30 +43,30 @@
Stream<SetChildNodesEvent> onSetChildNodes;
WipDomModel(this._dom) {
- onAttributeModified = new StreamTransformer.fromHandlers(
- handleData: _onAttributeModified).bind(_dom.onAttributeModified)
- ..listen(_logEvent);
- onAttributeRemoved = new StreamTransformer.fromHandlers(
- handleData: _onAttributeRemoved).bind(_dom.onAttributeRemoved)
- ..listen(_logEvent);
- onCharacterDataModified = new StreamTransformer.fromHandlers(
- handleData: _onCharacterDataModified).bind(_dom.onCharacterDataModified)
- ..listen(_logEvent);
- onChildNodeCountUpdated = new StreamTransformer.fromHandlers(
- handleData: _onChildNodeCountUpdated).bind(_dom.onChildNodeCountUpdated)
- ..listen(_logEvent);
- onChildNodeInserted = new StreamTransformer.fromHandlers(
- handleData: _onChildNodeInserted).bind(_dom.onChildNodeInserted)
- ..listen(_logEvent);
- onChildNodeRemoved = new StreamTransformer.fromHandlers(
- handleData: _onChildNodeRemoved).bind(_dom.onChildNodeRemoved)
- ..listen(_logEvent);
- onDocumentUpdated = new StreamTransformer.fromHandlers(
- handleData: _onDocumentUpdated).bind(_dom.onDocumentUpdated)
- ..listen(_logEvent);
- onSetChildNodes = new StreamTransformer.fromHandlers(
- handleData: _onSetChildNodes).bind(_dom.onSetChildNodes)
- ..listen(_logEvent);
+ onAttributeModified =
+ new StreamTransformer.fromHandlers(handleData: _onAttributeModified)
+ .bind(_dom.onAttributeModified)..listen(_logEvent);
+ onAttributeRemoved =
+ new StreamTransformer.fromHandlers(handleData: _onAttributeRemoved)
+ .bind(_dom.onAttributeRemoved)..listen(_logEvent);
+ onCharacterDataModified =
+ new StreamTransformer.fromHandlers(handleData: _onCharacterDataModified)
+ .bind(_dom.onCharacterDataModified)..listen(_logEvent);
+ onChildNodeCountUpdated =
+ new StreamTransformer.fromHandlers(handleData: _onChildNodeCountUpdated)
+ .bind(_dom.onChildNodeCountUpdated)..listen(_logEvent);
+ onChildNodeInserted =
+ new StreamTransformer.fromHandlers(handleData: _onChildNodeInserted)
+ .bind(_dom.onChildNodeInserted)..listen(_logEvent);
+ onChildNodeRemoved =
+ new StreamTransformer.fromHandlers(handleData: _onChildNodeRemoved)
+ .bind(_dom.onChildNodeRemoved)..listen(_logEvent);
+ onDocumentUpdated =
+ new StreamTransformer.fromHandlers(handleData: _onDocumentUpdated)
+ .bind(_dom.onDocumentUpdated)..listen(_logEvent);
+ onSetChildNodes =
+ new StreamTransformer.fromHandlers(handleData: _onSetChildNodes)
+ .bind(_dom.onSetChildNodes)..listen(_logEvent);
}
_logEvent(WipEvent event) {
diff --git a/lib/forwarder.dart b/lib/forwarder.dart
index 7dc5822..391244e 100644
--- a/lib/forwarder.dart
+++ b/lib/forwarder.dart
@@ -4,13 +4,7 @@
library crmux.forwarder;
import 'dart:async'
- show
- Completer,
- Future,
- Stream,
- StreamController,
- StreamSink,
- StreamSubscription;
+ show Future, Stream, StreamController, StreamSink, StreamSubscription;
import 'dart:convert' show JSON;
import 'package:logging/logging.dart' show Logger;
@@ -28,6 +22,7 @@
final StreamSink _out;
final WipConnection _debugger;
final WipDom domModel;
+
/// If false, no Debugger.paused events will be forwarded back to the
/// client. This gets automatically set to true if a breakpoint is set
/// by the client.
diff --git a/lib/multiplex.dart b/lib/multiplex.dart
index 7b5b1f7..992564c 100644
--- a/lib/multiplex.dart
+++ b/lib/multiplex.dart
@@ -5,7 +5,7 @@
import 'dart:async' show Future;
import 'dart:convert' show JSON;
-import 'dart:io' show HttpClientResponse, HttpServer, InternetAddress;
+import 'dart:io' show HttpServer, InternetAddress;
import 'package:logging/logging.dart' show Logger;
import 'package:shelf/shelf.dart' as shelf;
diff --git a/lib/src/debugger.dart b/lib/src/debugger.dart
index 7c70557..f10d12a 100644
--- a/lib/src/debugger.dart
+++ b/lib/src/debugger.dart
@@ -18,9 +18,9 @@
Future enable() => _sendCommand('Debugger.enable');
Future disable() => _sendCommand('Debugger.disable');
- Future<String> getScriptSource(String scriptId) async => (await _sendCommand(
- 'Debugger.getScriptSource', {'scriptId': scriptId})).result[
- 'scriptSource'];
+ Future<String> getScriptSource(String scriptId) async =>
+ (await _sendCommand('Debugger.getScriptSource', {'scriptId': scriptId}))
+ .result['scriptSource'];
Future pause() => _sendCommand('Debugger.pause');
Future resume() => _sendCommand('Debugger.resume');
diff --git a/lib/src/dom.dart b/lib/src/dom.dart
index c7c5a49..0486ada 100644
--- a/lib/src/dom.dart
+++ b/lib/src/dom.dart
@@ -17,13 +17,18 @@
Future<Node> getDocument() async =>
new Node((await _sendCommand('DOM.getDocument')).result['root']);
- Future<String> getOuterHtml(int nodeId) async => (await _sendCommand(
- 'DOM.getOuterHTML', {'nodeId': nodeId})).result['root'];
+ Future<String> getOuterHtml(int nodeId) async =>
+ (await _sendCommand('DOM.getOuterHTML', {'nodeId': nodeId})).result[
+ 'root'];
Future hideHighlight() => _sendCommand('DOM.hideHighlight');
- Future highlightNode(int nodeId, {Rgba borderColor, Rgba contentColor,
- Rgba marginColor, Rgba paddingColor, bool showInfo}) {
+ Future highlightNode(int nodeId,
+ {Rgba borderColor,
+ Rgba contentColor,
+ Rgba marginColor,
+ Rgba paddingColor,
+ bool showInfo}) {
var params = {'nodeId': nodeId, 'highlightConfig': {}};
if (borderColor != null) {
@@ -113,11 +118,8 @@
}
Future setAttributeValue(int nodeId, String name, String value) =>
- _sendCommand('DOM.setAttributeValue', {
- 'nodeId': nodeId,
- 'name': name,
- 'value': value
- });
+ _sendCommand('DOM.setAttributeValue',
+ {'nodeId': nodeId, 'name': name, 'value': value});
Future setAttributesAsText(int nodeId, String text, {String name}) {
var params = {'nodeId': nodeId, 'text': text};
diff --git a/lib/webkit_inspection_protocol.dart b/lib/webkit_inspection_protocol.dart
index 7c00e60..6f868b0 100644
--- a/lib/webkit_inspection_protocol.dart
+++ b/lib/webkit_inspection_protocol.dart
@@ -257,24 +257,27 @@
Stream<WipDomain> get onClosed => _onClosed;
WipDomain(WipConnection connection) : this.connection = connection {
- this._onClosed = new StreamTransformer.fromHandlers(
- handleData: (event, EventSink sink) {
+ this._onClosed =
+ new StreamTransformer.fromHandlers(handleData: (event, EventSink sink) {
sink.add(this);
}).bind(connection.onClose);
}
Stream<WipEvent> _eventStream(
- String method, WipEventTransformer transformer) => _eventStreams
- .putIfAbsent(method, () => new StreamTransformer.fromHandlers(
- handleData: (WipEvent event, EventSink<WipEvent> sink) {
- if (event.method == method) {
- _log.finest('Transforming $event to $method');
- sink.add(transformer(event));
- }
- }).bind(connection.onNotification));
+ String method, WipEventTransformer transformer) =>
+ _eventStreams.putIfAbsent(
+ method,
+ () => new StreamTransformer.fromHandlers(
+ handleData: (WipEvent event, EventSink<WipEvent> sink) {
+ if (event.method == method) {
+ _log.finest('Transforming $event to $method');
+ sink.add(transformer(event));
+ }
+ }).bind(connection.onNotification));
Future<WipResponse> _sendCommand(String method,
- [Map<String, dynamic> params]) => connection.sendCommand(method, params);
+ [Map<String, dynamic> params]) =>
+ connection.sendCommand(method, params);
}
class _WrappedWipEvent implements WipEvent {
diff --git a/pubspec.yaml b/pubspec.yaml
index 1b98699..c6b5867 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,5 +1,5 @@
name: webkit_inspection_protocol
-version: 0.2.1
+version: 0.2.1+1
description: A client for the Webkit Inspection Protocol (WIP).
homepage: https://github.com/google/webkit_inspection_protocol.dart
diff --git a/test/test_setup.dart b/test/test_setup.dart
index cd1a9c0..c115716 100644
--- a/test/test_setup.dart
+++ b/test/test_setup.dart
@@ -9,6 +9,7 @@
import 'package:webkit_inspection_protocol/webkit_inspection_protocol.dart';
var _wipConnection;
+
/// Returns a (cached) debugger connection to the first regular tab of
/// the browser with remote debugger running at 'localhost:9222',
Future<WipConnection> get wipConnection {
@@ -26,6 +27,7 @@
}
var _testServerUri;
+
/// Ensures that an HTTP server serving files from 'test/data' has been
/// started and navigates to to [page] using [wipConnection].
/// Return [wipConnection].
@@ -38,7 +40,8 @@
return new Uri.http('localhost:$port', '');
}();
}
- await (await wipConnection).page
+ await (await wipConnection)
+ .page
.navigate((await _testServerUri).resolve(page).toString());
await new Future.delayed(new Duration(seconds: 1));
return wipConnection;