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

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

Issue 2893233002: Network traffic annotation added to URLLoaderImpl. (Closed)
Patch Set: Mutable network traffic annotation added. 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
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/binding.h" 15 #include "mojo/public/cpp/bindings/binding.h"
16 #include "mojo/public/cpp/bindings/interface_ptr.h" 16 #include "mojo/public/cpp/bindings/interface_ptr.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 21 matching lines...) Expand all
48 bool Send(IPC::Message* message) override { 49 bool Send(IPC::Message* message) override {
49 ADD_FAILURE() << "IPC::Sender::Send should not be called."; 50 ADD_FAILURE() << "IPC::Sender::Send should not be called.";
50 return false; 51 return false;
51 } 52 }
52 53
53 void CreateLoaderAndStart(mojom::URLLoaderRequest request, 54 void CreateLoaderAndStart(mojom::URLLoaderRequest request,
54 int32_t routing_id, 55 int32_t routing_id,
55 int32_t request_id, 56 int32_t request_id,
56 uint32_t options, 57 uint32_t options,
57 const ResourceRequest& url_request, 58 const ResourceRequest& url_request,
58 mojom::URLLoaderClientPtr client) override { 59 mojom::URLLoaderClientPtr client,
60 const net::MutableNetworkTrafficAnnotationTag&
61 traffic_annotation) override {
59 url_loader_client_ = std::move(client); 62 url_loader_client_ = std::move(client);
60 } 63 }
61 64
62 void SyncLoad(int32_t routing_id, 65 void SyncLoad(int32_t routing_id,
63 int32_t request_id, 66 int32_t request_id,
64 const ResourceRequest& request, 67 const ResourceRequest& request,
65 SyncLoadCallback callback) override { 68 SyncLoadCallback callback) override {
66 NOTREACHED(); 69 NOTREACHED();
67 } 70 }
68 71
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 521
519 dispatcher_->SetDefersLoading(request_id_, false); 522 dispatcher_->SetDefersLoading(request_id_, false);
520 base::RunLoop().RunUntilIdle(); 523 base::RunLoop().RunUntilIdle();
521 EXPECT_TRUE(request_peer_context_.received_response); 524 EXPECT_TRUE(request_peer_context_.received_response);
522 EXPECT_TRUE(request_peer_context_.complete); 525 EXPECT_TRUE(request_peer_context_.complete);
523 EXPECT_EQ(4, request_peer_context_.total_encoded_data_length); 526 EXPECT_EQ(4, request_peer_context_.total_encoded_data_length);
524 EXPECT_FALSE(request_peer_context_.cancelled); 527 EXPECT_FALSE(request_peer_context_.cancelled);
525 } 528 }
526 529
527 } // namespace content 530 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698