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

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

Issue 2542843006: ResourceLoader: Fix a bunch of double-cancellation/double-error notification cases. (Closed)
Patch Set: Move comment Created 4 years 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 7a65e17369c3a6dbf3e5b801f9c8c0e179be421e..7aade9492a10ee8d1035e7f61a0dec735f9f530a 100644
--- a/content/browser/loader/resource_loader_unittest.cc
+++ b/content/browser/loader/resource_loader_unittest.cc
@@ -924,14 +924,7 @@ TEST_F(ResourceLoaderTest, SyncCancelOnReadCompleted) {
EXPECT_LT(0u, raw_ptr_resource_handler_->body().size());
}
-// This test is broken because ResourceLoader assumes when
-// URLRequest::was_pending() is false, canceling the request will not result in
-// a completion notification. This isn't the case - whether or not there's a
-// notification depends on whether URLRequestJob::NotifyDone() has been invoked
-// yet - something the URLRequest doesn't even know about, itself. As a result,
-// the ResourceLoader is notified of cancellation twice.
-// TODO(mmenke): Fix this.
-TEST_F(ResourceLoaderTest, DISABLED_SyncCancelOnReceivedEof) {
+TEST_F(ResourceLoaderTest, SyncCancelOnReceivedEof) {
raw_ptr_resource_handler_->set_on_on_read_eof_result(false);
loader_->StartRequest();
@@ -1024,10 +1017,6 @@ TEST_F(ResourceLoaderTest, AsyncCancelOnReceivedEof) {
loader_->StartRequest();
raw_ptr_resource_handler_->WaitUntilDeferred();
- // Have to spin the message loop for the test to pass - see comment on sync
- // version of this test for explanation.
- // TODO(mmenke): Remove this line once that's fixed.
- base::RunLoop().RunUntilIdle();
raw_ptr_resource_handler_->CancelWithError(net::ERR_FAILED);
base::RunLoop().RunUntilIdle();
EXPECT_EQ(1, did_receive_response_);

Powered by Google App Engine
This is Rietveld 408576698