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

Side by Side Diff: content/browser/loader/resource_loader_unittest.cc

Issue 2542843006: ResourceLoader: Fix a bunch of double-cancellation/double-error notification cases. (Closed)
Patch Set: Inline ReadMore 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "content/browser/loader/resource_loader.h" 5 #include "content/browser/loader/resource_loader.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 1067 matching lines...) Expand 10 before | Expand all | Expand 10 after
1078 EXPECT_LT(0u, raw_ptr_resource_handler_->body().size()); 1078 EXPECT_LT(0u, raw_ptr_resource_handler_->body().size());
1079 } 1079 }
1080 1080
1081 // This test is broken because ResourceLoader assumes when 1081 // This test is broken because ResourceLoader assumes when
1082 // URLRequest::was_pending() is false, canceling the request will not result in 1082 // URLRequest::was_pending() is false, canceling the request will not result in
1083 // a completion notification. This isn't the case - whether or not there's a 1083 // a completion notification. This isn't the case - whether or not there's a
1084 // notification depends on whether URLRequestJob::NotifyDone() has been invoked 1084 // notification depends on whether URLRequestJob::NotifyDone() has been invoked
1085 // yet - something the URLRequest doesn't even know about, itself. As a result, 1085 // yet - something the URLRequest doesn't even know about, itself. As a result,
1086 // the ResourceLoader is notified of cancellation twice. 1086 // the ResourceLoader is notified of cancellation twice.
1087 // TODO(mmenke): Fix this. 1087 // TODO(mmenke): Fix this.
1088 TEST_F(ResourceLoaderTest, DISABLED_SyncCancelOnReceivedEof) { 1088 TEST_F(ResourceLoaderTest, SyncCancelOnReceivedEof) {
1089 raw_ptr_resource_handler_->set_on_on_read_eof_result(false); 1089 raw_ptr_resource_handler_->set_on_on_read_eof_result(false);
1090 1090
1091 loader_->StartRequest(); 1091 loader_->StartRequest();
1092 raw_ptr_resource_handler_->WaitUntilResponseComplete(); 1092 raw_ptr_resource_handler_->WaitUntilResponseComplete();
1093 base::RunLoop().RunUntilIdle(); 1093 base::RunLoop().RunUntilIdle();
1094 EXPECT_EQ(1, did_receive_response_); 1094 EXPECT_EQ(1, did_receive_response_);
1095 EXPECT_EQ(1, did_finish_loading_); 1095 EXPECT_EQ(1, did_finish_loading_);
1096 EXPECT_EQ(1, raw_ptr_resource_handler_->on_read_eof()); 1096 EXPECT_EQ(1, raw_ptr_resource_handler_->on_read_eof());
1097 EXPECT_EQ(1, raw_ptr_resource_handler_->on_response_completed_called()); 1097 EXPECT_EQ(1, raw_ptr_resource_handler_->on_response_completed_called());
1098 1098
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
1590 1590
1591 // Tests that the effective connection type is not set on non-main frame 1591 // Tests that the effective connection type is not set on non-main frame
1592 // requests. 1592 // requests.
1593 TEST_F(EffectiveConnectionTypeResourceLoaderTest, DoesNotBelongToMainFrame) { 1593 TEST_F(EffectiveConnectionTypeResourceLoaderTest, DoesNotBelongToMainFrame) {
1594 VerifyEffectiveConnectionType(RESOURCE_TYPE_OBJECT, false, 1594 VerifyEffectiveConnectionType(RESOURCE_TYPE_OBJECT, false,
1595 net::EFFECTIVE_CONNECTION_TYPE_3G, 1595 net::EFFECTIVE_CONNECTION_TYPE_3G,
1596 net::EFFECTIVE_CONNECTION_TYPE_UNKNOWN); 1596 net::EFFECTIVE_CONNECTION_TYPE_UNKNOWN);
1597 } 1597 }
1598 1598
1599 } // namespace content 1599 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698