Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(229)

Side by Side Diff: net/disk_cache/flash/storage_unittest.cc

Issue 182093002: Remove the flash specific disk cache backend. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/disk_cache/flash/storage.cc ('k') | net/net.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "base/files/file_path.h"
6 #include "base/files/scoped_temp_dir.h"
7 #include "net/base/io_buffer.h"
8 #include "net/disk_cache/disk_cache_test_util.h"
9 #include "net/disk_cache/flash/flash_cache_test_base.h"
10 #include "net/disk_cache/flash/storage.h"
11 #include "testing/gtest/include/gtest/gtest.h"
12
13 namespace {
14
15 const int32 kSizes[] = {512, 1024, 4096, 133, 1333, 13333};
16 const int32 kOffsets[] = {0, 1, 3333, 125, 12443, 4431};
17
18 } // namespace
19
20 TEST_F(FlashCacheTest, StorageReadWrite) {
21 disk_cache::Storage storage(path_, kStorageSize);
22 EXPECT_TRUE(storage.Init());
23
24 for (size_t i = 0; i < arraysize(kOffsets); ++i) {
25 int32 size = kSizes[i];
26 int32 offset = kOffsets[i];
27
28 scoped_refptr<net::IOBuffer> write_buffer(new net::IOBuffer(size));
29 scoped_refptr<net::IOBuffer> read_buffer(new net::IOBuffer(size));
30
31 CacheTestFillBuffer(write_buffer->data(), size, false);
32
33 bool rv = storage.Write(write_buffer->data(), size, offset);
34 EXPECT_TRUE(rv);
35
36 rv = storage.Read(read_buffer->data(), size, offset);
37 EXPECT_TRUE(rv);
38
39 EXPECT_EQ(0, memcmp(read_buffer->data(), write_buffer->data(), size));
40 }
41 }
OLDNEW
« no previous file with comments | « net/disk_cache/flash/storage.cc ('k') | net/net.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698