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

Side by Side Diff: chrome/browser/chromeos/fileapi/external_file_url_request_job_unittest.cc

Issue 1870793002: Convert //chrome/browser/chromeos from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chrome/browser/chromeos/fileapi/external_file_url_request_job.h" 5 #include "chrome/browser/chromeos/fileapi/external_file_url_request_job.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory>
10
9 #include "base/bind.h" 11 #include "base/bind.h"
10 #include "base/files/file_util.h" 12 #include "base/files/file_util.h"
11 #include "base/macros.h" 13 #include "base/macros.h"
12 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "base/run_loop.h" 15 #include "base/run_loop.h"
15 #include "base/threading/thread.h" 16 #include "base/threading/thread.h"
16 #include "chrome/browser/chromeos/drive/drive_file_stream_reader.h" 17 #include "chrome/browser/chromeos/drive/drive_file_stream_reader.h"
17 #include "chrome/browser/chromeos/drive/drive_integration_service.h" 18 #include "chrome/browser/chromeos/drive/drive_integration_service.h"
18 #include "chrome/browser/chromeos/drive/file_system_util.h" 19 #include "chrome/browser/chromeos/drive/file_system_util.h"
19 #include "chrome/browser/prefs/browser_prefs.h" 20 #include "chrome/browser/prefs/browser_prefs.h"
20 #include "chrome/browser/profiles/profile_manager.h" 21 #include "chrome/browser/profiles/profile_manager.h"
21 #include "chrome/test/base/testing_browser_process.h" 22 #include "chrome/test/base/testing_browser_process.h"
22 #include "chrome/test/base/testing_profile.h" 23 #include "chrome/test/base/testing_profile.h"
23 #include "chrome/test/base/testing_profile_manager.h" 24 #include "chrome/test/base/testing_profile_manager.h"
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 url_request_context_.reset(new net::URLRequestContext()); 151 url_request_context_.reset(new net::URLRequestContext());
151 url_request_context_->set_job_factory(test_url_request_job_factory_.get()); 152 url_request_context_->set_job_factory(test_url_request_job_factory_.get());
152 url_request_context_->set_network_delegate(test_network_delegate_.get()); 153 url_request_context_->set_network_delegate(test_network_delegate_.get());
153 test_delegate_.reset(new TestDelegate); 154 test_delegate_.reset(new TestDelegate);
154 } 155 }
155 156
156 void TearDown() override { profile_manager_.reset(); } 157 void TearDown() override { profile_manager_.reset(); }
157 158
158 bool ReadDriveFileSync(const base::FilePath& file_path, 159 bool ReadDriveFileSync(const base::FilePath& file_path,
159 std::string* out_content) { 160 std::string* out_content) {
160 scoped_ptr<base::Thread> worker_thread( 161 std::unique_ptr<base::Thread> worker_thread(
161 new base::Thread("ReadDriveFileSync")); 162 new base::Thread("ReadDriveFileSync"));
162 if (!worker_thread->Start()) 163 if (!worker_thread->Start())
163 return false; 164 return false;
164 165
165 scoped_ptr<drive::DriveFileStreamReader> reader( 166 std::unique_ptr<drive::DriveFileStreamReader> reader(
166 new drive::DriveFileStreamReader( 167 new drive::DriveFileStreamReader(
167 base::Bind(&ExternalFileURLRequestJobTest::GetFileSystem, 168 base::Bind(&ExternalFileURLRequestJobTest::GetFileSystem,
168 base::Unretained(this)), 169 base::Unretained(this)),
169 worker_thread->task_runner().get())); 170 worker_thread->task_runner().get()));
170 int error = net::ERR_FAILED; 171 int error = net::ERR_FAILED;
171 scoped_ptr<drive::ResourceEntry> entry; 172 std::unique_ptr<drive::ResourceEntry> entry;
172 { 173 {
173 base::RunLoop run_loop; 174 base::RunLoop run_loop;
174 reader->Initialize(file_path, 175 reader->Initialize(file_path,
175 net::HttpByteRange(), 176 net::HttpByteRange(),
176 google_apis::test_util::CreateQuitCallback( 177 google_apis::test_util::CreateQuitCallback(
177 &run_loop, 178 &run_loop,
178 google_apis::test_util::CreateCopyResultCallback( 179 google_apis::test_util::CreateCopyResultCallback(
179 &error, &entry))); 180 &error, &entry)));
180 run_loop.Run(); 181 run_loop.Run();
181 } 182 }
182 if (error != net::OK || !entry) 183 if (error != net::OK || !entry)
183 return false; 184 return false;
184 185
185 // Read data from the reader. 186 // Read data from the reader.
186 std::string content; 187 std::string content;
187 if (drive::test_util::ReadAllData(reader.get(), &content) != net::OK) 188 if (drive::test_util::ReadAllData(reader.get(), &content) != net::OK)
188 return false; 189 return false;
189 190
190 if (static_cast<size_t>(entry->file_info().size()) != content.size()) 191 if (static_cast<size_t>(entry->file_info().size()) != content.size())
191 return false; 192 return false;
192 193
193 *out_content = content; 194 *out_content = content;
194 return true; 195 return true;
195 } 196 }
196 197
197 scoped_ptr<net::URLRequestContext> url_request_context_; 198 std::unique_ptr<net::URLRequestContext> url_request_context_;
198 scoped_ptr<TestDelegate> test_delegate_; 199 std::unique_ptr<TestDelegate> test_delegate_;
199 200
200 private: 201 private:
201 // Create the drive integration service for the |profile| 202 // Create the drive integration service for the |profile|
202 drive::DriveIntegrationService* CreateDriveIntegrationService( 203 drive::DriveIntegrationService* CreateDriveIntegrationService(
203 Profile* profile) { 204 Profile* profile) {
204 drive::FakeDriveService* const drive_service = new drive::FakeDriveService; 205 drive::FakeDriveService* const drive_service = new drive::FakeDriveService;
205 if (!drive::test_util::SetUpTestEntries(drive_service)) 206 if (!drive::test_util::SetUpTestEntries(drive_service))
206 return NULL; 207 return NULL;
207 208
208 const std::string& drive_mount_name = 209 const std::string& drive_mount_name =
(...skipping 13 matching lines...) Expand all
222 drive_mount_name, 223 drive_mount_name,
223 drive_cache_dir_.path(), 224 drive_cache_dir_.path(),
224 fake_file_system_); 225 fake_file_system_);
225 } 226 }
226 227
227 drive::FileSystemInterface* GetFileSystem() { return fake_file_system_; } 228 drive::FileSystemInterface* GetFileSystem() { return fake_file_system_; }
228 229
229 content::TestBrowserThreadBundle thread_bundle_; 230 content::TestBrowserThreadBundle thread_bundle_;
230 drive::DriveIntegrationServiceFactory::FactoryCallback 231 drive::DriveIntegrationServiceFactory::FactoryCallback
231 integration_service_factory_callback_; 232 integration_service_factory_callback_;
232 scoped_ptr<drive::DriveIntegrationServiceFactory::ScopedFactoryForTest> 233 std::unique_ptr<drive::DriveIntegrationServiceFactory::ScopedFactoryForTest>
233 integration_service_factory_scope_; 234 integration_service_factory_scope_;
234 scoped_ptr<drive::DriveIntegrationService> integration_service_; 235 std::unique_ptr<drive::DriveIntegrationService> integration_service_;
235 drive::test_util::FakeFileSystem* fake_file_system_; 236 drive::test_util::FakeFileSystem* fake_file_system_;
236 237
237 scoped_ptr<net::TestNetworkDelegate> test_network_delegate_; 238 std::unique_ptr<net::TestNetworkDelegate> test_network_delegate_;
238 scoped_ptr<TestURLRequestJobFactory> test_url_request_job_factory_; 239 std::unique_ptr<TestURLRequestJobFactory> test_url_request_job_factory_;
239 240
240 scoped_ptr<TestingProfileManager> profile_manager_; 241 std::unique_ptr<TestingProfileManager> profile_manager_;
241 base::ScopedTempDir drive_cache_dir_; 242 base::ScopedTempDir drive_cache_dir_;
242 scoped_refptr<storage::FileSystemContext> file_system_context_; 243 scoped_refptr<storage::FileSystemContext> file_system_context_;
243 }; 244 };
244 245
245 TEST_F(ExternalFileURLRequestJobTest, NonGetMethod) { 246 TEST_F(ExternalFileURLRequestJobTest, NonGetMethod) {
246 scoped_ptr<net::URLRequest> request(url_request_context_->CreateRequest( 247 std::unique_ptr<net::URLRequest> request(url_request_context_->CreateRequest(
247 GURL("externalfile:drive-test-user-hash/root/File 1.txt"), 248 GURL("externalfile:drive-test-user-hash/root/File 1.txt"),
248 net::DEFAULT_PRIORITY, test_delegate_.get())); 249 net::DEFAULT_PRIORITY, test_delegate_.get()));
249 request->set_method("POST"); // Set non "GET" method. 250 request->set_method("POST"); // Set non "GET" method.
250 request->Start(); 251 request->Start();
251 252
252 base::RunLoop().Run(); 253 base::RunLoop().Run();
253 254
254 EXPECT_EQ(net::URLRequestStatus::FAILED, request->status().status()); 255 EXPECT_EQ(net::URLRequestStatus::FAILED, request->status().status());
255 EXPECT_EQ(net::ERR_METHOD_NOT_SUPPORTED, request->status().error()); 256 EXPECT_EQ(net::ERR_METHOD_NOT_SUPPORTED, request->status().error());
256 } 257 }
257 258
258 TEST_F(ExternalFileURLRequestJobTest, RegularFile) { 259 TEST_F(ExternalFileURLRequestJobTest, RegularFile) {
259 const GURL kTestUrl("externalfile:drive-test-user-hash/root/File 1.txt"); 260 const GURL kTestUrl("externalfile:drive-test-user-hash/root/File 1.txt");
260 const base::FilePath kTestFilePath("drive/root/File 1.txt"); 261 const base::FilePath kTestFilePath("drive/root/File 1.txt");
261 262
262 // For the first time, the file should be fetched from the server. 263 // For the first time, the file should be fetched from the server.
263 { 264 {
264 scoped_ptr<net::URLRequest> request(url_request_context_->CreateRequest( 265 std::unique_ptr<net::URLRequest> request(
265 kTestUrl, net::DEFAULT_PRIORITY, test_delegate_.get())); 266 url_request_context_->CreateRequest(kTestUrl, net::DEFAULT_PRIORITY,
267 test_delegate_.get()));
266 request->Start(); 268 request->Start();
267 269
268 base::RunLoop().Run(); 270 base::RunLoop().Run();
269 271
270 EXPECT_EQ(net::URLRequestStatus::SUCCESS, request->status().status()); 272 EXPECT_EQ(net::URLRequestStatus::SUCCESS, request->status().status());
271 // It looks weird, but the mime type for the "File 1.txt" is "audio/mpeg" 273 // It looks weird, but the mime type for the "File 1.txt" is "audio/mpeg"
272 // on the server. 274 // on the server.
273 std::string mime_type; 275 std::string mime_type;
274 request->GetMimeType(&mime_type); 276 request->GetMimeType(&mime_type);
275 EXPECT_EQ("audio/mpeg", mime_type); 277 EXPECT_EQ("audio/mpeg", mime_type);
276 278
277 // Reading file must be done after |request| runs, otherwise 279 // Reading file must be done after |request| runs, otherwise
278 // it'll create a local cache file, and we cannot test correctly. 280 // it'll create a local cache file, and we cannot test correctly.
279 std::string expected_data; 281 std::string expected_data;
280 ASSERT_TRUE(ReadDriveFileSync(kTestFilePath, &expected_data)); 282 ASSERT_TRUE(ReadDriveFileSync(kTestFilePath, &expected_data));
281 EXPECT_EQ(expected_data, test_delegate_->data_received()); 283 EXPECT_EQ(expected_data, test_delegate_->data_received());
282 } 284 }
283 285
284 // For the second time, the locally cached file should be used. 286 // For the second time, the locally cached file should be used.
285 // The caching emulation is done by FakeFileSystem. 287 // The caching emulation is done by FakeFileSystem.
286 { 288 {
287 test_delegate_.reset(new TestDelegate); 289 test_delegate_.reset(new TestDelegate);
288 scoped_ptr<net::URLRequest> request(url_request_context_->CreateRequest( 290 std::unique_ptr<net::URLRequest> request(
289 GURL("externalfile:drive-test-user-hash/root/File 1.txt"), 291 url_request_context_->CreateRequest(
290 net::DEFAULT_PRIORITY, test_delegate_.get())); 292 GURL("externalfile:drive-test-user-hash/root/File 1.txt"),
293 net::DEFAULT_PRIORITY, test_delegate_.get()));
291 request->Start(); 294 request->Start();
292 295
293 base::RunLoop().Run(); 296 base::RunLoop().Run();
294 297
295 EXPECT_EQ(net::URLRequestStatus::SUCCESS, request->status().status()); 298 EXPECT_EQ(net::URLRequestStatus::SUCCESS, request->status().status());
296 std::string mime_type; 299 std::string mime_type;
297 request->GetMimeType(&mime_type); 300 request->GetMimeType(&mime_type);
298 EXPECT_EQ("audio/mpeg", mime_type); 301 EXPECT_EQ("audio/mpeg", mime_type);
299 302
300 std::string expected_data; 303 std::string expected_data;
301 ASSERT_TRUE(ReadDriveFileSync(kTestFilePath, &expected_data)); 304 ASSERT_TRUE(ReadDriveFileSync(kTestFilePath, &expected_data));
302 EXPECT_EQ(expected_data, test_delegate_->data_received()); 305 EXPECT_EQ(expected_data, test_delegate_->data_received());
303 } 306 }
304 } 307 }
305 308
306 TEST_F(ExternalFileURLRequestJobTest, HostedDocument) { 309 TEST_F(ExternalFileURLRequestJobTest, HostedDocument) {
307 // Open a gdoc file. 310 // Open a gdoc file.
308 test_delegate_->set_quit_on_redirect(true); 311 test_delegate_->set_quit_on_redirect(true);
309 scoped_ptr<net::URLRequest> request(url_request_context_->CreateRequest( 312 std::unique_ptr<net::URLRequest> request(url_request_context_->CreateRequest(
310 GURL( 313 GURL("externalfile:drive-test-user-hash/root/Document 1 "
311 "externalfile:drive-test-user-hash/root/Document 1 " 314 "excludeDir-test.gdoc"),
312 "excludeDir-test.gdoc"),
313 net::DEFAULT_PRIORITY, test_delegate_.get())); 315 net::DEFAULT_PRIORITY, test_delegate_.get()));
314 request->Start(); 316 request->Start();
315 317
316 base::RunLoop().Run(); 318 base::RunLoop().Run();
317 319
318 EXPECT_EQ(net::URLRequestStatus::SUCCESS, request->status().status()); 320 EXPECT_EQ(net::URLRequestStatus::SUCCESS, request->status().status());
319 // Make sure that a hosted document triggers redirection. 321 // Make sure that a hosted document triggers redirection.
320 EXPECT_TRUE(request->is_redirecting()); 322 EXPECT_TRUE(request->is_redirecting());
321 EXPECT_TRUE(test_delegate_->redirect_url().is_valid()); 323 EXPECT_TRUE(test_delegate_->redirect_url().is_valid());
322 } 324 }
323 325
324 TEST_F(ExternalFileURLRequestJobTest, RootDirectory) { 326 TEST_F(ExternalFileURLRequestJobTest, RootDirectory) {
325 scoped_ptr<net::URLRequest> request(url_request_context_->CreateRequest( 327 std::unique_ptr<net::URLRequest> request(url_request_context_->CreateRequest(
326 GURL("externalfile:drive-test-user-hash/root"), net::DEFAULT_PRIORITY, 328 GURL("externalfile:drive-test-user-hash/root"), net::DEFAULT_PRIORITY,
327 test_delegate_.get())); 329 test_delegate_.get()));
328 request->Start(); 330 request->Start();
329 331
330 base::RunLoop().Run(); 332 base::RunLoop().Run();
331 333
332 EXPECT_EQ(net::URLRequestStatus::FAILED, request->status().status()); 334 EXPECT_EQ(net::URLRequestStatus::FAILED, request->status().status());
333 EXPECT_EQ(net::ERR_FAILED, request->status().error()); 335 EXPECT_EQ(net::ERR_FAILED, request->status().error());
334 } 336 }
335 337
336 TEST_F(ExternalFileURLRequestJobTest, Directory) { 338 TEST_F(ExternalFileURLRequestJobTest, Directory) {
337 scoped_ptr<net::URLRequest> request(url_request_context_->CreateRequest( 339 std::unique_ptr<net::URLRequest> request(url_request_context_->CreateRequest(
338 GURL("externalfile:drive-test-user-hash/root/Directory 1"), 340 GURL("externalfile:drive-test-user-hash/root/Directory 1"),
339 net::DEFAULT_PRIORITY, test_delegate_.get())); 341 net::DEFAULT_PRIORITY, test_delegate_.get()));
340 request->Start(); 342 request->Start();
341 343
342 base::RunLoop().Run(); 344 base::RunLoop().Run();
343 345
344 EXPECT_EQ(net::URLRequestStatus::FAILED, request->status().status()); 346 EXPECT_EQ(net::URLRequestStatus::FAILED, request->status().status());
345 EXPECT_EQ(net::ERR_FAILED, request->status().error()); 347 EXPECT_EQ(net::ERR_FAILED, request->status().error());
346 } 348 }
347 349
348 TEST_F(ExternalFileURLRequestJobTest, NonExistingFile) { 350 TEST_F(ExternalFileURLRequestJobTest, NonExistingFile) {
349 scoped_ptr<net::URLRequest> request(url_request_context_->CreateRequest( 351 std::unique_ptr<net::URLRequest> request(url_request_context_->CreateRequest(
350 GURL("externalfile:drive-test-user-hash/root/non-existing-file.txt"), 352 GURL("externalfile:drive-test-user-hash/root/non-existing-file.txt"),
351 net::DEFAULT_PRIORITY, test_delegate_.get())); 353 net::DEFAULT_PRIORITY, test_delegate_.get()));
352 request->Start(); 354 request->Start();
353 355
354 base::RunLoop().Run(); 356 base::RunLoop().Run();
355 357
356 EXPECT_EQ(net::URLRequestStatus::FAILED, request->status().status()); 358 EXPECT_EQ(net::URLRequestStatus::FAILED, request->status().status());
357 EXPECT_EQ(net::ERR_FILE_NOT_FOUND, request->status().error()); 359 EXPECT_EQ(net::ERR_FILE_NOT_FOUND, request->status().error());
358 } 360 }
359 361
360 TEST_F(ExternalFileURLRequestJobTest, WrongFormat) { 362 TEST_F(ExternalFileURLRequestJobTest, WrongFormat) {
361 scoped_ptr<net::URLRequest> request(url_request_context_->CreateRequest( 363 std::unique_ptr<net::URLRequest> request(url_request_context_->CreateRequest(
362 GURL("externalfile:"), net::DEFAULT_PRIORITY, test_delegate_.get())); 364 GURL("externalfile:"), net::DEFAULT_PRIORITY, test_delegate_.get()));
363 request->Start(); 365 request->Start();
364 366
365 base::RunLoop().Run(); 367 base::RunLoop().Run();
366 368
367 EXPECT_EQ(net::URLRequestStatus::FAILED, request->status().status()); 369 EXPECT_EQ(net::URLRequestStatus::FAILED, request->status().status());
368 EXPECT_EQ(net::ERR_INVALID_URL, request->status().error()); 370 EXPECT_EQ(net::ERR_INVALID_URL, request->status().error());
369 } 371 }
370 372
371 TEST_F(ExternalFileURLRequestJobTest, Cancel) { 373 TEST_F(ExternalFileURLRequestJobTest, Cancel) {
372 scoped_ptr<net::URLRequest> request(url_request_context_->CreateRequest( 374 std::unique_ptr<net::URLRequest> request(url_request_context_->CreateRequest(
373 GURL("externalfile:drive-test-user-hash/root/File 1.txt"), 375 GURL("externalfile:drive-test-user-hash/root/File 1.txt"),
374 net::DEFAULT_PRIORITY, test_delegate_.get())); 376 net::DEFAULT_PRIORITY, test_delegate_.get()));
375 377
376 // Start the request, and cancel it immediately after it. 378 // Start the request, and cancel it immediately after it.
377 request->Start(); 379 request->Start();
378 request->Cancel(); 380 request->Cancel();
379 381
380 base::RunLoop().Run(); 382 base::RunLoop().Run();
381 383
382 EXPECT_EQ(net::URLRequestStatus::CANCELED, request->status().status()); 384 EXPECT_EQ(net::URLRequestStatus::CANCELED, request->status().status());
383 } 385 }
384 386
385 TEST_F(ExternalFileURLRequestJobTest, RangeHeader) { 387 TEST_F(ExternalFileURLRequestJobTest, RangeHeader) {
386 const GURL kTestUrl("externalfile:drive-test-user-hash/root/File 1.txt"); 388 const GURL kTestUrl("externalfile:drive-test-user-hash/root/File 1.txt");
387 const base::FilePath kTestFilePath("drive/root/File 1.txt"); 389 const base::FilePath kTestFilePath("drive/root/File 1.txt");
388 390
389 scoped_ptr<net::URLRequest> request(url_request_context_->CreateRequest( 391 std::unique_ptr<net::URLRequest> request(url_request_context_->CreateRequest(
390 kTestUrl, net::DEFAULT_PRIORITY, test_delegate_.get())); 392 kTestUrl, net::DEFAULT_PRIORITY, test_delegate_.get()));
391 393
392 // Set range header. 394 // Set range header.
393 request->SetExtraRequestHeaderByName( 395 request->SetExtraRequestHeaderByName(
394 "Range", "bytes=3-5", false /* overwrite */); 396 "Range", "bytes=3-5", false /* overwrite */);
395 request->Start(); 397 request->Start();
396 398
397 base::RunLoop().Run(); 399 base::RunLoop().Run();
398 400
399 EXPECT_EQ(net::URLRequestStatus::SUCCESS, request->status().status()); 401 EXPECT_EQ(net::URLRequestStatus::SUCCESS, request->status().status());
400 402
401 // Reading file must be done after |request| runs, otherwise 403 // Reading file must be done after |request| runs, otherwise
402 // it'll create a local cache file, and we cannot test correctly. 404 // it'll create a local cache file, and we cannot test correctly.
403 std::string expected_data; 405 std::string expected_data;
404 ASSERT_TRUE(ReadDriveFileSync(kTestFilePath, &expected_data)); 406 ASSERT_TRUE(ReadDriveFileSync(kTestFilePath, &expected_data));
405 EXPECT_EQ(expected_data.substr(3, 3), test_delegate_->data_received()); 407 EXPECT_EQ(expected_data.substr(3, 3), test_delegate_->data_received());
406 } 408 }
407 409
408 TEST_F(ExternalFileURLRequestJobTest, WrongRangeHeader) { 410 TEST_F(ExternalFileURLRequestJobTest, WrongRangeHeader) {
409 const GURL kTestUrl("externalfile:drive-test-user-hash/root/File 1.txt"); 411 const GURL kTestUrl("externalfile:drive-test-user-hash/root/File 1.txt");
410 412
411 scoped_ptr<net::URLRequest> request(url_request_context_->CreateRequest( 413 std::unique_ptr<net::URLRequest> request(url_request_context_->CreateRequest(
412 kTestUrl, net::DEFAULT_PRIORITY, test_delegate_.get())); 414 kTestUrl, net::DEFAULT_PRIORITY, test_delegate_.get()));
413 415
414 // Set range header. 416 // Set range header.
415 request->SetExtraRequestHeaderByName( 417 request->SetExtraRequestHeaderByName(
416 "Range", "Wrong Range Header Value", false /* overwrite */); 418 "Range", "Wrong Range Header Value", false /* overwrite */);
417 request->Start(); 419 request->Start();
418 420
419 base::RunLoop().Run(); 421 base::RunLoop().Run();
420 422
421 EXPECT_EQ(net::URLRequestStatus::FAILED, request->status().status()); 423 EXPECT_EQ(net::URLRequestStatus::FAILED, request->status().status());
422 EXPECT_EQ(net::ERR_REQUEST_RANGE_NOT_SATISFIABLE, request->status().error()); 424 EXPECT_EQ(net::ERR_REQUEST_RANGE_NOT_SATISFIABLE, request->status().error());
423 } 425 }
424 426
425 } // namespace chromeos 427 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698