| 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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 | 199 |
| 200 // Test the private factory methods. | 200 // Test the private factory methods. |
| 201 disk_cache::Backend* cache = NULL; | 201 disk_cache::Backend* cache = NULL; |
| 202 int rv = disk_cache::BackendImpl::CreateBackend( | 202 int rv = disk_cache::BackendImpl::CreateBackend( |
| 203 path, false, 0, net::DISK_CACHE, disk_cache::kNoRandom, | 203 path, false, 0, net::DISK_CACHE, disk_cache::kNoRandom, |
| 204 cache_thread.message_loop_proxy(), NULL, &cache, &cb); | 204 cache_thread.message_loop_proxy(), NULL, &cache, &cb); |
| 205 ASSERT_EQ(net::OK, cb.GetResult(rv)); | 205 ASSERT_EQ(net::OK, cb.GetResult(rv)); |
| 206 ASSERT_TRUE(cache); | 206 ASSERT_TRUE(cache); |
| 207 delete cache; | 207 delete cache; |
| 208 | 208 |
| 209 cache = disk_cache::MemBackendImpl::CreateBackend(0); | 209 cache = disk_cache::MemBackendImpl::CreateBackend(0, NULL); |
| 210 ASSERT_TRUE(cache); | 210 ASSERT_TRUE(cache); |
| 211 delete cache; | 211 delete cache; |
| 212 cache = NULL; | 212 cache = NULL; |
| 213 | 213 |
| 214 // Now test the public API. | 214 // Now test the public API. |
| 215 rv = disk_cache::CreateCacheBackend(net::DISK_CACHE, path, 0, false, | 215 rv = disk_cache::CreateCacheBackend(net::DISK_CACHE, path, 0, false, |
| 216 cache_thread.message_loop_proxy(), | 216 cache_thread.message_loop_proxy(), |
| 217 NULL, &cache, &cb); | 217 NULL, &cache, &cb); |
| 218 ASSERT_EQ(net::OK, cb.GetResult(rv)); | 218 ASSERT_EQ(net::OK, cb.GetResult(rv)); |
| 219 ASSERT_TRUE(cache); | 219 ASSERT_TRUE(cache); |
| (...skipping 1859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2079 char buffer1[kSize]; | 2079 char buffer1[kSize]; |
| 2080 char buffer2[kSize]; | 2080 char buffer2[kSize]; |
| 2081 memset(buffer1, 't', kSize); | 2081 memset(buffer1, 't', kSize); |
| 2082 memset(buffer2, 0, kSize); | 2082 memset(buffer2, 0, kSize); |
| 2083 EXPECT_TRUE(file->Write(buffer1, kSize, 0)); | 2083 EXPECT_TRUE(file->Write(buffer1, kSize, 0)); |
| 2084 EXPECT_TRUE(file->Read(buffer2, kSize, 0)); | 2084 EXPECT_TRUE(file->Read(buffer2, kSize, 0)); |
| 2085 EXPECT_EQ(0, memcmp(buffer1, buffer2, kSize)); | 2085 EXPECT_EQ(0, memcmp(buffer1, buffer2, kSize)); |
| 2086 | 2086 |
| 2087 EXPECT_TRUE(disk_cache::DeleteCacheFile(name)); | 2087 EXPECT_TRUE(disk_cache::DeleteCacheFile(name)); |
| 2088 } | 2088 } |
| OLD | NEW |