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

Unified Diff: net/url_request/url_request_job_unittest.cc

Issue 23710059: Release the cache entry on deferred redirect. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 3 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 | « net/url_request/url_request_job.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/url_request/url_request_job_unittest.cc
diff --git a/net/url_request/url_request_job_unittest.cc b/net/url_request/url_request_job_unittest.cc
index 354915fe12be37c8ea2c0d16d74e2e80b1e3c796..5f63b0927de2918acbad499ce8d43dc18b849d45 100644
--- a/net/url_request/url_request_job_unittest.cc
+++ b/net/url_request/url_request_job_unittest.cc
@@ -37,6 +37,24 @@ const MockTransaction kGZip_Transaction = {
net::OK
};
+const MockTransaction kRedirect_Transaction = {
+ "http://www.google.com/redirect",
+ "GET",
+ base::Time(),
+ "",
+ net::LOAD_NORMAL,
+ "HTTP/1.1 302 Found",
+ "Cache-Control: max-age=10000\n"
+ "Location: http://www.google.com/destination\n"
+ "Content-Length: 5\n",
+ base::Time(),
+ "hello",
+ TEST_MODE_NORMAL,
+ NULL,
+ 0,
+ net::OK
+};
+
} // namespace
TEST(URLRequestJob, TransactionNotifiedWhenDone) {
@@ -78,3 +96,22 @@ TEST(URLRequestJob, SyncTransactionNotifiedWhenDone) {
RemoveMockTransaction(&transaction);
}
+
+TEST(URLRequestJob, RedirectTransactionNotifiedWhenDone) {
+ MockNetworkLayer network_layer;
+ net::TestURLRequestContext context;
+ context.set_http_transaction_factory(&network_layer);
+
+ net::TestDelegate d;
+ net::TestURLRequest req(GURL(kRedirect_Transaction.url), &d, &context, NULL);
+ AddMockTransaction(&kRedirect_Transaction);
+
+ req.set_method("GET");
+ req.Start();
+
+ base::MessageLoop::current()->Run();
+
+ EXPECT_TRUE(network_layer.done_reading_called());
+
+ RemoveMockTransaction(&kRedirect_Transaction);
+}
« no previous file with comments | « net/url_request/url_request_job.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698