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

Side by Side Diff: third_party/pkg/angular/lib/mock/http_backend.dart

Issue 148453003: Updating Angular version (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 part of angular.mock; 1 part of angular.mock;
2 2
3 class _MockXhr { 3 class _MockXhr {
4 var $$method, $$url, $$async, $$reqHeaders, $$respHeaders; 4 var $$method, $$url, $$async, $$reqHeaders, $$respHeaders;
5 5
6 open(method, url, async) { 6 open(method, url, async) {
7 $$method = method; 7 $$method = method;
8 $$url = url; 8 $$url = url;
9 $$async = async; 9 $$async = async;
10 $$reqHeaders = {}; 10 $$reqHeaders = {};
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 } else { 131 } else {
132 c.completeError( 132 c.completeError(
133 new MockProgressEvent( 133 new MockProgressEvent(
134 new MockHttpRequest(status, data, headers))); 134 new MockHttpRequest(status, data, headers)));
135 } 135 }
136 }; 136 };
137 call(method == null ? 'GET' : method, url, sendData, callback, requestHeader s); 137 call(method == null ? 'GET' : method, url, sendData, callback, requestHeader s);
138 return c.future; 138 return c.future;
139 } 139 }
140 140
141 _createResponse(status, data, headers) { 141 _createResponse(statusOrDataOrFunction, dataOrHeaders, headersOrNone) {
142 if (status is Function) return status; 142 if (statusOrDataOrFunction is Function) return statusOrDataOrFunction;
143 var status, data, headers;
144 if (statusOrDataOrFunction is num) {
145 status = statusOrDataOrFunction;
146 data = dataOrHeaders;
147 headers = headersOrNone;
148 } else {
149 status = 200;
150 data = statusOrDataOrFunction;
151 headers = dataOrHeaders;
152 }
153 if (data is Map || data is List) {
154 data = JSON.encode(data);
155 }
143 156
144 return ([a,b,c,d,e]) { 157 return ([a,b,c,d,e]) => [status, data, headers];
145 return status is num
146 ? [status, data, headers]
147 : [200, status, data];
148 };
149 } 158 }
150 159
151 160
152 /** 161 /**
153 * A callback oriented API. This function takes a callback with 162 * A callback oriented API. This function takes a callback with
154 * will be called with (status, data, headers) 163 * will be called with (status, data, headers)
155 */ 164 */
156 call(method, [url, data, callback, headers, timeout]) { 165 call(method, [url, data, callback, headers, timeout]) {
157 var xhr = new _MockXhr(), 166 var xhr = new _MockXhr(),
158 expectation = expectations.isEmpty ? null : expectations[0], 167 expectation = expectations.isEmpty ? null : expectations[0],
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
636 final String type = null; 645 final String type = null;
637 646
638 bool cancelBubble = false; 647 bool cancelBubble = false;
639 648
640 MockProgressEvent(MockHttpRequest this.currentTarget); 649 MockProgressEvent(MockHttpRequest this.currentTarget);
641 650
642 void preventDefault() {} 651 void preventDefault() {}
643 void stopImmediatePropagation() {} 652 void stopImmediatePropagation() {}
644 void stopPropagation() {} 653 void stopPropagation() {}
645 } 654 }
OLDNEW
« no previous file with comments | « third_party/pkg/angular/lib/mock/debug.dart ('k') | third_party/pkg/angular/lib/mock/module.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698