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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « net/url_request/url_request_job.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/url_request/url_request_job.h" 5 #include "net/url_request/url_request_job.h"
6 6
7 #include "net/http/http_transaction_unittest.h" 7 #include "net/http/http_transaction_unittest.h"
8 #include "net/url_request/url_request_test_util.h" 8 #include "net/url_request/url_request_test_util.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
(...skipping 19 matching lines...) Expand all
30 "Content-Encoding: gzip\n" 30 "Content-Encoding: gzip\n"
31 "Content-Length: 30\n", // Intentionally wrong. 31 "Content-Length: 30\n", // Intentionally wrong.
32 base::Time(), 32 base::Time(),
33 "", 33 "",
34 TEST_MODE_NORMAL, 34 TEST_MODE_NORMAL,
35 &GZipServer, 35 &GZipServer,
36 0, 36 0,
37 net::OK 37 net::OK
38 }; 38 };
39 39
40 const MockTransaction kRedirect_Transaction = {
41 "http://www.google.com/redirect",
42 "GET",
43 base::Time(),
44 "",
45 net::LOAD_NORMAL,
46 "HTTP/1.1 302 Found",
47 "Cache-Control: max-age=10000\n"
48 "Location: http://www.google.com/destination\n"
49 "Content-Length: 5\n",
50 base::Time(),
51 "hello",
52 TEST_MODE_NORMAL,
53 NULL,
54 0,
55 net::OK
56 };
57
40 } // namespace 58 } // namespace
41 59
42 TEST(URLRequestJob, TransactionNotifiedWhenDone) { 60 TEST(URLRequestJob, TransactionNotifiedWhenDone) {
43 MockNetworkLayer network_layer; 61 MockNetworkLayer network_layer;
44 net::TestURLRequestContext context; 62 net::TestURLRequestContext context;
45 context.set_http_transaction_factory(&network_layer); 63 context.set_http_transaction_factory(&network_layer);
46 64
47 net::TestDelegate d; 65 net::TestDelegate d;
48 net::TestURLRequest req(GURL(kGZip_Transaction.url), &d, &context, NULL); 66 net::TestURLRequest req(GURL(kGZip_Transaction.url), &d, &context, NULL);
49 AddMockTransaction(&kGZip_Transaction); 67 AddMockTransaction(&kGZip_Transaction);
(...skipping 21 matching lines...) Expand all
71 89
72 req.set_method("GET"); 90 req.set_method("GET");
73 req.Start(); 91 req.Start();
74 92
75 base::MessageLoop::current()->Run(); 93 base::MessageLoop::current()->Run();
76 94
77 EXPECT_TRUE(network_layer.done_reading_called()); 95 EXPECT_TRUE(network_layer.done_reading_called());
78 96
79 RemoveMockTransaction(&transaction); 97 RemoveMockTransaction(&transaction);
80 } 98 }
99
100 TEST(URLRequestJob, RedirectTransactionNotifiedWhenDone) {
101 MockNetworkLayer network_layer;
102 net::TestURLRequestContext context;
103 context.set_http_transaction_factory(&network_layer);
104
105 net::TestDelegate d;
106 net::TestURLRequest req(GURL(kRedirect_Transaction.url), &d, &context, NULL);
107 AddMockTransaction(&kRedirect_Transaction);
108
109 req.set_method("GET");
110 req.Start();
111
112 base::MessageLoop::current()->Run();
113
114 EXPECT_TRUE(network_layer.done_reading_called());
115
116 RemoveMockTransaction(&kRedirect_Transaction);
117 }
OLDNEW
« 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