| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/file_util.h" | 6 #include "base/file_util.h" |
| 7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
| 8 #include "base/platform_thread.h" | 8 #include "base/platform_thread.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "net/base/io_buffer.h" | 10 #include "net/base/io_buffer.h" |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 scoped_refptr<net::IOBuffer> buffer2 = new net::IOBuffer(kSize); | 349 scoped_refptr<net::IOBuffer> buffer2 = new net::IOBuffer(kSize); |
| 350 memset(buffer2->data(), 0, kSize); | 350 memset(buffer2->data(), 0, kSize); |
| 351 EXPECT_EQ(kSize, entry1->ReadData(0, 0, buffer2, kSize, NULL)); | 351 EXPECT_EQ(kSize, entry1->ReadData(0, 0, buffer2, kSize, NULL)); |
| 352 entry1->Close(); | 352 entry1->Close(); |
| 353 EXPECT_STREQ(buffer1->data(), buffer2->data()); | 353 EXPECT_STREQ(buffer1->data(), buffer2->data()); |
| 354 } | 354 } |
| 355 | 355 |
| 356 // The same logic of the previous test (ValidEntry), but this time force the | 356 // The same logic of the previous test (ValidEntry), but this time force the |
| 357 // entry to be invalid, simulating a crash in the middle. | 357 // entry to be invalid, simulating a crash in the middle. |
| 358 // We'll be leaking memory from this test. | 358 // We'll be leaking memory from this test. |
| 359 // |
| 360 // This and the other intentionally leaky tests below are excluded from |
| 361 // purify and valgrind runs by naming them in the files |
| 362 // net/data/purify/net_unittests.exe.gtest.txt and |
| 363 // net/data/valgrind/net_unittests.gtest.txt |
| 364 // The scripts tools/{purify,valgrind}/chrome_tests.sh |
| 365 // read those files and pass the appropriate --gtest_filter to net_unittests. |
| 366 // |
| 359 TEST_F(DiskCacheBackendTest, InvalidEntry) { | 367 TEST_F(DiskCacheBackendTest, InvalidEntry) { |
| 360 // Use the implementation directly... we need to simulate a crash. | 368 // Use the implementation directly... we need to simulate a crash. |
| 361 SetDirectMode(); | 369 SetDirectMode(); |
| 362 InitCache(); | 370 InitCache(); |
| 363 | 371 |
| 364 std::string key("Some key"); | 372 std::string key("Some key"); |
| 365 disk_cache::Entry* entry1; | 373 disk_cache::Entry* entry1; |
| 366 ASSERT_TRUE(cache_->CreateEntry(key, &entry1)); | 374 ASSERT_TRUE(cache_->CreateEntry(key, &entry1)); |
| 367 | 375 |
| 368 const int kSize = 50; | 376 const int kSize = 50; |
| (...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 977 TEST_F(DiskCacheBackendTest, DoomAll) { | 985 TEST_F(DiskCacheBackendTest, DoomAll) { |
| 978 InitCache(); | 986 InitCache(); |
| 979 BackendDoomAll(); | 987 BackendDoomAll(); |
| 980 } | 988 } |
| 981 | 989 |
| 982 TEST_F(DiskCacheBackendTest, MemoryOnlyDoomAll) { | 990 TEST_F(DiskCacheBackendTest, MemoryOnlyDoomAll) { |
| 983 SetMemoryOnlyMode(); | 991 SetMemoryOnlyMode(); |
| 984 InitCache(); | 992 InitCache(); |
| 985 BackendDoomAll(); | 993 BackendDoomAll(); |
| 986 } | 994 } |
| OLD | NEW |