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

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

Issue 2629513003: Implement CachedMetadata handling on MojoAsyncResourceHandler (Closed)
Patch Set: fix Created 3 years, 11 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
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) 71 if (context_->defer_on_transfer_size_updated)
72 dispatcher_->SetDefersLoading(context_->request_id, true); 72 dispatcher_->SetDefersLoading(context_->request_id, true);
73 } 73 }
74 74
75 void TestRequestPeer::OnReceivedCachedMetadata(const char* data, int len) {
76 EXPECT_TRUE(context_->received_response);
77 EXPECT_FALSE(context_->complete);
78 if (context_->cancelled)
79 return;
80 context_->cached_metadata = std::vector<char>(data, data + len);
81 }
82
75 void TestRequestPeer::OnCompletedRequest(int error_code, 83 void TestRequestPeer::OnCompletedRequest(int error_code,
76 bool was_ignored_by_handler, 84 bool was_ignored_by_handler,
77 bool stale_copy_in_cache, 85 bool stale_copy_in_cache,
78 const base::TimeTicks& completion_time, 86 const base::TimeTicks& completion_time,
79 int64_t total_transfer_size, 87 int64_t total_transfer_size,
80 int64_t encoded_body_size) { 88 int64_t encoded_body_size) {
81 if (context_->cancelled) 89 if (context_->cancelled)
82 return; 90 return;
83 EXPECT_TRUE(context_->received_response); 91 EXPECT_TRUE(context_->received_response);
84 EXPECT_FALSE(context_->complete); 92 EXPECT_FALSE(context_->complete);
85 context_->complete = true; 93 context_->complete = true;
86 } 94 }
87 95
88 TestRequestPeer::Context::Context() = default; 96 TestRequestPeer::Context::Context() = default;
89 TestRequestPeer::Context::~Context() = default; 97 TestRequestPeer::Context::~Context() = default;
90 98
91 } // namespace content 99 } // 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