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

Unified Diff: pkg/analysis_server/test/protocol_test.dart

Issue 865383002: add optional request field to record time at which client made request (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge Created 5 years, 11 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
« no previous file with comments | « pkg/analysis_server/lib/src/protocol.dart ('k') | pkg/analysis_server/tool/spec/spec_input.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/test/protocol_test.dart
diff --git a/pkg/analysis_server/test/protocol_test.dart b/pkg/analysis_server/test/protocol_test.dart
index e4bcb2168a4775fbe24005a6da0da203132ec7d6..bc4016eb361d0c2048207a50f261d10ea6e1d4ba 100644
--- a/pkg/analysis_server/test/protocol_test.dart
+++ b/pkg/analysis_server/test/protocol_test.dart
@@ -149,6 +149,7 @@ class RequestTest {
Request request = new Request.fromString(json);
expect(request.id, equals('one'));
expect(request.method, equals('aMethod'));
+ expect(request.clientRequestTime, isNull);
}
void test_fromJson_invalidId() {
@@ -171,6 +172,25 @@ class RequestTest {
expect(request, isNull);
}
+ void test_fromJson_withBadClientTime() {
+ Request original = new Request('one', 'aMethod', null, 347);
+ Map<String, Object> map = original.toJson();
+ // Insert bad value - should be int but client sent string instead
+ map[Request.CLIENT_REQUEST_TIME] = '347';
+ String json = JSON.encode(map);
+ Request request = new Request.fromString(json);
+ expect(request, isNull);
+ }
+
+ void test_fromJson_withClientTime() {
+ Request original = new Request('one', 'aMethod', null, 347);
+ String json = JSON.encode(original.toJson());
+ Request request = new Request.fromString(json);
+ expect(request.id, equals('one'));
+ expect(request.method, equals('aMethod'));
+ expect(request.clientRequestTime, 347);
+ }
+
void test_fromJson_withParams() {
Request original = new Request('one', 'aMethod', {
'foo': 'bar'
@@ -223,8 +243,7 @@ class ResponseTest {
}
void test_create_unanalyzedPriorityFiles() {
- Response response =
- new Response.unanalyzedPriorityFiles('0', 'file list');
+ Response response = new Response.unanalyzedPriorityFiles('0', 'file list');
expect(response.id, equals('0'));
expect(response.error, isNotNull);
expect(response.toJson(), equals({
« no previous file with comments | « pkg/analysis_server/lib/src/protocol.dart ('k') | pkg/analysis_server/tool/spec/spec_input.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698