Commit f57b63d0 authored by Matt Menke's avatar Matt Menke Committed by Commit Bot

Fix URLRequestTestHTTP.URLRequestDelegateInfo

HttpCache::Transaction is returning LOAD_STATE_WAITING_FOR_CACHE
when we're calling into the URLRequest::Delegate, and aren't
actually waiting on the disk cache at all. This CL makes it correctly
return LOAD_STATE_IDLE when the ball is not in the Transaction's court.

Fixed: 1146351
Change-Id: I9729ef3a974f395af233643a8d467370bc2d1211
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2522956
Commit-Queue: Matt Menke <mmenke@chromium.org>
Reviewed-by: default avatarShivani Sharma <shivanisha@chromium.org>
Cr-Commit-Position: refs/heads/master@{#826047}
parent d8cbea31
...@@ -485,6 +485,11 @@ const HttpResponseInfo* HttpCache::Transaction::GetResponseInfo() const { ...@@ -485,6 +485,11 @@ const HttpResponseInfo* HttpCache::Transaction::GetResponseInfo() const {
} }
LoadState HttpCache::Transaction::GetLoadState() const { LoadState HttpCache::Transaction::GetLoadState() const {
// If there's no pending callback, the ball is not in the
// HttpCache::Transaction's court, whatever else may be going on.
if (!callback_)
return LOAD_STATE_IDLE;
LoadState state = GetWriterLoadState(); LoadState state = GetWriterLoadState();
if (state != LOAD_STATE_WAITING_FOR_CACHE) if (state != LOAD_STATE_WAITING_FOR_CACHE)
return state; return state;
......
...@@ -2458,7 +2458,7 @@ TEST_F(HttpCacheTest, RangeGET_ParallelValidationDifferentRanges) { ...@@ -2458,7 +2458,7 @@ TEST_F(HttpCacheTest, RangeGET_ParallelValidationDifferentRanges) {
std::string data_read(buffer->data(), kBufferSize); std::string data_read(buffer->data(), kBufferSize);
first_read = data_read; first_read = data_read;
EXPECT_EQ(LOAD_STATE_READING_RESPONSE, c->trans->GetLoadState()); EXPECT_EQ(LOAD_STATE_IDLE, c->trans->GetLoadState());
} }
// 2nd transaction requests ranges 30-39. // 2nd transaction requests ranges 30-39.
...@@ -2611,7 +2611,7 @@ TEST_F(HttpCacheTest, RangeGET_ParallelValidationCacheLockTimeout) { ...@@ -2611,7 +2611,7 @@ TEST_F(HttpCacheTest, RangeGET_ParallelValidationCacheLockTimeout) {
std::string data_read(buffer->data(), kBufferSize); std::string data_read(buffer->data(), kBufferSize);
first_read = data_read; first_read = data_read;
EXPECT_EQ(LOAD_STATE_READING_RESPONSE, c->trans->GetLoadState()); EXPECT_EQ(LOAD_STATE_IDLE, c->trans->GetLoadState());
} }
// Cache lock timeout will lead to dooming the entry since the transaction may // Cache lock timeout will lead to dooming the entry since the transaction may
...@@ -2706,7 +2706,7 @@ TEST_F(HttpCacheTest, RangeGET_ParallelValidationCouldntConditionalize) { ...@@ -2706,7 +2706,7 @@ TEST_F(HttpCacheTest, RangeGET_ParallelValidationCouldntConditionalize) {
std::string data_read(buffer->data(), kBufferSize); std::string data_read(buffer->data(), kBufferSize);
first_read = data_read; first_read = data_read;
EXPECT_EQ(LOAD_STATE_READING_RESPONSE, c->trans->GetLoadState()); EXPECT_EQ(LOAD_STATE_IDLE, c->trans->GetLoadState());
} }
// 2nd transaction requests a range. // 2nd transaction requests a range.
...@@ -2794,7 +2794,7 @@ TEST_F(HttpCacheTest, RangeGET_ParallelValidationCouldConditionalize) { ...@@ -2794,7 +2794,7 @@ TEST_F(HttpCacheTest, RangeGET_ParallelValidationCouldConditionalize) {
std::string data_read(buffer->data(), kBufferSize); std::string data_read(buffer->data(), kBufferSize);
first_read = data_read; first_read = data_read;
EXPECT_EQ(LOAD_STATE_READING_RESPONSE, c->trans->GetLoadState()); EXPECT_EQ(LOAD_STATE_IDLE, c->trans->GetLoadState());
} }
// 2nd transaction requests a range. // 2nd transaction requests a range.
...@@ -2870,7 +2870,7 @@ TEST_F(HttpCacheTest, RangeGET_ParallelValidationOverlappingRanges) { ...@@ -2870,7 +2870,7 @@ TEST_F(HttpCacheTest, RangeGET_ParallelValidationOverlappingRanges) {
std::string data_read(buffer->data(), kBufferSize); std::string data_read(buffer->data(), kBufferSize);
first_read = data_read; first_read = data_read;
EXPECT_EQ(LOAD_STATE_READING_RESPONSE, c->trans->GetLoadState()); EXPECT_EQ(LOAD_STATE_IDLE, c->trans->GetLoadState());
} }
// 2nd transaction requests ranges 30-49. // 2nd transaction requests ranges 30-49.
...@@ -2973,7 +2973,7 @@ TEST_F(HttpCacheTest, RangeGET_ParallelValidationRestartDoneHeaders) { ...@@ -2973,7 +2973,7 @@ TEST_F(HttpCacheTest, RangeGET_ParallelValidationRestartDoneHeaders) {
std::string data_read(buffer->data(), kBufferSize); std::string data_read(buffer->data(), kBufferSize);
first_read = data_read; first_read = data_read;
EXPECT_EQ(LOAD_STATE_READING_RESPONSE, c->trans->GetLoadState()); EXPECT_EQ(LOAD_STATE_IDLE, c->trans->GetLoadState());
} }
// 2nd transaction requests ranges 30-59. // 2nd transaction requests ranges 30-59.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment