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

Side by Side Diff: third_party/pkg/angular/test/playback/playback_http_spec.dart

Issue 1058283006: Update pubspecs and dependencies to get pkgbuild tests working. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 library playback_http_spec;
2
3 import '../_specs.dart';
4 import 'package:angular/playback/playback_http.dart';
5
6 main() => describe('Playback HTTP', () {
7 MockHttpBackend backend;
8 beforeEach(module((Module m) {
9 backend = new MockHttpBackend();
10 var wrapper = new HttpBackendWrapper(backend);
11 m
12 ..value(HttpBackendWrapper, wrapper)
13 ..type(PlaybackHttpBackendConfig);
14 }));
15
16 afterEach(() {
17 backend.verifyNoOutstandingRequest();
18 backend.verifyNoOutstandingExpectation();
19 });
20
21 describe('RecordingHttpBackend', () {
22 beforeEach(module((Module m) {
23 m.type(HttpBackend, implementedBy: RecordingHttpBackend);
24 }));
25
26
27 it('should record a request', async(inject((Http http) {
28 backend.expectGET('request').respond(200, 'response');
29
30 var responseData;
31
32 http(method: 'GET', url: 'request').then((HttpResponse r) {
33 responseData = r.data;
34 });
35
36 microLeap();
37 backend.flush();
38 backend
39 .expectPOST('/record',
40 r'{"key":"{\"url\":\"request\",\"method\":\"GET\",\"requestHeaders\" :{\"Accept\":\"application/json, text/plain, */*\",\"X-XSRF-TOKEN\":\"secret\"}, \"data\":null}",' +
41 r'"data":"{\"status\":200,\"headers\":\"\",\"data\":\"response\"}"}' )
42 .respond(200);
43
44 microLeap();
45 backend.flush();
46 microLeap();
47
48 expect(responseData).toEqual('response');
49 })));
50 });
51
52
53 describe('PlaybackHttpBackend', () {
54 beforeEach(module((Module m) {
55 m.type(HttpBackend, implementedBy: PlaybackHttpBackend);
56 }));
57
58 it('should replay a request', async(inject((Http http, HttpBackend hb) {
59 (hb as PlaybackHttpBackend).data = {
60 r'{"url":"request","method":"GET","requestHeaders":{"Accept":"applicatio n/json, text/plain, */*","X-XSRF-TOKEN":"secret"},"data":null}': {'status': 200, 'headers': '', 'data': 'playback data'}
61 };
62
63 var responseData;
64
65 http(method: 'GET', url: 'request').then((HttpResponse r) {
66 responseData = r.data;
67 });
68
69 microLeap();
70
71 expect(responseData).toEqual('playback data');
72 })));
73
74 });
75 });
OLDNEW
« no previous file with comments | « third_party/pkg/angular/test/mock/zone_spec.dart ('k') | third_party/pkg/angular/test/routing/ng_bind_route_spec.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698