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

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

Issue 2893233002: Network traffic annotation added to URLLoaderImpl. (Closed)
Patch Set: Comment addressed, Merged. Created 3 years, 6 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
« no previous file with comments | « content/child/resource_dispatcher.cc ('k') | content/common/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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" 15 #include "mojo/public/cpp/bindings/associated_interface_ptr_info.h"
16 #include "mojo/public/cpp/bindings/binding.h" 16 #include "mojo/public/cpp/bindings/binding.h"
17 #include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
17 #include "net/url_request/redirect_info.h" 18 #include "net/url_request/redirect_info.h"
18 #include "testing/gtest/include/gtest/gtest.h" 19 #include "testing/gtest/include/gtest/gtest.h"
19 20
20 namespace content { 21 namespace content {
21 22
22 class URLLoaderClientImplTest : public ::testing::Test, 23 class URLLoaderClientImplTest : public ::testing::Test,
23 IPC::Sender, 24 IPC::Sender,
24 mojom::URLLoaderFactory { 25 mojom::URLLoaderFactory {
25 protected: 26 protected:
26 URLLoaderClientImplTest() 27 URLLoaderClientImplTest()
(...skipping 23 matching lines...) Expand all
50 bool Send(IPC::Message* message) override { 51 bool Send(IPC::Message* message) override {
51 ADD_FAILURE() << "IPC::Sender::Send should not be called."; 52 ADD_FAILURE() << "IPC::Sender::Send should not be called.";
52 return false; 53 return false;
53 } 54 }
54 55
55 void CreateLoaderAndStart(mojom::URLLoaderAssociatedRequest request, 56 void CreateLoaderAndStart(mojom::URLLoaderAssociatedRequest request,
56 int32_t routing_id, 57 int32_t routing_id,
57 int32_t request_id, 58 int32_t request_id,
58 uint32_t options, 59 uint32_t options,
59 const ResourceRequest& url_request, 60 const ResourceRequest& url_request,
60 mojom::URLLoaderClientPtr client) override { 61 mojom::URLLoaderClientPtr client,
62 const net::MutableNetworkTrafficAnnotationTag&
63 traffic_annotation) override {
61 url_loader_client_ = std::move(client); 64 url_loader_client_ = std::move(client);
62 } 65 }
63 66
64 void SyncLoad(int32_t routing_id, 67 void SyncLoad(int32_t routing_id,
65 int32_t request_id, 68 int32_t request_id,
66 const ResourceRequest& request, 69 const ResourceRequest& request,
67 SyncLoadCallback callback) override { 70 SyncLoadCallback callback) override {
68 NOTREACHED(); 71 NOTREACHED();
69 } 72 }
70 73
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 523
521 dispatcher_->SetDefersLoading(request_id_, false); 524 dispatcher_->SetDefersLoading(request_id_, false);
522 base::RunLoop().RunUntilIdle(); 525 base::RunLoop().RunUntilIdle();
523 EXPECT_TRUE(request_peer_context_.received_response); 526 EXPECT_TRUE(request_peer_context_.received_response);
524 EXPECT_TRUE(request_peer_context_.complete); 527 EXPECT_TRUE(request_peer_context_.complete);
525 EXPECT_EQ(4, request_peer_context_.total_encoded_data_length); 528 EXPECT_EQ(4, request_peer_context_.total_encoded_data_length);
526 EXPECT_FALSE(request_peer_context_.cancelled); 529 EXPECT_FALSE(request_peer_context_.cancelled);
527 } 530 }
528 531
529 } // namespace content 532 } // namespace content
OLDNEW
« no previous file with comments | « content/child/resource_dispatcher.cc ('k') | content/common/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698