OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/string_util.h" | 7 #include "base/string_util.h" |
8 #include "base/stringprintf.h" | 8 #include "base/stringprintf.h" |
9 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" | 9 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" |
10 #include "base/threading/platform_thread.h" | 10 #include "base/threading/platform_thread.h" |
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
577 memset(buffer->data(), 0, kSize); | 577 memset(buffer->data(), 0, kSize); |
578 base::strlcpy(buffer->data(), "And the data to save", kSize); | 578 base::strlcpy(buffer->data(), "And the data to save", kSize); |
579 EXPECT_EQ(kSize, WriteData(entry, 0, 0, buffer, kSize, false)); | 579 EXPECT_EQ(kSize, WriteData(entry, 0, 0, buffer, kSize, false)); |
580 SimulateCrash(); | 580 SimulateCrash(); |
581 | 581 |
582 EXPECT_NE(net::OK, OpenEntry(key, &entry)); | 582 EXPECT_NE(net::OK, OpenEntry(key, &entry)); |
583 EXPECT_EQ(0, cache_->GetEntryCount()); | 583 EXPECT_EQ(0, cache_->GetEntryCount()); |
584 } | 584 } |
585 | 585 |
586 // This and the other intentionally leaky tests below are excluded from | 586 // This and the other intentionally leaky tests below are excluded from |
587 // purify and valgrind runs by naming them in the files | 587 // valgrind runs by naming them in the files |
588 // net/data/purify/net_unittests.exe.gtest.txt and | |
589 // net/data/valgrind/net_unittests.gtest.txt | 588 // net/data/valgrind/net_unittests.gtest.txt |
590 // The scripts tools/{purify,valgrind}/chrome_tests.sh | 589 // The scripts tools/valgrind/chrome_tests.sh |
591 // read those files and pass the appropriate --gtest_filter to net_unittests. | 590 // read those files and pass the appropriate --gtest_filter to net_unittests. |
592 TEST_F(DiskCacheBackendTest, InvalidEntry) { | 591 TEST_F(DiskCacheBackendTest, InvalidEntry) { |
593 BackendInvalidEntry(); | 592 BackendInvalidEntry(); |
594 } | 593 } |
595 | 594 |
596 // We'll be leaking memory from this test. | 595 // We'll be leaking memory from this test. |
597 TEST_F(DiskCacheBackendTest, NewEvictionInvalidEntry) { | 596 TEST_F(DiskCacheBackendTest, NewEvictionInvalidEntry) { |
598 SetNewEviction(); | 597 SetNewEviction(); |
599 BackendInvalidEntry(); | 598 BackendInvalidEntry(); |
600 } | 599 } |
(...skipping 1533 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2134 // Ping the oldest entry. | 2133 // Ping the oldest entry. |
2135 cache_->OnExternalCacheHit("key0"); | 2134 cache_->OnExternalCacheHit("key0"); |
2136 | 2135 |
2137 TrimForTest(false); | 2136 TrimForTest(false); |
2138 | 2137 |
2139 // Make sure the older key remains. | 2138 // Make sure the older key remains. |
2140 EXPECT_EQ(1, cache_->GetEntryCount()); | 2139 EXPECT_EQ(1, cache_->GetEntryCount()); |
2141 ASSERT_EQ(net::OK, OpenEntry("key0", &entry)); | 2140 ASSERT_EQ(net::OK, OpenEntry("key0", &entry)); |
2142 entry->Close(); | 2141 entry->Close(); |
2143 } | 2142 } |
OLD | NEW |