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/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/bind.h" | 6 #include "base/bind.h" |
7 #include "base/bind_helpers.h" | 7 #include "base/bind_helpers.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 entry->WriteData( | 385 entry->WriteData( |
386 1, 10000, buffer2.get(), kSize2, net::CompletionCallback(), false)); | 386 1, 10000, buffer2.get(), kSize2, net::CompletionCallback(), false)); |
387 memset(buffer2->data(), 0, kSize2); | 387 memset(buffer2->data(), 0, kSize2); |
388 EXPECT_EQ(24989, | 388 EXPECT_EQ(24989, |
389 entry->ReadData( | 389 entry->ReadData( |
390 1, 10011, buffer2.get(), kSize2, net::CompletionCallback())); | 390 1, 10011, buffer2.get(), kSize2, net::CompletionCallback())); |
391 EXPECT_STREQ("big data goes here", buffer2->data()); | 391 EXPECT_STREQ("big data goes here", buffer2->data()); |
392 EXPECT_EQ( | 392 EXPECT_EQ( |
393 25000, | 393 25000, |
394 entry->ReadData(1, 0, buffer2.get(), kSize2, net::CompletionCallback())); | 394 entry->ReadData(1, 0, buffer2.get(), kSize2, net::CompletionCallback())); |
395 EXPECT_EQ(0, memcmp(buffer2->data(), buffer2->data(), 10000)); | |
396 EXPECT_EQ(5000, | 395 EXPECT_EQ(5000, |
397 entry->ReadData( | 396 entry->ReadData( |
398 1, 30000, buffer2.get(), kSize2, net::CompletionCallback())); | 397 1, 30000, buffer2.get(), kSize2, net::CompletionCallback())); |
399 | 398 |
400 EXPECT_EQ(0, | 399 EXPECT_EQ(0, |
401 entry->ReadData( | 400 entry->ReadData( |
402 1, 35000, buffer2.get(), kSize2, net::CompletionCallback())); | 401 1, 35000, buffer2.get(), kSize2, net::CompletionCallback())); |
403 EXPECT_EQ( | 402 EXPECT_EQ( |
404 17000, | 403 17000, |
405 entry->ReadData(1, 0, buffer1.get(), kSize1, net::CompletionCallback())); | 404 entry->ReadData(1, 0, buffer1.get(), kSize1, net::CompletionCallback())); |
(...skipping 2991 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3397 | 3396 |
3398 // Check that we are not leaking. | 3397 // Check that we are not leaking. |
3399 ASSERT_NE(entry, null); | 3398 ASSERT_NE(entry, null); |
3400 EXPECT_TRUE( | 3399 EXPECT_TRUE( |
3401 static_cast<disk_cache::SimpleEntryImpl*>(entry)->HasOneRef()); | 3400 static_cast<disk_cache::SimpleEntryImpl*>(entry)->HasOneRef()); |
3402 entry->Close(); | 3401 entry->Close(); |
3403 entry = NULL; | 3402 entry = NULL; |
3404 } | 3403 } |
3405 | 3404 |
3406 #endif // defined(OS_POSIX) | 3405 #endif // defined(OS_POSIX) |
OLD | NEW |