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

Unified Diff: tests/standalone/io/http_session_test.dart

Issue 14840009: Clear http session object on destroy. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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
« no previous file with comments | « sdk/lib/io/http_impl.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/io/http_session_test.dart
diff --git a/tests/standalone/io/http_session_test.dart b/tests/standalone/io/http_session_test.dart
index 4b3472e6bbd0c232a33758606aaf4b2e72cd11cd..4fe3d9d679d8bb1a0db6e3f5ace76b7119ee7cd9 100644
--- a/tests/standalone/io/http_session_test.dart
+++ b/tests/standalone/io/http_session_test.dart
@@ -150,8 +150,51 @@ void testSessionsData() {
});
}
+void testSessionsDestroy() {
+ HttpServer.bind("127.0.0.1", 0).then((server) {
+ bool firstHit = false;
+ server.listen((request) {
+ var session = request.session;
+ if (session.isNew) {
+ Expect.isFalse(firstHit);
+ firstHit = true;
+ } else {
+ Expect.isTrue(firstHit);
+ session.destroy();
+ var session2 = request.session;
+ Expect.notEquals(session.id, session2.id);
+ };
+ request.response.close();
+ });
+
+ var client = new HttpClient();
+ client.get("127.0.0.1", server.port, "/")
+ .then((request) => request.close())
+ .then((response) {
+ response.listen((_) {}, onDone: () {
+ var id = getSessionId(response.cookies);
+ Expect.isNotNull(id);
+ client.get("127.0.0.1", server.port, "/")
+ .then((request) {
+ request.cookies.add(new Cookie(SESSION_ID, id));
+ return request.close();
+ })
+ .then((response) {
+ response.listen((_) {}, onDone: () {
+ Expect.isTrue(firstHit);
+ Expect.notEquals(id, getSessionId(response.cookies));
+ server.close();
+ client.close();
+ });
+ });
+ });
+ });
+ });
+}
+
void main() {
testSessions(1);
testTimeout(5);
testSessionsData();
+ testSessionsDestroy();
}
« no previous file with comments | « sdk/lib/io/http_impl.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698