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

Unified Diff: pkg/oauth2/test/authorization_code_grant_test.dart

Issue 11801008: Fix tests for VM in checked mode. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add missing expectAsync1 Created 7 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/http/test/request_test.dart ('k') | pkg/oauth2/test/client_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/oauth2/test/authorization_code_grant_test.dart
diff --git a/pkg/oauth2/test/authorization_code_grant_test.dart b/pkg/oauth2/test/authorization_code_grant_test.dart
index e896dca25a2be039cdfdf74cd3c28240a0e64f01..7614bcd5e83eaaff3dbe8d0e2bf8f8cab99f5e4b 100644
--- a/pkg/oauth2/test/authorization_code_grant_test.dart
+++ b/pkg/oauth2/test/authorization_code_grant_test.dart
@@ -4,8 +4,9 @@
library authorization_code_grant_test;
+import 'dart:async';
import 'dart:io';
-import 'dart:json';
+import 'dart:json' as JSON;
import 'dart:uri';
import '../../unittest/lib/unittest.dart';
@@ -89,8 +90,7 @@ void main() {
test("can't be called twice", () {
grant.getAuthorizationUrl(redirectUrl);
- expectFutureThrows(grant.getAuthorizationUrl(redirectUrl),
- (e) => e is StateError);
+ expect(() => grant.getAuthorizationUrl(redirectUrl), throwsStateError);
});
});
@@ -104,7 +104,9 @@ void main() {
test("can't be called twice", () {
grant.getAuthorizationUrl(redirectUrl);
- grant.handleAuthorizationResponse({'code': 'auth code'});
+ expectFutureThrows(
+ grant.handleAuthorizationResponse({'code': 'auth code'}),
+ (e) => e is FormatException);
expectFutureThrows(
grant.handleAuthorizationResponse({'code': 'auth code'}),
(e) => e is StateError);
@@ -135,7 +137,7 @@ void main() {
grant.getAuthorizationUrl(redirectUrl);
expectFutureThrows(
grant.handleAuthorizationResponse({'error': 'invalid_request'}),
- (e) => e is AuthorizationException);
+ (e) => e is oauth2.AuthorizationException);
});
test('sends an authorization code request', () {
@@ -157,11 +159,10 @@ void main() {
}), 200, headers: {'content-type': 'application/json'}));
});
- expect(grant.handleAuthorizationResponse({'code': 'auth code'}),
- completion(predicate((client) {
+ grant.handleAuthorizationResponse({'code': 'auth code'})
+ .then(expectAsync1((client) {
expect(client.credentials.accessToken, equals('access token'));
- return true;
- })));
+ }));
});
});
@@ -169,12 +170,16 @@ void main() {
setUp(createGrant);
test("can't be called before .getAuthorizationUrl", () {
- expect(grant.handleAuthorizationCode('auth code'), throwsStateError);
+ expectFutureThrows(
+ grant.handleAuthorizationCode('auth code'),
+ (e) => e is StateError);
});
test("can't be called twice", () {
grant.getAuthorizationUrl(redirectUrl);
- grant.handleAuthorizationCode('auth code');
+ expectFutureThrows(
+ grant.handleAuthorizationCode('auth code'),
+ (e) => e is FormatException);
expectFutureThrows(grant.handleAuthorizationCode('auth code'),
(e) => e is StateError);
});
« no previous file with comments | « pkg/http/test/request_test.dart ('k') | pkg/oauth2/test/client_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698