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

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

Issue 2023243002: Remove base::Tuple (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: lint fix Created 4 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/resource_dispatcher.h" 5 #include "content/child/resource_dispatcher.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
11 #include <string> 11 #include <string>
12 #include <tuple>
12 #include <utility> 13 #include <utility>
13 #include <vector> 14 #include <vector>
14 15
15 #include "base/macros.h" 16 #include "base/macros.h"
16 #include "base/memory/ptr_util.h" 17 #include "base/memory/ptr_util.h"
17 #include "base/memory/shared_memory.h" 18 #include "base/memory/shared_memory.h"
18 #include "base/message_loop/message_loop.h" 19 #include "base/message_loop/message_loop.h"
19 #include "base/process/process_handle.h" 20 #include "base/process/process_handle.h"
20 #include "base/run_loop.h" 21 #include "base/run_loop.h"
21 #include "base/stl_util.h" 22 #include "base/stl_util.h"
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 ADD_FAILURE() << "Missing resource request message"; 168 ADD_FAILURE() << "Missing resource request message";
168 return -1; 169 return -1;
169 } 170 }
170 171
171 ResourceHostMsg_RequestResource::Param params; 172 ResourceHostMsg_RequestResource::Param params;
172 if (ResourceHostMsg_RequestResource::ID != message_queue_[0].type() || 173 if (ResourceHostMsg_RequestResource::ID != message_queue_[0].type() ||
173 !ResourceHostMsg_RequestResource::Read(&message_queue_[0], &params)) { 174 !ResourceHostMsg_RequestResource::Read(&message_queue_[0], &params)) {
174 ADD_FAILURE() << "Expected ResourceHostMsg_RequestResource message"; 175 ADD_FAILURE() << "Expected ResourceHostMsg_RequestResource message";
175 return -1; 176 return -1;
176 } 177 }
177 ResourceRequest request = base::get<2>(params); 178 ResourceRequest request = std::get<2>(params);
178 EXPECT_EQ(kTestPageUrl, request.url.spec()); 179 EXPECT_EQ(kTestPageUrl, request.url.spec());
179 message_queue_.erase(message_queue_.begin()); 180 message_queue_.erase(message_queue_.begin());
180 return base::get<1>(params); 181 return std::get<1>(params);
181 } 182 }
182 183
183 void ConsumeFollowRedirect(int expected_request_id) { 184 void ConsumeFollowRedirect(int expected_request_id) {
184 ASSERT_FALSE(message_queue_.empty()); 185 ASSERT_FALSE(message_queue_.empty());
185 base::Tuple<int> args; 186 std::tuple<int> args;
186 ASSERT_EQ(ResourceHostMsg_FollowRedirect::ID, message_queue_[0].type()); 187 ASSERT_EQ(ResourceHostMsg_FollowRedirect::ID, message_queue_[0].type());
187 ASSERT_TRUE(ResourceHostMsg_FollowRedirect::Read( 188 ASSERT_TRUE(ResourceHostMsg_FollowRedirect::Read(
188 &message_queue_[0], &args)); 189 &message_queue_[0], &args));
189 EXPECT_EQ(expected_request_id, base::get<0>(args)); 190 EXPECT_EQ(expected_request_id, std::get<0>(args));
190 message_queue_.erase(message_queue_.begin()); 191 message_queue_.erase(message_queue_.begin());
191 } 192 }
192 193
193 void ConsumeDataReceived_ACK(int expected_request_id) { 194 void ConsumeDataReceived_ACK(int expected_request_id) {
194 ASSERT_FALSE(message_queue_.empty()); 195 ASSERT_FALSE(message_queue_.empty());
195 base::Tuple<int> args; 196 std::tuple<int> args;
196 ASSERT_EQ(ResourceHostMsg_DataReceived_ACK::ID, message_queue_[0].type()); 197 ASSERT_EQ(ResourceHostMsg_DataReceived_ACK::ID, message_queue_[0].type());
197 ASSERT_TRUE(ResourceHostMsg_DataReceived_ACK::Read( 198 ASSERT_TRUE(ResourceHostMsg_DataReceived_ACK::Read(
198 &message_queue_[0], &args)); 199 &message_queue_[0], &args));
199 EXPECT_EQ(expected_request_id, base::get<0>(args)); 200 EXPECT_EQ(expected_request_id, std::get<0>(args));
200 message_queue_.erase(message_queue_.begin()); 201 message_queue_.erase(message_queue_.begin());
201 } 202 }
202 203
203 void ConsumeDataDownloaded_ACK(int expected_request_id) { 204 void ConsumeDataDownloaded_ACK(int expected_request_id) {
204 ASSERT_FALSE(message_queue_.empty()); 205 ASSERT_FALSE(message_queue_.empty());
205 base::Tuple<int> args; 206 std::tuple<int> args;
206 ASSERT_EQ(ResourceHostMsg_DataDownloaded_ACK::ID, message_queue_[0].type()); 207 ASSERT_EQ(ResourceHostMsg_DataDownloaded_ACK::ID, message_queue_[0].type());
207 ASSERT_TRUE(ResourceHostMsg_DataDownloaded_ACK::Read( 208 ASSERT_TRUE(ResourceHostMsg_DataDownloaded_ACK::Read(
208 &message_queue_[0], &args)); 209 &message_queue_[0], &args));
209 EXPECT_EQ(expected_request_id, base::get<0>(args)); 210 EXPECT_EQ(expected_request_id, std::get<0>(args));
210 message_queue_.erase(message_queue_.begin()); 211 message_queue_.erase(message_queue_.begin());
211 } 212 }
212 213
213 void ConsumeReleaseDownloadedFile(int expected_request_id) { 214 void ConsumeReleaseDownloadedFile(int expected_request_id) {
214 ASSERT_FALSE(message_queue_.empty()); 215 ASSERT_FALSE(message_queue_.empty());
215 base::Tuple<int> args; 216 std::tuple<int> args;
216 ASSERT_EQ(ResourceHostMsg_ReleaseDownloadedFile::ID, 217 ASSERT_EQ(ResourceHostMsg_ReleaseDownloadedFile::ID,
217 message_queue_[0].type()); 218 message_queue_[0].type());
218 ASSERT_TRUE(ResourceHostMsg_ReleaseDownloadedFile::Read( 219 ASSERT_TRUE(ResourceHostMsg_ReleaseDownloadedFile::Read(
219 &message_queue_[0], &args)); 220 &message_queue_[0], &args));
220 EXPECT_EQ(expected_request_id, base::get<0>(args)); 221 EXPECT_EQ(expected_request_id, std::get<0>(args));
221 message_queue_.erase(message_queue_.begin()); 222 message_queue_.erase(message_queue_.begin());
222 } 223 }
223 224
224 void ConsumeCancelRequest(int expected_request_id) { 225 void ConsumeCancelRequest(int expected_request_id) {
225 ASSERT_FALSE(message_queue_.empty()); 226 ASSERT_FALSE(message_queue_.empty());
226 base::Tuple<int> args; 227 std::tuple<int> args;
227 ASSERT_EQ(ResourceHostMsg_CancelRequest::ID, message_queue_[0].type()); 228 ASSERT_EQ(ResourceHostMsg_CancelRequest::ID, message_queue_[0].type());
228 ASSERT_TRUE(ResourceHostMsg_CancelRequest::Read( 229 ASSERT_TRUE(ResourceHostMsg_CancelRequest::Read(
229 &message_queue_[0], &args)); 230 &message_queue_[0], &args));
230 EXPECT_EQ(expected_request_id, base::get<0>(args)); 231 EXPECT_EQ(expected_request_id, std::get<0>(args));
231 message_queue_.erase(message_queue_.begin()); 232 message_queue_.erase(message_queue_.begin());
232 } 233 }
233 234
234 void NotifyReceivedRedirect(int request_id) { 235 void NotifyReceivedRedirect(int request_id) {
235 ResourceResponseHead head; 236 ResourceResponseHead head;
236 std::string raw_headers(kTestRedirectHeaders); 237 std::string raw_headers(kTestRedirectHeaders);
237 std::replace(raw_headers.begin(), raw_headers.end(), '\n', '\0'); 238 std::replace(raw_headers.begin(), raw_headers.end(), '\n', '\0');
238 head.headers = new net::HttpResponseHeaders(raw_headers); 239 head.headers = new net::HttpResponseHeaders(raw_headers);
239 net::RedirectInfo redirect_info; 240 net::RedirectInfo redirect_info;
240 redirect_info.status_code = 302; 241 redirect_info.status_code = 302;
(...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after
895 ResourceResponseHead response_head; 896 ResourceResponseHead response_head;
896 897
897 PerformTest(response_head); 898 PerformTest(response_head);
898 899
899 EXPECT_EQ(base::TimeTicks(), response_info().load_timing.request_start); 900 EXPECT_EQ(base::TimeTicks(), response_info().load_timing.request_start);
900 EXPECT_EQ(base::TimeTicks(), 901 EXPECT_EQ(base::TimeTicks(),
901 response_info().load_timing.connect_timing.dns_start); 902 response_info().load_timing.connect_timing.dns_start);
902 } 903 }
903 904
904 } // namespace content 905 } // namespace content
OLDNEW
« no previous file with comments | « content/child/fileapi/webfilesystem_impl.cc ('k') | content/child/shared_memory_received_data_factory_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698