OLD | NEW |
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 "base/file_util.h" | 5 #include "base/file_util.h" |
6 #include "base/message_loop.h" | 6 #include "base/message_loop.h" |
7 #include "base/strings/string_number_conversions.h" | 7 #include "base/strings/string_number_conversions.h" |
8 #include "base/test/test_file_util.h" | 8 #include "base/test/test_file_util.h" |
9 #include "content/browser/browser_thread_impl.h" | 9 #include "content/browser/browser_thread_impl.h" |
10 #include "content/browser/byte_stream.h" | 10 #include "content/browser/byte_stream.h" |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 | 333 |
334 const int32 DownloadFileTest::kDummyDownloadId = 23; | 334 const int32 DownloadFileTest::kDummyDownloadId = 23; |
335 const int DownloadFileTest::kDummyChildId = 3; | 335 const int DownloadFileTest::kDummyChildId = 3; |
336 const int DownloadFileTest::kDummyRequestId = 67; | 336 const int DownloadFileTest::kDummyRequestId = 67; |
337 | 337 |
338 // Rename the file before any data is downloaded, after some has, after it all | 338 // Rename the file before any data is downloaded, after some has, after it all |
339 // has, and after it's closed. | 339 // has, and after it's closed. |
340 TEST_F(DownloadFileTest, RenameFileFinal) { | 340 TEST_F(DownloadFileTest, RenameFileFinal) { |
341 ASSERT_TRUE(CreateDownloadFile(0, true)); | 341 ASSERT_TRUE(CreateDownloadFile(0, true)); |
342 base::FilePath initial_path(download_file_->FullPath()); | 342 base::FilePath initial_path(download_file_->FullPath()); |
343 EXPECT_TRUE(file_util::PathExists(initial_path)); | 343 EXPECT_TRUE(base::PathExists(initial_path)); |
344 base::FilePath path_1(initial_path.InsertBeforeExtensionASCII("_1")); | 344 base::FilePath path_1(initial_path.InsertBeforeExtensionASCII("_1")); |
345 base::FilePath path_2(initial_path.InsertBeforeExtensionASCII("_2")); | 345 base::FilePath path_2(initial_path.InsertBeforeExtensionASCII("_2")); |
346 base::FilePath path_3(initial_path.InsertBeforeExtensionASCII("_3")); | 346 base::FilePath path_3(initial_path.InsertBeforeExtensionASCII("_3")); |
347 base::FilePath path_4(initial_path.InsertBeforeExtensionASCII("_4")); | 347 base::FilePath path_4(initial_path.InsertBeforeExtensionASCII("_4")); |
348 base::FilePath path_5(initial_path.InsertBeforeExtensionASCII("_5")); | 348 base::FilePath path_5(initial_path.InsertBeforeExtensionASCII("_5")); |
349 base::FilePath output_path; | 349 base::FilePath output_path; |
350 | 350 |
351 // Rename the file before downloading any data. | 351 // Rename the file before downloading any data. |
352 EXPECT_EQ(DOWNLOAD_INTERRUPT_REASON_NONE, | 352 EXPECT_EQ(DOWNLOAD_INTERRUPT_REASON_NONE, |
353 RenameAndUniquify(path_1, &output_path)); | 353 RenameAndUniquify(path_1, &output_path)); |
354 base::FilePath renamed_path = download_file_->FullPath(); | 354 base::FilePath renamed_path = download_file_->FullPath(); |
355 EXPECT_EQ(path_1, renamed_path); | 355 EXPECT_EQ(path_1, renamed_path); |
356 EXPECT_EQ(path_1, output_path); | 356 EXPECT_EQ(path_1, output_path); |
357 | 357 |
358 // Check the files. | 358 // Check the files. |
359 EXPECT_FALSE(file_util::PathExists(initial_path)); | 359 EXPECT_FALSE(base::PathExists(initial_path)); |
360 EXPECT_TRUE(file_util::PathExists(path_1)); | 360 EXPECT_TRUE(base::PathExists(path_1)); |
361 | 361 |
362 // Download the data. | 362 // Download the data. |
363 const char* chunks1[] = { kTestData1, kTestData2 }; | 363 const char* chunks1[] = { kTestData1, kTestData2 }; |
364 AppendDataToFile(chunks1, 2); | 364 AppendDataToFile(chunks1, 2); |
365 | 365 |
366 // Rename the file after downloading some data. | 366 // Rename the file after downloading some data. |
367 EXPECT_EQ(DOWNLOAD_INTERRUPT_REASON_NONE, | 367 EXPECT_EQ(DOWNLOAD_INTERRUPT_REASON_NONE, |
368 RenameAndUniquify(path_2, &output_path)); | 368 RenameAndUniquify(path_2, &output_path)); |
369 renamed_path = download_file_->FullPath(); | 369 renamed_path = download_file_->FullPath(); |
370 EXPECT_EQ(path_2, renamed_path); | 370 EXPECT_EQ(path_2, renamed_path); |
371 EXPECT_EQ(path_2, output_path); | 371 EXPECT_EQ(path_2, output_path); |
372 | 372 |
373 // Check the files. | 373 // Check the files. |
374 EXPECT_FALSE(file_util::PathExists(path_1)); | 374 EXPECT_FALSE(base::PathExists(path_1)); |
375 EXPECT_TRUE(file_util::PathExists(path_2)); | 375 EXPECT_TRUE(base::PathExists(path_2)); |
376 | 376 |
377 const char* chunks2[] = { kTestData3 }; | 377 const char* chunks2[] = { kTestData3 }; |
378 AppendDataToFile(chunks2, 1); | 378 AppendDataToFile(chunks2, 1); |
379 | 379 |
380 // Rename the file after downloading all the data. | 380 // Rename the file after downloading all the data. |
381 EXPECT_EQ(DOWNLOAD_INTERRUPT_REASON_NONE, | 381 EXPECT_EQ(DOWNLOAD_INTERRUPT_REASON_NONE, |
382 RenameAndUniquify(path_3, &output_path)); | 382 RenameAndUniquify(path_3, &output_path)); |
383 renamed_path = download_file_->FullPath(); | 383 renamed_path = download_file_->FullPath(); |
384 EXPECT_EQ(path_3, renamed_path); | 384 EXPECT_EQ(path_3, renamed_path); |
385 EXPECT_EQ(path_3, output_path); | 385 EXPECT_EQ(path_3, output_path); |
386 | 386 |
387 // Check the files. | 387 // Check the files. |
388 EXPECT_FALSE(file_util::PathExists(path_2)); | 388 EXPECT_FALSE(base::PathExists(path_2)); |
389 EXPECT_TRUE(file_util::PathExists(path_3)); | 389 EXPECT_TRUE(base::PathExists(path_3)); |
390 | 390 |
391 // Should not be able to get the hash until the file is closed. | 391 // Should not be able to get the hash until the file is closed. |
392 std::string hash; | 392 std::string hash; |
393 EXPECT_FALSE(download_file_->GetHash(&hash)); | 393 EXPECT_FALSE(download_file_->GetHash(&hash)); |
394 FinishStream(DOWNLOAD_INTERRUPT_REASON_NONE, true); | 394 FinishStream(DOWNLOAD_INTERRUPT_REASON_NONE, true); |
395 loop_.RunUntilIdle(); | 395 loop_.RunUntilIdle(); |
396 | 396 |
397 // Rename the file after downloading all the data and closing the file. | 397 // Rename the file after downloading all the data and closing the file. |
398 EXPECT_EQ(DOWNLOAD_INTERRUPT_REASON_NONE, | 398 EXPECT_EQ(DOWNLOAD_INTERRUPT_REASON_NONE, |
399 RenameAndUniquify(path_4, &output_path)); | 399 RenameAndUniquify(path_4, &output_path)); |
400 renamed_path = download_file_->FullPath(); | 400 renamed_path = download_file_->FullPath(); |
401 EXPECT_EQ(path_4, renamed_path); | 401 EXPECT_EQ(path_4, renamed_path); |
402 EXPECT_EQ(path_4, output_path); | 402 EXPECT_EQ(path_4, output_path); |
403 | 403 |
404 // Check the files. | 404 // Check the files. |
405 EXPECT_FALSE(file_util::PathExists(path_3)); | 405 EXPECT_FALSE(base::PathExists(path_3)); |
406 EXPECT_TRUE(file_util::PathExists(path_4)); | 406 EXPECT_TRUE(base::PathExists(path_4)); |
407 | 407 |
408 // Check the hash. | 408 // Check the hash. |
409 EXPECT_TRUE(download_file_->GetHash(&hash)); | 409 EXPECT_TRUE(download_file_->GetHash(&hash)); |
410 EXPECT_EQ(kDataHash, base::HexEncode(hash.data(), hash.size())); | 410 EXPECT_EQ(kDataHash, base::HexEncode(hash.data(), hash.size())); |
411 | 411 |
412 // Check that a rename with overwrite to an existing file succeeds. | 412 // Check that a rename with overwrite to an existing file succeeds. |
413 std::string file_contents; | 413 std::string file_contents; |
414 ASSERT_FALSE(file_util::PathExists(path_5)); | 414 ASSERT_FALSE(base::PathExists(path_5)); |
415 static const char file_data[] = "xyzzy"; | 415 static const char file_data[] = "xyzzy"; |
416 ASSERT_EQ(static_cast<int>(sizeof(file_data) - 1), | 416 ASSERT_EQ(static_cast<int>(sizeof(file_data) - 1), |
417 file_util::WriteFile(path_5, file_data, sizeof(file_data) - 1)); | 417 file_util::WriteFile(path_5, file_data, sizeof(file_data) - 1)); |
418 ASSERT_TRUE(file_util::PathExists(path_5)); | 418 ASSERT_TRUE(base::PathExists(path_5)); |
419 EXPECT_TRUE(file_util::ReadFileToString(path_5, &file_contents)); | 419 EXPECT_TRUE(file_util::ReadFileToString(path_5, &file_contents)); |
420 EXPECT_EQ(std::string(file_data), file_contents); | 420 EXPECT_EQ(std::string(file_data), file_contents); |
421 | 421 |
422 EXPECT_EQ(DOWNLOAD_INTERRUPT_REASON_NONE, | 422 EXPECT_EQ(DOWNLOAD_INTERRUPT_REASON_NONE, |
423 RenameAndAnnotate(path_5, &output_path)); | 423 RenameAndAnnotate(path_5, &output_path)); |
424 EXPECT_EQ(path_5, output_path); | 424 EXPECT_EQ(path_5, output_path); |
425 | 425 |
426 file_contents = ""; | 426 file_contents = ""; |
427 EXPECT_TRUE(file_util::ReadFileToString(path_5, &file_contents)); | 427 EXPECT_TRUE(file_util::ReadFileToString(path_5, &file_contents)); |
428 EXPECT_NE(std::string(file_data), file_contents); | 428 EXPECT_NE(std::string(file_data), file_contents); |
429 | 429 |
430 DestroyDownloadFile(0); | 430 DestroyDownloadFile(0); |
431 } | 431 } |
432 | 432 |
433 // Test to make sure the rename uniquifies if we aren't overwriting | 433 // Test to make sure the rename uniquifies if we aren't overwriting |
434 // and there's a file where we're aiming. | 434 // and there's a file where we're aiming. |
435 TEST_F(DownloadFileTest, RenameUniquifies) { | 435 TEST_F(DownloadFileTest, RenameUniquifies) { |
436 ASSERT_TRUE(CreateDownloadFile(0, true)); | 436 ASSERT_TRUE(CreateDownloadFile(0, true)); |
437 base::FilePath initial_path(download_file_->FullPath()); | 437 base::FilePath initial_path(download_file_->FullPath()); |
438 EXPECT_TRUE(file_util::PathExists(initial_path)); | 438 EXPECT_TRUE(base::PathExists(initial_path)); |
439 base::FilePath path_1(initial_path.InsertBeforeExtensionASCII("_1")); | 439 base::FilePath path_1(initial_path.InsertBeforeExtensionASCII("_1")); |
440 base::FilePath path_1_suffixed(path_1.InsertBeforeExtensionASCII(" (1)")); | 440 base::FilePath path_1_suffixed(path_1.InsertBeforeExtensionASCII(" (1)")); |
441 | 441 |
442 ASSERT_FALSE(file_util::PathExists(path_1)); | 442 ASSERT_FALSE(base::PathExists(path_1)); |
443 static const char file_data[] = "xyzzy"; | 443 static const char file_data[] = "xyzzy"; |
444 ASSERT_EQ(static_cast<int>(sizeof(file_data)), | 444 ASSERT_EQ(static_cast<int>(sizeof(file_data)), |
445 file_util::WriteFile(path_1, file_data, sizeof(file_data))); | 445 file_util::WriteFile(path_1, file_data, sizeof(file_data))); |
446 ASSERT_TRUE(file_util::PathExists(path_1)); | 446 ASSERT_TRUE(base::PathExists(path_1)); |
447 | 447 |
448 EXPECT_EQ(DOWNLOAD_INTERRUPT_REASON_NONE, RenameAndUniquify(path_1, NULL)); | 448 EXPECT_EQ(DOWNLOAD_INTERRUPT_REASON_NONE, RenameAndUniquify(path_1, NULL)); |
449 EXPECT_TRUE(file_util::PathExists(path_1_suffixed)); | 449 EXPECT_TRUE(base::PathExists(path_1_suffixed)); |
450 | 450 |
451 FinishStream(DOWNLOAD_INTERRUPT_REASON_NONE, true); | 451 FinishStream(DOWNLOAD_INTERRUPT_REASON_NONE, true); |
452 loop_.RunUntilIdle(); | 452 loop_.RunUntilIdle(); |
453 DestroyDownloadFile(0); | 453 DestroyDownloadFile(0); |
454 } | 454 } |
455 | 455 |
456 // Test to make sure we get the proper error on failure. | 456 // Test to make sure we get the proper error on failure. |
457 TEST_F(DownloadFileTest, RenameError) { | 457 TEST_F(DownloadFileTest, RenameError) { |
458 ASSERT_TRUE(CreateDownloadFile(0, true)); | 458 ASSERT_TRUE(CreateDownloadFile(0, true)); |
459 base::FilePath initial_path(download_file_->FullPath()); | 459 base::FilePath initial_path(download_file_->FullPath()); |
460 | 460 |
461 // Create a subdirectory. | 461 // Create a subdirectory. |
462 base::FilePath tempdir( | 462 base::FilePath tempdir( |
463 initial_path.DirName().Append(FILE_PATH_LITERAL("tempdir"))); | 463 initial_path.DirName().Append(FILE_PATH_LITERAL("tempdir"))); |
464 ASSERT_TRUE(file_util::CreateDirectory(tempdir)); | 464 ASSERT_TRUE(file_util::CreateDirectory(tempdir)); |
465 base::FilePath target_path(tempdir.Append(initial_path.BaseName())); | 465 base::FilePath target_path(tempdir.Append(initial_path.BaseName())); |
466 | 466 |
467 // Targets | 467 // Targets |
468 base::FilePath target_path_suffixed( | 468 base::FilePath target_path_suffixed( |
469 target_path.InsertBeforeExtensionASCII(" (1)")); | 469 target_path.InsertBeforeExtensionASCII(" (1)")); |
470 ASSERT_FALSE(file_util::PathExists(target_path)); | 470 ASSERT_FALSE(base::PathExists(target_path)); |
471 ASSERT_FALSE(file_util::PathExists(target_path_suffixed)); | 471 ASSERT_FALSE(base::PathExists(target_path_suffixed)); |
472 | 472 |
473 // Make the directory unwritable and try to rename within it. | 473 // Make the directory unwritable and try to rename within it. |
474 { | 474 { |
475 file_util::PermissionRestorer restorer(tempdir); | 475 file_util::PermissionRestorer restorer(tempdir); |
476 ASSERT_TRUE(file_util::MakeFileUnwritable(tempdir)); | 476 ASSERT_TRUE(file_util::MakeFileUnwritable(tempdir)); |
477 | 477 |
478 // Expect nulling out of further processing. | 478 // Expect nulling out of further processing. |
479 EXPECT_CALL(*input_stream_, RegisterCallback(IsNullCallback())); | 479 EXPECT_CALL(*input_stream_, RegisterCallback(IsNullCallback())); |
480 EXPECT_EQ(DOWNLOAD_INTERRUPT_REASON_FILE_ACCESS_DENIED, | 480 EXPECT_EQ(DOWNLOAD_INTERRUPT_REASON_FILE_ACCESS_DENIED, |
481 RenameAndAnnotate(target_path, NULL)); | 481 RenameAndAnnotate(target_path, NULL)); |
482 EXPECT_FALSE(file_util::PathExists(target_path_suffixed)); | 482 EXPECT_FALSE(base::PathExists(target_path_suffixed)); |
483 } | 483 } |
484 | 484 |
485 FinishStream(DOWNLOAD_INTERRUPT_REASON_NONE, true); | 485 FinishStream(DOWNLOAD_INTERRUPT_REASON_NONE, true); |
486 loop_.RunUntilIdle(); | 486 loop_.RunUntilIdle(); |
487 DestroyDownloadFile(0); | 487 DestroyDownloadFile(0); |
488 } | 488 } |
489 | 489 |
490 // Various tests of the StreamActive method. | 490 // Various tests of the StreamActive method. |
491 TEST_F(DownloadFileTest, StreamEmptySuccess) { | 491 TEST_F(DownloadFileTest, StreamEmptySuccess) { |
492 ASSERT_TRUE(CreateDownloadFile(0, true)); | 492 ASSERT_TRUE(CreateDownloadFile(0, true)); |
493 base::FilePath initial_path(download_file_->FullPath()); | 493 base::FilePath initial_path(download_file_->FullPath()); |
494 EXPECT_TRUE(file_util::PathExists(initial_path)); | 494 EXPECT_TRUE(base::PathExists(initial_path)); |
495 | 495 |
496 // Test that calling the sink_callback_ on an empty stream shouldn't | 496 // Test that calling the sink_callback_ on an empty stream shouldn't |
497 // do anything. | 497 // do anything. |
498 AppendDataToFile(NULL, 0); | 498 AppendDataToFile(NULL, 0); |
499 | 499 |
500 // Finish the download this way and make sure we see it on the | 500 // Finish the download this way and make sure we see it on the |
501 // observer. | 501 // observer. |
502 EXPECT_CALL(*(observer_.get()), DestinationCompleted(_)); | 502 EXPECT_CALL(*(observer_.get()), DestinationCompleted(_)); |
503 FinishStream(DOWNLOAD_INTERRUPT_REASON_NONE, false); | 503 FinishStream(DOWNLOAD_INTERRUPT_REASON_NONE, false); |
504 loop_.RunUntilIdle(); | 504 loop_.RunUntilIdle(); |
505 | 505 |
506 DestroyDownloadFile(0); | 506 DestroyDownloadFile(0); |
507 } | 507 } |
508 | 508 |
509 TEST_F(DownloadFileTest, StreamEmptyError) { | 509 TEST_F(DownloadFileTest, StreamEmptyError) { |
510 ASSERT_TRUE(CreateDownloadFile(0, true)); | 510 ASSERT_TRUE(CreateDownloadFile(0, true)); |
511 base::FilePath initial_path(download_file_->FullPath()); | 511 base::FilePath initial_path(download_file_->FullPath()); |
512 EXPECT_TRUE(file_util::PathExists(initial_path)); | 512 EXPECT_TRUE(base::PathExists(initial_path)); |
513 | 513 |
514 // Finish the download in error and make sure we see it on the | 514 // Finish the download in error and make sure we see it on the |
515 // observer. | 515 // observer. |
516 EXPECT_CALL(*(observer_.get()), | 516 EXPECT_CALL(*(observer_.get()), |
517 DestinationError( | 517 DestinationError( |
518 DOWNLOAD_INTERRUPT_REASON_NETWORK_DISCONNECTED)) | 518 DOWNLOAD_INTERRUPT_REASON_NETWORK_DISCONNECTED)) |
519 .WillOnce(InvokeWithoutArgs( | 519 .WillOnce(InvokeWithoutArgs( |
520 this, &DownloadFileTest::ConfirmUpdateDownloadInfo)); | 520 this, &DownloadFileTest::ConfirmUpdateDownloadInfo)); |
521 | 521 |
522 // If this next EXPECT_CALL fails flakily, it's probably a real failure. | 522 // If this next EXPECT_CALL fails flakily, it's probably a real failure. |
523 // We'll be getting a stream of UpdateDownload calls from the timer, and | 523 // We'll be getting a stream of UpdateDownload calls from the timer, and |
524 // the last one may have the correct information even if the failure | 524 // the last one may have the correct information even if the failure |
525 // doesn't produce an update, as the timer update may have triggered at the | 525 // doesn't produce an update, as the timer update may have triggered at the |
526 // same time. | 526 // same time. |
527 EXPECT_CALL(*(observer_.get()), CurrentUpdateStatus(0, _, _)); | 527 EXPECT_CALL(*(observer_.get()), CurrentUpdateStatus(0, _, _)); |
528 | 528 |
529 FinishStream(DOWNLOAD_INTERRUPT_REASON_NETWORK_DISCONNECTED, false); | 529 FinishStream(DOWNLOAD_INTERRUPT_REASON_NETWORK_DISCONNECTED, false); |
530 | 530 |
531 loop_.RunUntilIdle(); | 531 loop_.RunUntilIdle(); |
532 | 532 |
533 DestroyDownloadFile(0); | 533 DestroyDownloadFile(0); |
534 } | 534 } |
535 | 535 |
536 TEST_F(DownloadFileTest, StreamNonEmptySuccess) { | 536 TEST_F(DownloadFileTest, StreamNonEmptySuccess) { |
537 ASSERT_TRUE(CreateDownloadFile(0, true)); | 537 ASSERT_TRUE(CreateDownloadFile(0, true)); |
538 base::FilePath initial_path(download_file_->FullPath()); | 538 base::FilePath initial_path(download_file_->FullPath()); |
539 EXPECT_TRUE(file_util::PathExists(initial_path)); | 539 EXPECT_TRUE(base::PathExists(initial_path)); |
540 | 540 |
541 const char* chunks1[] = { kTestData1, kTestData2 }; | 541 const char* chunks1[] = { kTestData1, kTestData2 }; |
542 ::testing::Sequence s1; | 542 ::testing::Sequence s1; |
543 SetupDataAppend(chunks1, 2, s1); | 543 SetupDataAppend(chunks1, 2, s1); |
544 SetupFinishStream(DOWNLOAD_INTERRUPT_REASON_NONE, s1); | 544 SetupFinishStream(DOWNLOAD_INTERRUPT_REASON_NONE, s1); |
545 EXPECT_CALL(*(observer_.get()), DestinationCompleted(_)); | 545 EXPECT_CALL(*(observer_.get()), DestinationCompleted(_)); |
546 sink_callback_.Run(); | 546 sink_callback_.Run(); |
547 VerifyStreamAndSize(); | 547 VerifyStreamAndSize(); |
548 loop_.RunUntilIdle(); | 548 loop_.RunUntilIdle(); |
549 DestroyDownloadFile(0); | 549 DestroyDownloadFile(0); |
550 } | 550 } |
551 | 551 |
552 TEST_F(DownloadFileTest, StreamNonEmptyError) { | 552 TEST_F(DownloadFileTest, StreamNonEmptyError) { |
553 ASSERT_TRUE(CreateDownloadFile(0, true)); | 553 ASSERT_TRUE(CreateDownloadFile(0, true)); |
554 base::FilePath initial_path(download_file_->FullPath()); | 554 base::FilePath initial_path(download_file_->FullPath()); |
555 EXPECT_TRUE(file_util::PathExists(initial_path)); | 555 EXPECT_TRUE(base::PathExists(initial_path)); |
556 | 556 |
557 const char* chunks1[] = { kTestData1, kTestData2 }; | 557 const char* chunks1[] = { kTestData1, kTestData2 }; |
558 ::testing::Sequence s1; | 558 ::testing::Sequence s1; |
559 SetupDataAppend(chunks1, 2, s1); | 559 SetupDataAppend(chunks1, 2, s1); |
560 SetupFinishStream(DOWNLOAD_INTERRUPT_REASON_NETWORK_DISCONNECTED, s1); | 560 SetupFinishStream(DOWNLOAD_INTERRUPT_REASON_NETWORK_DISCONNECTED, s1); |
561 | 561 |
562 EXPECT_CALL(*(observer_.get()), | 562 EXPECT_CALL(*(observer_.get()), |
563 DestinationError( | 563 DestinationError( |
564 DOWNLOAD_INTERRUPT_REASON_NETWORK_DISCONNECTED)) | 564 DOWNLOAD_INTERRUPT_REASON_NETWORK_DISCONNECTED)) |
565 .WillOnce(InvokeWithoutArgs( | 565 .WillOnce(InvokeWithoutArgs( |
(...skipping 30 matching lines...) Expand all Loading... |
596 | 596 |
597 EXPECT_EQ(static_cast<int64>(strlen(kTestData1) + strlen(kTestData2)), | 597 EXPECT_EQ(static_cast<int64>(strlen(kTestData1) + strlen(kTestData2)), |
598 bytes_); | 598 bytes_); |
599 EXPECT_EQ(download_file_->GetHashState(), hash_state_); | 599 EXPECT_EQ(download_file_->GetHashState(), hash_state_); |
600 | 600 |
601 FinishStream(DOWNLOAD_INTERRUPT_REASON_NONE, true); | 601 FinishStream(DOWNLOAD_INTERRUPT_REASON_NONE, true); |
602 DestroyDownloadFile(0); | 602 DestroyDownloadFile(0); |
603 } | 603 } |
604 | 604 |
605 } // namespace content | 605 } // namespace content |
OLD | NEW |