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

Unified Diff: content/browser/loader/resource_loader_unittest.cc

Issue 2526983002: Refactor ResourceHandler API. (Closed)
Patch Set: Response to comments Created 3 years, 11 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
Index: content/browser/loader/resource_loader_unittest.cc
diff --git a/content/browser/loader/resource_loader_unittest.cc b/content/browser/loader/resource_loader_unittest.cc
index 96bbb27482d735ad39251f65a92b00e87151e9f1..86ac89f1d0b72f5e6a17ce659a3cf62964cb5f24 100644
--- a/content/browser/loader/resource_loader_unittest.cc
+++ b/content/browser/loader/resource_loader_unittest.cc
@@ -268,7 +268,6 @@ class MockHTTPSJobURLRequestInterceptor : public net::URLRequestInterceptor {
bool redirect_;
};
-// Arbitrary read buffer size.
// Test browser client that captures calls to SelectClientCertificates and
// records the arguments of the most recent call for later inspection.
class SelectCertificateBrowserClient : public TestContentBrowserClient {
@@ -1389,7 +1388,9 @@ TEST_F(ResourceLoaderTest, OutOfBandCancelDuringStart) {
EXPECT_EQ(0, raw_ptr_resource_handler_->on_response_completed_called());
EXPECT_EQ(1, handle_external_protocol_);
- raw_ptr_resource_handler_->CancelWithError(net::ERR_FAILED);
+ // Can't cancel through the ResourceHandler, since that depends on
+ // ResourceDispatachHost, which these tests don't use.
+ loader_->CancelRequest(false);
raw_ptr_resource_handler_->WaitUntilResponseComplete();
EXPECT_EQ(0, did_received_redirect_);
@@ -1400,7 +1401,8 @@ TEST_F(ResourceLoaderTest, OutOfBandCancelDuringStart) {
EXPECT_EQ(0, raw_ptr_resource_handler_->on_request_redirected_called());
EXPECT_EQ(0, raw_ptr_resource_handler_->on_response_started_called());
EXPECT_EQ(1, raw_ptr_resource_handler_->on_response_completed_called());
- EXPECT_EQ(net::ERR_FAILED, raw_ptr_resource_handler_->final_status().error());
+ EXPECT_EQ(net::ERR_ABORTED,
+ raw_ptr_resource_handler_->final_status().error());
EXPECT_EQ("", raw_ptr_resource_handler_->body());
}
@@ -1418,7 +1420,9 @@ TEST_F(ResourceLoaderTest, OutOfBandCancelDuringRead) {
EXPECT_EQ(0, raw_ptr_resource_handler_->on_response_completed_called());
EXPECT_EQ(1, handle_external_protocol_);
- raw_ptr_resource_handler_->CancelWithError(net::ERR_FAILED);
+ // Can't cancel through the ResourceHandler, since that depends on
+ // ResourceDispatachHost, which these tests don't use.
+ loader_->CancelRequest(false);
raw_ptr_resource_handler_->WaitUntilResponseComplete();
EXPECT_EQ(0, did_received_redirect_);
EXPECT_EQ(1, did_receive_response_);
@@ -1429,7 +1433,8 @@ TEST_F(ResourceLoaderTest, OutOfBandCancelDuringRead) {
EXPECT_EQ(1, raw_ptr_resource_handler_->on_response_started_called());
EXPECT_EQ(0, raw_ptr_resource_handler_->on_read_completed_called());
EXPECT_EQ(1, raw_ptr_resource_handler_->on_response_completed_called());
- EXPECT_EQ(net::ERR_FAILED, raw_ptr_resource_handler_->final_status().error());
+ EXPECT_EQ(net::ERR_ABORTED,
+ raw_ptr_resource_handler_->final_status().error());
EXPECT_EQ("", raw_ptr_resource_handler_->body());
}
@@ -1437,8 +1442,9 @@ TEST_F(ResourceLoaderTest, ResumeCanceledRequest) {
raw_ptr_resource_handler_->set_defer_on_will_start(true);
loader_->StartRequest();
+ raw_ptr_resource_handler_->WaitUntilDeferred();
loader_->CancelRequest(true);
- static_cast<ResourceController*>(loader_.get())->Resume();
+ raw_ptr_resource_handler_->Resume();
}
class ResourceLoaderRedirectToFileTest : public ResourceLoaderTest {

Powered by Google App Engine
This is Rietveld 408576698