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

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

Issue 2633123002: [Mojo-Loading] OnStartLoadingResponseBody should be called after OnReceiveResponse (Closed)
Patch Set: fix 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/mojo_async_resource_handler.h" 5 #include "content/browser/loader/mojo_async_resource_handler.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 1066 matching lines...) Expand 10 before | Expand all | Expand 10 after
1077 TEST_P( 1077 TEST_P(
1078 MojoAsyncResourceHandlerWithAllocationSizeTest, 1078 MojoAsyncResourceHandlerWithAllocationSizeTest,
1079 OnWillStartThenOnWillReadThenOnResponseStartedThenOnReadCompletedThenOnRespo nseCompleted) { 1079 OnWillStartThenOnWillReadThenOnResponseStartedThenOnReadCompletedThenOnRespo nseCompleted) {
1080 rdh_delegate_.set_num_on_response_started_calls_expectation(1); 1080 rdh_delegate_.set_num_on_response_started_calls_expectation(1);
1081 1081
1082 ASSERT_EQ(MockResourceLoader::Status::IDLE, 1082 ASSERT_EQ(MockResourceLoader::Status::IDLE,
1083 mock_loader_->OnWillStart(request_->url())); 1083 mock_loader_->OnWillStart(request_->url()));
1084 1084
1085 ASSERT_EQ(MockResourceLoader::Status::IDLE, mock_loader_->OnWillRead(-1)); 1085 ASSERT_EQ(MockResourceLoader::Status::IDLE, mock_loader_->OnWillRead(-1));
1086 1086
1087 ASSERT_FALSE(url_loader_client_.response_body().is_valid());
1088 url_loader_client_.RunUntilResponseBodyArrived();
1089 ASSERT_TRUE(url_loader_client_.response_body().is_valid());
1090
1091 ASSERT_EQ(MockResourceLoader::Status::IDLE, 1087 ASSERT_EQ(MockResourceLoader::Status::IDLE,
1092 mock_loader_->OnResponseStarted( 1088 mock_loader_->OnResponseStarted(
1093 make_scoped_refptr(new ResourceResponse()))); 1089 make_scoped_refptr(new ResourceResponse())));
1094 1090
1095 ASSERT_FALSE(url_loader_client_.has_received_response()); 1091 ASSERT_FALSE(url_loader_client_.has_received_response());
1092 ASSERT_FALSE(url_loader_client_.response_body().is_valid());
1096 url_loader_client_.RunUntilResponseReceived(); 1093 url_loader_client_.RunUntilResponseReceived();
1094 url_loader_client_.RunUntilResponseBodyArrived();
1097 1095
1098 ASSERT_EQ(MockResourceLoader::Status::IDLE, 1096 ASSERT_EQ(MockResourceLoader::Status::IDLE,
1099 mock_loader_->OnReadCompleted("B")); 1097 mock_loader_->OnReadCompleted("B"));
1100 net::URLRequestStatus status(net::URLRequestStatus::SUCCESS, net::OK); 1098 net::URLRequestStatus status(net::URLRequestStatus::SUCCESS, net::OK);
1101 ASSERT_EQ(MockResourceLoader::Status::IDLE, 1099 ASSERT_EQ(MockResourceLoader::Status::IDLE,
1102 mock_loader_->OnResponseCompleted(status)); 1100 mock_loader_->OnResponseCompleted(status));
1103 1101
1104 ASSERT_FALSE(url_loader_client_.has_received_completion()); 1102 ASSERT_FALSE(url_loader_client_.has_received_completion());
1105 url_loader_client_.RunUntilComplete(); 1103 url_loader_client_.RunUntilComplete();
1106 EXPECT_EQ(net::OK, url_loader_client_.completion_status().error_code); 1104 EXPECT_EQ(net::OK, url_loader_client_.completion_status().error_code);
(...skipping 15 matching lines...) Expand all
1122 } 1120 }
1123 } 1121 }
1124 EXPECT_EQ("B", body); 1122 EXPECT_EQ("B", body);
1125 } 1123 }
1126 1124
1127 INSTANTIATE_TEST_CASE_P(MojoAsyncResourceHandlerWithAllocationSizeTest, 1125 INSTANTIATE_TEST_CASE_P(MojoAsyncResourceHandlerWithAllocationSizeTest,
1128 MojoAsyncResourceHandlerWithAllocationSizeTest, 1126 MojoAsyncResourceHandlerWithAllocationSizeTest,
1129 ::testing::Values(8, 32 * 2014)); 1127 ::testing::Values(8, 32 * 2014));
1130 } // namespace 1128 } // namespace
1131 } // namespace content 1129 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698