Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1859)

Unified Diff: generated/googleapis/test/admin/email_migration_v2_test.dart

Issue 1078053002: Roll of googleapis as of 4/7/2015. (Closed) Base URL: https://github.com/dart-lang/googleapis.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: generated/googleapis/test/admin/email_migration_v2_test.dart
diff --git a/generated/googleapis/test/admin/email_migration_v2_test.dart b/generated/googleapis/test/admin/email_migration_v2_test.dart
index 8bb33159855e3bc3d14d2d7d4e321df691772b60..1a3ef5de73ad6632ec46f5825fed70eae2c75668 100644
--- a/generated/googleapis/test/admin/email_migration_v2_test.dart
+++ b/generated/googleapis/test/admin/email_migration_v2_test.dart
@@ -8,22 +8,57 @@ import "dart:convert" as convert;
import 'package:http/http.dart' as http;
import 'package:http/testing.dart' as http_testing;
import 'package:unittest/unittest.dart' as unittest;
-import 'package:googleapis/common/common.dart' as common;
-import 'package:googleapis/src/common_internal.dart' as common_internal;
-import '../common/common_internal_test.dart' as common_test;
import 'package:googleapis/admin/email_migration_v2.dart' as api;
+class HttpServerMock extends http.BaseClient {
+ core.Function _callback;
+ core.bool _expectJson;
+ void register(core.Function callback, core.bool expectJson) {
+ _callback = callback;
+ _expectJson = expectJson;
+ }
+
+ async.Future<http.StreamedResponse> send(http.BaseRequest request) {
+ if (_expectJson) {
+ return request.finalize()
+ .transform(convert.UTF8.decoder)
+ .join('')
+ .then((core.String jsonString) {
+ if (jsonString.isEmpty) {
+ return _callback(request, null);
+ } else {
+ return _callback(request, convert.JSON.decode(jsonString));
+ }
+ });
+ } else {
+ var stream = request.finalize();
+ if (stream == null) {
+ return _callback(request, []);
+ } else {
+ return stream.toBytes().then((data) {
+ return _callback(request, data);
+ });
+ }
+ }
+ }
+}
+
+http.StreamedResponse stringResponse(
+ core.int status, core.Map headers, core.String body) {
+ var stream = new async.Stream.fromIterable([convert.UTF8.encode(body)]);
+ return new http.StreamedResponse(stream, status, headers: headers);
+}
-buildUnnamed0() {
+buildUnnamed120() {
var o = new core.List<core.String>();
o.add("foo");
o.add("foo");
return o;
}
-checkUnnamed0(core.List<core.String> o) {
+checkUnnamed120(core.List<core.String> o) {
unittest.expect(o, unittest.hasLength(2));
unittest.expect(o[0], unittest.equals('foo'));
unittest.expect(o[1], unittest.equals('foo'));
@@ -42,7 +77,7 @@ buildMailItem() {
o.isTrash = true;
o.isUnread = true;
o.kind = "foo";
- o.labels = buildUnnamed0();
+ o.labels = buildUnnamed120();
}
buildCounterMailItem--;
return o;
@@ -59,7 +94,7 @@ checkMailItem(api.MailItem o) {
unittest.expect(o.isTrash, unittest.isTrue);
unittest.expect(o.isUnread, unittest.isTrue);
unittest.expect(o.kind, unittest.equals('foo'));
- checkUnnamed0(o.labels);
+ checkUnnamed120(o.labels);
}
buildCounterMailItem--;
}
@@ -80,7 +115,7 @@ main() {
// TODO: Implement tests for media upload;
// TODO: Implement tests for media download;
- var mock = new common_test.HttpServerMock();
+ var mock = new HttpServerMock();
api.MailResourceApi res = new api.AdminApi(mock).mail;
var arg_request = buildMailItem();
var arg_userKey = "foo";
@@ -117,7 +152,7 @@ main() {
"content-type" : "application/json; charset=utf-8",
};
var resp = "";
- return new async.Future.value(common_test.stringResponse(200, h, resp));
+ return new async.Future.value(stringResponse(200, h, resp));
}), true);
res.insert(arg_request, arg_userKey).then(unittest.expectAsync((_) {}));
});
« no previous file with comments | « generated/googleapis/test/admin/directory_v1_test.dart ('k') | generated/googleapis/test/admin/reports_v1_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698