mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 16:41:07 +00:00
Run dartfmt on microlytics package.
BUG= R=lukechurch@google.com Review-Url: https://codereview.chromium.org/2770573002 .
This commit is contained in:
parent
e5c091e048
commit
7819a400bd
|
@ -8,8 +8,8 @@ import 'package:microlytics/microlytics.dart';
|
|||
|
||||
void main(List<String> arguments) {
|
||||
// Create the channel that will be used to communicate to analytics.
|
||||
var channel = new RateLimitingBufferedChannel(
|
||||
new HttpClientChannel(), packetsPerSecond: 1.0);
|
||||
var channel = new RateLimitingBufferedChannel(new HttpClientChannel(),
|
||||
packetsPerSecond: 1.0);
|
||||
|
||||
if (arguments.length != 1) {
|
||||
print("usage: dart simple.dart GA-Client-ID");
|
||||
|
|
|
@ -22,10 +22,8 @@ class RateLimitingBufferedChannel extends Channel {
|
|||
final int _bufferSizeLimit;
|
||||
Timer _timer;
|
||||
|
||||
RateLimitingBufferedChannel(
|
||||
this._innerChannel,
|
||||
{int bufferSizeLimit: 10,
|
||||
double packetsPerSecond: 1.0})
|
||||
RateLimitingBufferedChannel(this._innerChannel,
|
||||
{int bufferSizeLimit: 10, double packetsPerSecond: 1.0})
|
||||
: this._bufferSizeLimit = bufferSizeLimit {
|
||||
if (!(packetsPerSecond > 0)) {
|
||||
throw new ArgumentError("packetsPerSecond must be larger than zero.");
|
||||
|
|
|
@ -18,4 +18,3 @@ class HttpClientChannel extends Channel {
|
|||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -30,8 +30,7 @@ class AnalyticsLogger {
|
|||
this._analyticsID = analyticsID,
|
||||
this._appName = appName,
|
||||
this._appVersion = appVersion,
|
||||
this._messagePrefix =
|
||||
"v=1"
|
||||
this._messagePrefix = "v=1"
|
||||
"&tid=$analyticsID"
|
||||
"&cid=$clientID"
|
||||
"&an=$appName"
|
||||
|
@ -40,8 +39,7 @@ class AnalyticsLogger {
|
|||
void logAnonymousTiming(String category, String variable, int ms) {
|
||||
category = Uri.encodeComponent(category);
|
||||
variable = Uri.encodeComponent(variable);
|
||||
_channel.sendData(
|
||||
"${this._messagePrefix}"
|
||||
_channel.sendData("${this._messagePrefix}"
|
||||
"&t=timing"
|
||||
"&utc=$category"
|
||||
"&utv=$variable"
|
||||
|
@ -51,11 +49,9 @@ class AnalyticsLogger {
|
|||
void logAnonymousEvent(String category, String event) {
|
||||
category = Uri.encodeComponent(category);
|
||||
event = Uri.encodeComponent(event);
|
||||
_channel.sendData(
|
||||
"${this._messagePrefix}"
|
||||
_channel.sendData("${this._messagePrefix}"
|
||||
"&t=event"
|
||||
"&ec=$category"
|
||||
"&ea=$event");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -25,8 +25,7 @@ void testBasicEventRead() {
|
|||
"TestApp",
|
||||
"0.42");
|
||||
logger.logAnonymousEvent("video", "play");
|
||||
Expect.isTrue(c.contains(
|
||||
"v=1"
|
||||
Expect.isTrue(c.contains("v=1"
|
||||
"&tid=UA-53895644-1"
|
||||
"&cid=2cfac780-31e2-11e4-8c21-0800200c9a66"
|
||||
"&an=TestApp"
|
||||
|
@ -45,8 +44,7 @@ void testBasicNegativeEventRead() {
|
|||
"TestApp",
|
||||
"0.42");
|
||||
logger.logAnonymousEvent("video", "play");
|
||||
Expect.isFalse(c.contains(
|
||||
"v=1"
|
||||
Expect.isFalse(c.contains("v=1"
|
||||
"&tid=UA-53895644-1"
|
||||
"&cid=2cfac780-31e2-11e4-8c21-0800200c9a66"
|
||||
"&an=TestApp"
|
||||
|
@ -65,8 +63,7 @@ void testBasicTimingRead() {
|
|||
"TestApp",
|
||||
"0.42");
|
||||
logger.logAnonymousTiming("video", "delay", 157);
|
||||
Expect.isTrue(c.contains(
|
||||
"v=1"
|
||||
Expect.isTrue(c.contains("v=1"
|
||||
"&tid=UA-53895644-1"
|
||||
"&cid=2cfac780-31e2-11e4-8c21-0800200c9a66"
|
||||
"&an=TestApp"
|
||||
|
@ -87,8 +84,7 @@ void testBasicTimingMultiread() {
|
|||
"0.42");
|
||||
logger.logAnonymousTiming("video", "delay", 159);
|
||||
logger.logAnonymousTiming("video", "delay", 152);
|
||||
Expect.isTrue(c.contains(
|
||||
"v=1"
|
||||
Expect.isTrue(c.contains("v=1"
|
||||
"&tid=UA-53895644-1"
|
||||
"&cid=2cfac780-31e2-11e4-8c21-0800200c9a66"
|
||||
"&an=TestApp"
|
||||
|
@ -97,8 +93,7 @@ void testBasicTimingMultiread() {
|
|||
"&utc=video"
|
||||
"&utv=delay"
|
||||
"&utt=152"));
|
||||
Expect.isTrue(c.contains(
|
||||
"v=1"
|
||||
Expect.isTrue(c.contains("v=1"
|
||||
"&tid=UA-53895644-1"
|
||||
"&cid=2cfac780-31e2-11e4-8c21-0800200c9a66"
|
||||
"&an=TestApp"
|
||||
|
@ -107,8 +102,7 @@ void testBasicTimingMultiread() {
|
|||
"&utc=video"
|
||||
"&utv=delay"
|
||||
"&utt=159"));
|
||||
Expect.isFalse(c.contains(
|
||||
"v=1"
|
||||
Expect.isFalse(c.contains("v=1"
|
||||
"&tid=UA-53895644-1"
|
||||
"&cid=2cfac780-31e2-11e4-8c21-0800200c9a66"
|
||||
"&an=TestApp"
|
||||
|
|
Loading…
Reference in a new issue