| 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 <stdint.h> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include "base/files/file_util.h" | 7 #include "base/files/file_util.h" |
| 8 #include "base/metrics/field_trial.h" | 8 #include "base/metrics/field_trial.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_split.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 int rv = cache->Init(cb.callback()); | 57 int rv = cache->Init(cb.callback()); |
| 58 if (cb.GetResult(rv) != net::OK) | 58 if (cb.GetResult(rv) != net::OK) |
| 59 return scoped_ptr<disk_cache::BackendImpl>(); | 59 return scoped_ptr<disk_cache::BackendImpl>(); |
| 60 | 60 |
| 61 disk_cache::Entry* entry = NULL; | 61 disk_cache::Entry* entry = NULL; |
| 62 rv = cache->CreateEntry(kExistingEntryKey, &entry, cb.callback()); | 62 rv = cache->CreateEntry(kExistingEntryKey, &entry, cb.callback()); |
| 63 if (cb.GetResult(rv) != net::OK) | 63 if (cb.GetResult(rv) != net::OK) |
| 64 return scoped_ptr<disk_cache::BackendImpl>(); | 64 return scoped_ptr<disk_cache::BackendImpl>(); |
| 65 entry->Close(); | 65 entry->Close(); |
| 66 | 66 |
| 67 return cache.Pass(); | 67 return cache; |
| 68 } | 68 } |
| 69 | 69 |
| 70 } // namespace | 70 } // namespace |
| 71 | 71 |
| 72 // Tests that can run with different types of caches. | 72 // Tests that can run with different types of caches. |
| 73 class DiskCacheBackendTest : public DiskCacheTestWithCache { | 73 class DiskCacheBackendTest : public DiskCacheTestWithCache { |
| 74 protected: | 74 protected: |
| 75 // Some utility methods: | 75 // Some utility methods: |
| 76 | 76 |
| 77 // Perform IO operations on the cache until there is pending IO. | 77 // Perform IO operations on the cache until there is pending IO. |
| (...skipping 3538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3616 // after closing. | 3616 // after closing. |
| 3617 // NOTE: IF THIS TEST IS FLAKY THEN IT IS FAILING. See https://crbug.com/416940 | 3617 // NOTE: IF THIS TEST IS FLAKY THEN IT IS FAILING. See https://crbug.com/416940 |
| 3618 TEST_F(DiskCacheBackendTest, SimpleCacheDeleteQuickly) { | 3618 TEST_F(DiskCacheBackendTest, SimpleCacheDeleteQuickly) { |
| 3619 SetSimpleCacheMode(); | 3619 SetSimpleCacheMode(); |
| 3620 for (int i = 0; i < 100; ++i) { | 3620 for (int i = 0; i < 100; ++i) { |
| 3621 InitCache(); | 3621 InitCache(); |
| 3622 cache_.reset(); | 3622 cache_.reset(); |
| 3623 EXPECT_TRUE(CleanupCacheDir()); | 3623 EXPECT_TRUE(CleanupCacheDir()); |
| 3624 } | 3624 } |
| 3625 } | 3625 } |
| OLD | NEW |