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

Side by Side Diff: net/url_request/url_request_unittest.cc

Issue 2721933002: HttpCache::Transaction layer allowing parallel validation (Closed)
Patch Set: Fixed data race Created 3 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
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 <memory> 5 #include <memory>
6 #include <utility> 6 #include <utility>
7 7
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 4116 matching lines...) Expand 10 before | Expand all | Expand 10 after
4127 context.Init(); 4127 context.Init();
4128 4128
4129 d.set_credentials(AuthCredentials(kUser, kSecret)); 4129 d.set_credentials(AuthCredentials(kUser, kSecret));
4130 4130
4131 { 4131 {
4132 GURL url(http_test_server()->GetURL("/auth-basic")); 4132 GURL url(http_test_server()->GetURL("/auth-basic"));
4133 std::unique_ptr<URLRequest> r( 4133 std::unique_ptr<URLRequest> r(
4134 context.CreateRequest(url, DEFAULT_PRIORITY, &d)); 4134 context.CreateRequest(url, DEFAULT_PRIORITY, &d));
4135 r->Start(); 4135 r->Start();
4136 4136
4137 base::RunLoop().Run();
4138
4137 { 4139 {
4138 HttpRequestHeaders headers; 4140 HttpRequestHeaders headers;
4139 EXPECT_TRUE(r->GetFullRequestHeaders(&headers)); 4141 EXPECT_TRUE(r->GetFullRequestHeaders(&headers));
4140 EXPECT_FALSE(headers.HasHeader("Authorization")); 4142 EXPECT_TRUE(headers.HasHeader("Authorization"));
4141 } 4143 }
4142 4144
4143 base::RunLoop().Run();
4144
4145 EXPECT_EQ(OK, d.request_status()); 4145 EXPECT_EQ(OK, d.request_status());
4146 EXPECT_EQ(200, r->GetResponseCode()); 4146 EXPECT_EQ(200, r->GetResponseCode());
4147 EXPECT_TRUE(d.auth_required_called()); 4147 EXPECT_TRUE(d.auth_required_called());
4148 EXPECT_EQ(1, network_delegate.created_requests()); 4148 EXPECT_EQ(1, network_delegate.created_requests());
4149 EXPECT_EQ(0, network_delegate.destroyed_requests()); 4149 EXPECT_EQ(0, network_delegate.destroyed_requests());
4150 } 4150 }
4151 EXPECT_EQ(1, network_delegate.destroyed_requests()); 4151 EXPECT_EQ(1, network_delegate.destroyed_requests());
4152 } 4152 }
4153 4153
4154 // Tests that the network delegate can synchronously complete OnAuthRequired 4154 // Tests that the network delegate can synchronously complete OnAuthRequired
(...skipping 6716 matching lines...) Expand 10 before | Expand all | Expand 10 after
10871 AddTestInterceptor()->set_main_intercept_job(std::move(job)); 10871 AddTestInterceptor()->set_main_intercept_job(std::move(job));
10872 10872
10873 req->Start(); 10873 req->Start();
10874 req->Cancel(); 10874 req->Cancel();
10875 base::RunLoop().RunUntilIdle(); 10875 base::RunLoop().RunUntilIdle();
10876 EXPECT_EQ(ERR_ABORTED, d.request_status()); 10876 EXPECT_EQ(ERR_ABORTED, d.request_status());
10877 EXPECT_EQ(0, d.received_redirect_count()); 10877 EXPECT_EQ(0, d.received_redirect_count());
10878 } 10878 }
10879 10879
10880 } // namespace net 10880 } // namespace net
OLDNEW
« net/http/http_cache_transaction.cc ('K') | « net/http/mock_http_cache.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698