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

Side by Side Diff: content/browser/loader/url_loader_factory_impl_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/url_loader_factory_impl.h" 5 #include "content/browser/loader/url_loader_factory_impl.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 // must be blob scheme. 266 // must be blob scheme.
267 request.resource_type = RESOURCE_TYPE_XHR; 267 request.resource_type = RESOURCE_TYPE_XHR;
268 // Need to set |request_initiator| for non main frame type request. 268 // Need to set |request_initiator| for non main frame type request.
269 request.request_initiator = url::Origin(); 269 request.request_initiator = url::Origin();
270 factory_->CreateLoaderAndStart( 270 factory_->CreateLoaderAndStart(
271 mojo::MakeRequest(&loader, factory_.associated_group()), 2, 1, request, 271 mojo::MakeRequest(&loader, factory_.associated_group()), 2, 1, request,
272 client.CreateRemoteAssociatedPtrInfo(factory_.associated_group())); 272 client.CreateRemoteAssociatedPtrInfo(factory_.associated_group()));
273 273
274 client.RunUntilComplete(); 274 client.RunUntilComplete();
275 ASSERT_FALSE(client.has_received_response()); 275 ASSERT_FALSE(client.has_received_response());
276 ASSERT_TRUE(client.response_body().is_valid()); 276 ASSERT_FALSE(client.response_body().is_valid());
277 277
278 EXPECT_EQ(net::ERR_TIMED_OUT, client.completion_status().error_code); 278 EXPECT_EQ(net::ERR_TIMED_OUT, client.completion_status().error_code);
279 EXPECT_GT(client.completion_status().encoded_data_length, 0); 279 EXPECT_GT(client.completion_status().encoded_data_length, 0);
280 EXPECT_EQ(0, client.completion_status().encoded_body_length); 280 EXPECT_EQ(0, client.completion_status().encoded_body_length);
281 } 281 }
282 282
283 // This test tests a case where resource loading is cancelled before started. 283 // This test tests a case where resource loading is cancelled before started.
284 TEST_P(URLLoaderFactoryImplTest, InvalidURL) { 284 TEST_P(URLLoaderFactoryImplTest, InvalidURL) {
285 mojom::URLLoaderAssociatedPtr loader; 285 mojom::URLLoaderAssociatedPtr loader;
286 ResourceRequest request; 286 ResourceRequest request;
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 ASSERT_FALSE(rdh_.GetURLRequest(GlobalRequestID(kChildId, kRequestId))); 559 ASSERT_FALSE(rdh_.GetURLRequest(GlobalRequestID(kChildId, kRequestId)));
560 } 560 }
561 561
562 INSTANTIATE_TEST_CASE_P(URLLoaderFactoryImplTest, 562 INSTANTIATE_TEST_CASE_P(URLLoaderFactoryImplTest,
563 URLLoaderFactoryImplTest, 563 URLLoaderFactoryImplTest,
564 ::testing::Values(128, 32 * 1024)); 564 ::testing::Values(128, 32 * 1024));
565 565
566 } // namespace 566 } // namespace
567 567
568 } // namespace content 568 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698