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

Side by Side Diff: net/disk_cache/entry_unittest.cc

Issue 2807433002: SimpleCache: synchronously reply on reads from idle if data is in memory.
Patch Set: Use the proper limit for the barrier. Created 3 years, 2 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 | « net/disk_cache/disk_cache_perftest.cc ('k') | net/disk_cache/simple/simple_entry_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 (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 553 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 ret = entry->ReadData( 564 ret = entry->ReadData(
565 1, 565 1,
566 30000, 566 30000,
567 buffer2.get(), 567 buffer2.get(),
568 kSize2, 568 kSize2,
569 base::Bind(&CallbackTest::Run, base::Unretained(&callback6))); 569 base::Bind(&CallbackTest::Run, base::Unretained(&callback6)));
570 EXPECT_TRUE(5000 == ret || net::ERR_IO_PENDING == ret); 570 EXPECT_TRUE(5000 == ret || net::ERR_IO_PENDING == ret);
571 if (net::ERR_IO_PENDING == ret) 571 if (net::ERR_IO_PENDING == ret)
572 expected++; 572 expected++;
573 573
574 EXPECT_EQ(0, 574 ret = entry->ReadData(
575 entry->ReadData( 575 1, 35000, buffer2.get(), kSize2,
576 1, 576 base::Bind(&CallbackTest::Run, base::Unretained(&callback7)));
577 35000, 577 EXPECT_TRUE(0 == ret || net::ERR_IO_PENDING == ret);
578 buffer2.get(), 578 if (net::ERR_IO_PENDING == ret)
579 kSize2, 579 expected++;
580 base::Bind(&CallbackTest::Run, base::Unretained(&callback7)))); 580
581 ret = entry->ReadData( 581 ret = entry->ReadData(
582 1, 582 1,
583 0, 583 0,
584 buffer1.get(), 584 buffer1.get(),
585 kSize1, 585 kSize1,
586 base::Bind(&CallbackTest::Run, base::Unretained(&callback8))); 586 base::Bind(&CallbackTest::Run, base::Unretained(&callback8)));
587 EXPECT_TRUE(17000 == ret || net::ERR_IO_PENDING == ret); 587 EXPECT_TRUE(17000 == ret || net::ERR_IO_PENDING == ret);
588 if (net::ERR_IO_PENDING == ret) 588 if (net::ERR_IO_PENDING == ret)
589 expected++; 589 expected++;
590 ret = entry->WriteData( 590 ret = entry->WriteData(
(...skipping 3936 matching lines...) Expand 10 before | Expand all | Expand 10 after
4527 4527
4528 // Stream 0 has CRC, stream 1 doesn't. 4528 // Stream 0 has CRC, stream 1 doesn't.
4529 histogram_tester.ExpectBucketCount("SimpleCache.Http.SyncCheckEOFHasCrc", 4529 histogram_tester.ExpectBucketCount("SimpleCache.Http.SyncCheckEOFHasCrc",
4530 true, 1); 4530 true, 1);
4531 histogram_tester.ExpectBucketCount("SimpleCache.Http.SyncCheckEOFHasCrc", 4531 histogram_tester.ExpectBucketCount("SimpleCache.Http.SyncCheckEOFHasCrc",
4532 false, 1); 4532 false, 1);
4533 // EOF check is recorded even if there is no CRC there. 4533 // EOF check is recorded even if there is no CRC there.
4534 histogram_tester.ExpectUniqueSample("SimpleCache.Http.SyncCheckEOFResult", 4534 histogram_tester.ExpectUniqueSample("SimpleCache.Http.SyncCheckEOFResult",
4535 disk_cache::CHECK_EOF_RESULT_SUCCESS, 2); 4535 disk_cache::CHECK_EOF_RESULT_SUCCESS, 2);
4536 } 4536 }
OLDNEW
« no previous file with comments | « net/disk_cache/disk_cache_perftest.cc ('k') | net/disk_cache/simple/simple_entry_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698