| 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/files/file_util.h" | 6 #include "base/files/file_util.h" |
| 7 #include "base/metrics/field_trial.h" | 7 #include "base/metrics/field_trial.h" |
| 8 #include "base/port.h" | 8 #include "base/port.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/strings/string_split.h" |
| 10 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
| 11 #include "base/strings/stringprintf.h" | 12 #include "base/strings/stringprintf.h" |
| 12 #include "base/test/mock_entropy_provider.h" | 13 #include "base/test/mock_entropy_provider.h" |
| 13 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" | 14 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" |
| 14 #include "base/thread_task_runner_handle.h" | 15 #include "base/thread_task_runner_handle.h" |
| 15 #include "base/threading/platform_thread.h" | 16 #include "base/threading/platform_thread.h" |
| 16 #include "base/threading/thread_restrictions.h" | 17 #include "base/threading/thread_restrictions.h" |
| 17 #include "net/base/cache_type.h" | 18 #include "net/base/cache_type.h" |
| 18 #include "net/base/io_buffer.h" | 19 #include "net/base/io_buffer.h" |
| 19 #include "net/base/net_errors.h" | 20 #include "net/base/net_errors.h" |
| (...skipping 2723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2743 EXPECT_EQ(0, cache_->GetEntryCount()); | 2744 EXPECT_EQ(0, cache_->GetEntryCount()); |
| 2744 EXPECT_NE(net::OK, OpenEntry("First", &entry2)); | 2745 EXPECT_NE(net::OK, OpenEntry("First", &entry2)); |
| 2745 EXPECT_NE(net::OK, CreateEntry("Something new", &entry2)); | 2746 EXPECT_NE(net::OK, CreateEntry("Something new", &entry2)); |
| 2746 EXPECT_NE(net::OK, DoomEntry("First")); | 2747 EXPECT_NE(net::OK, DoomEntry("First")); |
| 2747 EXPECT_NE(net::OK, DoomAllEntries()); | 2748 EXPECT_NE(net::OK, DoomAllEntries()); |
| 2748 EXPECT_NE(net::OK, DoomEntriesBetween(Time(), Time::Now())); | 2749 EXPECT_NE(net::OK, DoomEntriesBetween(Time(), Time::Now())); |
| 2749 EXPECT_NE(net::OK, DoomEntriesSince(Time())); | 2750 EXPECT_NE(net::OK, DoomEntriesSince(Time())); |
| 2750 iter = CreateIterator(); | 2751 iter = CreateIterator(); |
| 2751 EXPECT_NE(net::OK, iter->OpenNextEntry(&entry2)); | 2752 EXPECT_NE(net::OK, iter->OpenNextEntry(&entry2)); |
| 2752 | 2753 |
| 2753 std::vector<std::pair<std::string, std::string>> stats; | 2754 base::StringPairs stats; |
| 2754 cache_->GetStats(&stats); | 2755 cache_->GetStats(&stats); |
| 2755 EXPECT_TRUE(stats.empty()); | 2756 EXPECT_TRUE(stats.empty()); |
| 2756 cache_->OnExternalCacheHit("First"); | 2757 cache_->OnExternalCacheHit("First"); |
| 2757 } | 2758 } |
| 2758 | 2759 |
| 2759 TEST_F(DiskCacheBackendTest, DisabledAPI) { | 2760 TEST_F(DiskCacheBackendTest, DisabledAPI) { |
| 2760 ASSERT_TRUE(CopyTestCache("bad_rankings2")); | 2761 ASSERT_TRUE(CopyTestCache("bad_rankings2")); |
| 2761 DisableFirstCleanup(); | 2762 DisableFirstCleanup(); |
| 2762 InitCache(); | 2763 InitCache(); |
| 2763 BackendDisabledAPI(); | 2764 BackendDisabledAPI(); |
| (...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3528 // after closing. | 3529 // after closing. |
| 3529 // NOTE: IF THIS TEST IS FLAKY THEN IT IS FAILING. See https://crbug.com/416940 | 3530 // NOTE: IF THIS TEST IS FLAKY THEN IT IS FAILING. See https://crbug.com/416940 |
| 3530 TEST_F(DiskCacheBackendTest, SimpleCacheDeleteQuickly) { | 3531 TEST_F(DiskCacheBackendTest, SimpleCacheDeleteQuickly) { |
| 3531 SetSimpleCacheMode(); | 3532 SetSimpleCacheMode(); |
| 3532 for (int i = 0; i < 100; ++i) { | 3533 for (int i = 0; i < 100; ++i) { |
| 3533 InitCache(); | 3534 InitCache(); |
| 3534 cache_.reset(); | 3535 cache_.reset(); |
| 3535 EXPECT_TRUE(CleanupCacheDir()); | 3536 EXPECT_TRUE(CleanupCacheDir()); |
| 3536 } | 3537 } |
| 3537 } | 3538 } |
| OLD | NEW |