| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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/common/throttling_url_loader.h" | 5 #include "content/common/throttling_url_loader.h" |
| 6 #include "base/logging.h" | 6 #include "base/logging.h" |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "content/common/url_loader.mojom.h" | 10 #include "content/common/url_loader.mojom.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 } | 39 } |
| 40 | 40 |
| 41 void NotifyClientOnComplete(int error_code) { | 41 void NotifyClientOnComplete(int error_code) { |
| 42 ResourceRequestCompletionStatus data; | 42 ResourceRequestCompletionStatus data; |
| 43 data.error_code = error_code; | 43 data.error_code = error_code; |
| 44 client_ptr_->OnComplete(data); | 44 client_ptr_->OnComplete(data); |
| 45 } | 45 } |
| 46 | 46 |
| 47 private: | 47 private: |
| 48 // mojom::URLLoaderFactory implementation. | 48 // mojom::URLLoaderFactory implementation. |
| 49 void CreateLoaderAndStart(mojom::URLLoaderAssociatedRequest request, | 49 void CreateLoaderAndStart(mojom::URLLoaderRequest request, |
| 50 int32_t routing_id, | 50 int32_t routing_id, |
| 51 int32_t request_id, | 51 int32_t request_id, |
| 52 uint32_t options, | 52 uint32_t options, |
| 53 const ResourceRequest& url_request, | 53 const ResourceRequest& url_request, |
| 54 mojom::URLLoaderClientPtr client, | 54 mojom::URLLoaderClientPtr client, |
| 55 const net::MutableNetworkTrafficAnnotationTag& | 55 const net::MutableNetworkTrafficAnnotationTag& |
| 56 traffic_annotation) override { | 56 traffic_annotation) override { |
| 57 create_loader_and_start_called_++; | 57 create_loader_and_start_called_++; |
| 58 | 58 |
| 59 client_ptr_ = std::move(client); | 59 client_ptr_ = std::move(client); |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 555 EXPECT_EQ(0u, throttle_->will_redirect_request_called()); | 555 EXPECT_EQ(0u, throttle_->will_redirect_request_called()); |
| 556 EXPECT_EQ(1u, throttle_->will_process_response_called()); | 556 EXPECT_EQ(1u, throttle_->will_process_response_called()); |
| 557 | 557 |
| 558 EXPECT_EQ(0u, client_.on_received_response_called()); | 558 EXPECT_EQ(0u, client_.on_received_response_called()); |
| 559 EXPECT_EQ(0u, client_.on_received_redirect_called()); | 559 EXPECT_EQ(0u, client_.on_received_redirect_called()); |
| 560 EXPECT_EQ(1u, client_.on_complete_called()); | 560 EXPECT_EQ(1u, client_.on_complete_called()); |
| 561 } | 561 } |
| 562 | 562 |
| 563 } // namespace | 563 } // namespace |
| 564 } // namespace content | 564 } // namespace content |
| OLD | NEW |