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

Side by Side Diff: content/browser/loader/mojo_async_resource_handler_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
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/mojo_async_resource_handler.h" 5 #include "content/browser/loader/mojo_async_resource_handler.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 class TestURLLoaderFactory final : public mojom::URLLoaderFactory { 289 class TestURLLoaderFactory final : public mojom::URLLoaderFactory {
290 public: 290 public:
291 TestURLLoaderFactory() {} 291 TestURLLoaderFactory() {}
292 ~TestURLLoaderFactory() override {} 292 ~TestURLLoaderFactory() override {}
293 293
294 void CreateLoaderAndStart(mojom::URLLoaderAssociatedRequest request, 294 void CreateLoaderAndStart(mojom::URLLoaderAssociatedRequest request,
295 int32_t routing_id, 295 int32_t routing_id,
296 int32_t request_id, 296 int32_t request_id,
297 uint32_t options, 297 uint32_t options,
298 const ResourceRequest& url_request, 298 const ResourceRequest& url_request,
299 mojom::URLLoaderClientPtr client_ptr) override { 299 mojom::URLLoaderClientPtr client_ptr,
300 const net::MutableNetworkTrafficAnnotationTag&
301 traffic_annotation) override {
300 loader_request_ = std::move(request); 302 loader_request_ = std::move(request);
301 client_ptr_ = std::move(client_ptr); 303 client_ptr_ = std::move(client_ptr);
302 } 304 }
303 305
304 mojom::URLLoaderAssociatedRequest PassLoaderRequest() { 306 mojom::URLLoaderAssociatedRequest PassLoaderRequest() {
305 return std::move(loader_request_); 307 return std::move(loader_request_);
306 } 308 }
307 309
308 mojom::URLLoaderClientPtr PassClientPtr() { return std::move(client_ptr_); } 310 mojom::URLLoaderClientPtr PassClientPtr() { return std::move(client_ptr_); }
309 311
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 ); 355 );
354 356
355 ResourceRequest request; 357 ResourceRequest request;
356 base::WeakPtr<mojo::StrongBinding<mojom::URLLoaderFactory>> weak_binding = 358 base::WeakPtr<mojo::StrongBinding<mojom::URLLoaderFactory>> weak_binding =
357 mojo::MakeStrongBinding(base::MakeUnique<TestURLLoaderFactory>(), 359 mojo::MakeStrongBinding(base::MakeUnique<TestURLLoaderFactory>(),
358 mojo::MakeRequest(&url_loader_factory_)); 360 mojo::MakeRequest(&url_loader_factory_));
359 361
360 url_loader_factory_->CreateLoaderAndStart( 362 url_loader_factory_->CreateLoaderAndStart(
361 mojo::MakeRequest(&url_loader_proxy_), kRouteId, kRequestId, 363 mojo::MakeRequest(&url_loader_proxy_), kRouteId, kRequestId,
362 mojom::kURLLoadOptionNone, request, 364 mojom::kURLLoadOptionNone, request,
363 url_loader_client_.CreateInterfacePtr()); 365 url_loader_client_.CreateInterfacePtr(),
366 net::MutableNetworkTrafficAnnotationTag(TRAFFIC_ANNOTATION_FOR_TESTS));
364 367
365 url_loader_factory_.FlushForTesting(); 368 url_loader_factory_.FlushForTesting();
366 DCHECK(weak_binding); 369 DCHECK(weak_binding);
367 TestURLLoaderFactory* factory_impl = 370 TestURLLoaderFactory* factory_impl =
368 static_cast<TestURLLoaderFactory*>(weak_binding->impl()); 371 static_cast<TestURLLoaderFactory*>(weak_binding->impl());
369 372
370 handler_.reset(new MojoAsyncResourceHandlerWithStubOperations( 373 handler_.reset(new MojoAsyncResourceHandlerWithStubOperations(
371 request_.get(), &rdh_, factory_impl->PassLoaderRequest(), 374 request_.get(), &rdh_, factory_impl->PassLoaderRequest(),
372 factory_impl->PassClientPtr())); 375 factory_impl->PassClientPtr()));
373 mock_loader_.reset(new MockResourceLoader(handler_.get())); 376 mock_loader_.reset(new MockResourceLoader(handler_.get()));
(...skipping 985 matching lines...) Expand 10 before | Expand all | Expand 10 after
1359 } 1362 }
1360 } 1363 }
1361 EXPECT_EQ("B", body); 1364 EXPECT_EQ("B", body);
1362 } 1365 }
1363 1366
1364 INSTANTIATE_TEST_CASE_P(MojoAsyncResourceHandlerWithAllocationSizeTest, 1367 INSTANTIATE_TEST_CASE_P(MojoAsyncResourceHandlerWithAllocationSizeTest,
1365 MojoAsyncResourceHandlerWithAllocationSizeTest, 1368 MojoAsyncResourceHandlerWithAllocationSizeTest,
1366 ::testing::Values(8, 32 * 2014)); 1369 ::testing::Values(8, 32 * 2014));
1367 } // namespace 1370 } // namespace
1368 } // namespace content 1371 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/blob_storage/blob_url_unittest.cc ('k') | content/browser/loader/navigation_url_loader_network_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698