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

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

Issue 2591383003: Implement SetDefersLoading on content::URLLoaderClientImpl (Closed)
Patch Set: fix Created 3 years, 12 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/test_request_peer.h ('k') | content/child/url_loader_client_impl.h » ('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/test_request_peer.h" 5 #include "content/child/test_request_peer.h"
6 6
7 #include "content/child/resource_dispatcher.h" 7 #include "content/child/resource_dispatcher.h"
8 #include "net/url_request/redirect_info.h" 8 #include "net/url_request/redirect_info.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 context_->cancelled = true; 61 context_->cancelled = true;
62 } 62 }
63 } 63 }
64 64
65 void TestRequestPeer::OnTransferSizeUpdated(int transfer_size_diff) { 65 void TestRequestPeer::OnTransferSizeUpdated(int transfer_size_diff) {
66 EXPECT_TRUE(context_->received_response); 66 EXPECT_TRUE(context_->received_response);
67 EXPECT_FALSE(context_->complete); 67 EXPECT_FALSE(context_->complete);
68 if (context_->cancelled) 68 if (context_->cancelled)
69 return; 69 return;
70 context_->total_encoded_data_length += transfer_size_diff; 70 context_->total_encoded_data_length += transfer_size_diff;
71 if (context_->defer_on_transfer_size_updated)
72 dispatcher_->SetDefersLoading(context_->request_id, true);
71 } 73 }
72 74
73 void TestRequestPeer::OnCompletedRequest(int error_code, 75 void TestRequestPeer::OnCompletedRequest(int error_code,
74 bool was_ignored_by_handler, 76 bool was_ignored_by_handler,
75 bool stale_copy_in_cache, 77 bool stale_copy_in_cache,
76 const base::TimeTicks& completion_time, 78 const base::TimeTicks& completion_time,
77 int64_t total_transfer_size, 79 int64_t total_transfer_size,
78 int64_t encoded_body_size) { 80 int64_t encoded_body_size) {
79 if (context_->cancelled) 81 if (context_->cancelled)
80 return; 82 return;
81 EXPECT_TRUE(context_->received_response); 83 EXPECT_TRUE(context_->received_response);
82 EXPECT_FALSE(context_->complete); 84 EXPECT_FALSE(context_->complete);
83 context_->complete = true; 85 context_->complete = true;
84 } 86 }
85 87
86 TestRequestPeer::Context::Context() = default; 88 TestRequestPeer::Context::Context() = default;
87 TestRequestPeer::Context::~Context() = default; 89 TestRequestPeer::Context::~Context() = default;
88 90
89 } // namespace content 91 } // namespace content
OLDNEW
« no previous file with comments | « content/child/test_request_peer.h ('k') | content/child/url_loader_client_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698