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

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

Issue 2900563002: Network service: Safe browsing check for sub-resources from renderer. (Closed)
Patch Set: . 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/web_url_loader_impl.cc ('k') | content/public/child/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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/web_url_loader_impl.h" 5 #include "content/child/web_url_loader_impl.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <string.h> 8 #include <string.h>
9 9
10 #include <utility> 10 #include <utility>
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 TestResourceDispatcher() : 60 TestResourceDispatcher() :
61 ResourceDispatcher(nullptr, nullptr), 61 ResourceDispatcher(nullptr, nullptr),
62 canceled_(false), 62 canceled_(false),
63 defers_loading_(false) { 63 defers_loading_(false) {
64 } 64 }
65 65
66 ~TestResourceDispatcher() override {} 66 ~TestResourceDispatcher() override {}
67 67
68 // TestDispatcher implementation: 68 // TestDispatcher implementation:
69 69
70 void StartSync(std::unique_ptr<ResourceRequest> request, 70 void StartSync(
71 int routing_id, 71 std::unique_ptr<ResourceRequest> request,
72 SyncLoadResponse* response, 72 int routing_id,
73 blink::WebURLRequest::LoadingIPCType ipc_type, 73 SyncLoadResponse* response,
74 mojom::URLLoaderFactory* url_loader_factory) override { 74 blink::WebURLRequest::LoadingIPCType ipc_type,
75 mojom::URLLoaderFactory* url_loader_factory,
76 std::vector<std::unique_ptr<URLLoaderThrottle>> throttles) override {
75 *response = sync_load_response_; 77 *response = sync_load_response_;
76 } 78 }
77 79
78 int StartAsync( 80 int StartAsync(
79 std::unique_ptr<ResourceRequest> request, 81 std::unique_ptr<ResourceRequest> request,
80 int routing_id, 82 int routing_id,
81 scoped_refptr<base::SingleThreadTaskRunner> loading_task_runner, 83 scoped_refptr<base::SingleThreadTaskRunner> loading_task_runner,
82 const url::Origin& frame_origin, 84 const url::Origin& frame_origin,
83 std::unique_ptr<RequestPeer> peer, 85 std::unique_ptr<RequestPeer> peer,
84 blink::WebURLRequest::LoadingIPCType ipc_type, 86 blink::WebURLRequest::LoadingIPCType ipc_type,
85 mojom::URLLoaderFactory* url_loader_factory, 87 mojom::URLLoaderFactory* url_loader_factory,
88 std::vector<std::unique_ptr<URLLoaderThrottle>> throttles,
86 mojo::ScopedDataPipeConsumerHandle consumer_handle) override { 89 mojo::ScopedDataPipeConsumerHandle consumer_handle) override {
87 EXPECT_FALSE(peer_); 90 EXPECT_FALSE(peer_);
88 peer_ = std::move(peer); 91 peer_ = std::move(peer);
89 url_ = request->url; 92 url_ = request->url;
90 stream_url_ = request->resource_body_stream_url; 93 stream_url_ = request->resource_body_stream_url;
91 return 1; 94 return 1;
92 } 95 }
93 96
94 void Cancel(int request_id) override { 97 void Cancel(int request_id) override {
95 EXPECT_FALSE(canceled_); 98 EXPECT_FALSE(canceled_);
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after
692 int64_t encoded_body_length = 0; 695 int64_t encoded_body_length = 0;
693 client()->loader()->LoadSynchronously( 696 client()->loader()->LoadSynchronously(
694 request, response, error, data, encoded_data_length, encoded_body_length); 697 request, response, error, data, encoded_data_length, encoded_body_length);
695 698
696 EXPECT_EQ(kEncodedBodyLength, encoded_body_length); 699 EXPECT_EQ(kEncodedBodyLength, encoded_body_length);
697 EXPECT_EQ(kEncodedDataLength, encoded_data_length); 700 EXPECT_EQ(kEncodedDataLength, encoded_data_length);
698 } 701 }
699 702
700 } // namespace 703 } // namespace
701 } // namespace content 704 } // namespace content
OLDNEW
« no previous file with comments | « content/child/web_url_loader_impl.cc ('k') | content/public/child/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698