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

Side by Side Diff: content/child/url_loader_client_impl_unittest.cc

Issue 2954853002: Use Independent URLLoader
Patch Set: . Created 3 years, 5 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/child/url_loader_client_impl.h" 5 #include "content/child/url_loader_client_impl.h"
6 6
7 #include <vector> 7 #include <vector>
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
11 #include "content/child/resource_dispatcher.h" 11 #include "content/child/resource_dispatcher.h"
12 #include "content/child/test_request_peer.h" 12 #include "content/child/test_request_peer.h"
13 #include "content/common/url_loader_factory.mojom.h" 13 #include "content/common/url_loader_factory.mojom.h"
14 #include "ipc/ipc_sender.h" 14 #include "ipc/ipc_sender.h"
15 #include "mojo/public/cpp/bindings/associated_interface_ptr_info.h"
16 #include "mojo/public/cpp/bindings/binding.h" 15 #include "mojo/public/cpp/bindings/binding.h"
16 #include "mojo/public/cpp/bindings/interface_ptr.h"
17 #include "net/traffic_annotation/network_traffic_annotation_test_helper.h" 17 #include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
18 #include "net/url_request/redirect_info.h" 18 #include "net/url_request/redirect_info.h"
19 #include "testing/gtest/include/gtest/gtest.h" 19 #include "testing/gtest/include/gtest/gtest.h"
20 20
21 namespace content { 21 namespace content {
22 22
23 class URLLoaderClientImplTest : public ::testing::Test, 23 class URLLoaderClientImplTest : public ::testing::Test,
24 IPC::Sender, 24 IPC::Sender,
25 mojom::URLLoaderFactory { 25 mojom::URLLoaderFactory {
26 protected: 26 protected:
(...skipping 19 matching lines...) Expand all
46 void TearDown() override { 46 void TearDown() override {
47 url_loader_client_ = nullptr; 47 url_loader_client_ = nullptr;
48 url_loader_factory_proxy_ = nullptr; 48 url_loader_factory_proxy_ = nullptr;
49 } 49 }
50 50
51 bool Send(IPC::Message* message) override { 51 bool Send(IPC::Message* message) override {
52 ADD_FAILURE() << "IPC::Sender::Send should not be called."; 52 ADD_FAILURE() << "IPC::Sender::Send should not be called.";
53 return false; 53 return false;
54 } 54 }
55 55
56 void CreateLoaderAndStart(mojom::URLLoaderAssociatedRequest request, 56 void CreateLoaderAndStart(mojom::URLLoaderRequest request,
57 int32_t routing_id, 57 int32_t routing_id,
58 int32_t request_id, 58 int32_t request_id,
59 uint32_t options, 59 uint32_t options,
60 const ResourceRequest& url_request, 60 const ResourceRequest& url_request,
61 mojom::URLLoaderClientPtr client, 61 mojom::URLLoaderClientPtr client,
62 const net::MutableNetworkTrafficAnnotationTag& 62 const net::MutableNetworkTrafficAnnotationTag&
63 traffic_annotation) override { 63 traffic_annotation) override {
64 url_loader_client_ = std::move(client); 64 url_loader_client_ = std::move(client);
65 } 65 }
66 66
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 523
524 dispatcher_->SetDefersLoading(request_id_, false); 524 dispatcher_->SetDefersLoading(request_id_, false);
525 base::RunLoop().RunUntilIdle(); 525 base::RunLoop().RunUntilIdle();
526 EXPECT_TRUE(request_peer_context_.received_response); 526 EXPECT_TRUE(request_peer_context_.received_response);
527 EXPECT_TRUE(request_peer_context_.complete); 527 EXPECT_TRUE(request_peer_context_.complete);
528 EXPECT_EQ(4, request_peer_context_.total_encoded_data_length); 528 EXPECT_EQ(4, request_peer_context_.total_encoded_data_length);
529 EXPECT_FALSE(request_peer_context_.cancelled); 529 EXPECT_FALSE(request_peer_context_.cancelled);
530 } 530 }
531 531
532 } // namespace content 532 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/webui/web_ui_url_loader_factory.cc ('k') | content/common/throttling_url_loader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698