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 <utility> | 5 #include <utility> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/files/file.h" | 9 #include "base/files/file.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
557 ret = entry->ReadData( | 557 ret = entry->ReadData( |
558 1, | 558 1, |
559 30000, | 559 30000, |
560 buffer2.get(), | 560 buffer2.get(), |
561 kSize2, | 561 kSize2, |
562 base::Bind(&CallbackTest::Run, base::Unretained(&callback6))); | 562 base::Bind(&CallbackTest::Run, base::Unretained(&callback6))); |
563 EXPECT_TRUE(5000 == ret || net::ERR_IO_PENDING == ret); | 563 EXPECT_TRUE(5000 == ret || net::ERR_IO_PENDING == ret); |
564 if (net::ERR_IO_PENDING == ret) | 564 if (net::ERR_IO_PENDING == ret) |
565 expected++; | 565 expected++; |
566 | 566 |
567 EXPECT_EQ(0, | 567 ret = entry->ReadData( |
568 entry->ReadData( | 568 1, 35000, buffer2.get(), kSize2, |
569 1, | 569 base::Bind(&CallbackTest::Run, base::Unretained(&callback7))); |
570 35000, | 570 EXPECT_TRUE(0 == ret || net::ERR_IO_PENDING == ret); |
571 buffer2.get(), | 571 if (net::ERR_IO_PENDING == ret) |
572 kSize2, | 572 expected++; |
573 base::Bind(&CallbackTest::Run, base::Unretained(&callback7)))); | 573 |
574 ret = entry->ReadData( | 574 ret = entry->ReadData( |
575 1, | 575 1, |
576 0, | 576 0, |
577 buffer1.get(), | 577 buffer1.get(), |
578 kSize1, | 578 kSize1, |
579 base::Bind(&CallbackTest::Run, base::Unretained(&callback8))); | 579 base::Bind(&CallbackTest::Run, base::Unretained(&callback8))); |
580 EXPECT_TRUE(17000 == ret || net::ERR_IO_PENDING == ret); | 580 EXPECT_TRUE(17000 == ret || net::ERR_IO_PENDING == ret); |
581 if (net::ERR_IO_PENDING == ret) | 581 if (net::ERR_IO_PENDING == ret) |
582 expected++; | 582 expected++; |
583 ret = entry->WriteData( | 583 ret = entry->WriteData( |
(...skipping 3701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4285 entry->Close(); | 4285 entry->Close(); |
4286 | 4286 |
4287 base::RunLoop().RunUntilIdle(); | 4287 base::RunLoop().RunUntilIdle(); |
4288 disk_cache::SimpleBackendImpl::FlushWorkerPoolForTesting(); | 4288 disk_cache::SimpleBackendImpl::FlushWorkerPoolForTesting(); |
4289 base::RunLoop().RunUntilIdle(); | 4289 base::RunLoop().RunUntilIdle(); |
4290 | 4290 |
4291 EXPECT_TRUE( | 4291 EXPECT_TRUE( |
4292 disk_cache::simple_util::CorruptStream0LengthFromEntry(key, cache_path_)); | 4292 disk_cache::simple_util::CorruptStream0LengthFromEntry(key, cache_path_)); |
4293 EXPECT_NE(net::OK, OpenEntry(key, &entry)); | 4293 EXPECT_NE(net::OK, OpenEntry(key, &entry)); |
4294 } | 4294 } |
OLD | NEW |