diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/disk_cache/backend_unittest.cc | 7 | ||||
-rw-r--r-- | net/disk_cache/entry_unittest.cc | 19 | ||||
-rw-r--r-- | net/disk_cache/mapped_file_unittest.cc | 5 |
3 files changed, 17 insertions, 14 deletions
diff --git a/net/disk_cache/backend_unittest.cc b/net/disk_cache/backend_unittest.cc index 701de4b..6d3dfb3 100644 --- a/net/disk_cache/backend_unittest.cc +++ b/net/disk_cache/backend_unittest.cc @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/basictypes.h" #include "base/file_util.h" #include "base/path_service.h" #include "base/platform_thread.h" @@ -162,17 +163,17 @@ void DiskCacheBackendTest::BackendKeying() { entry2->Close(); char buffer[30]; - base::strlcpy(buffer, kName1, sizeof(buffer)); + base::strlcpy(buffer, kName1, arraysize(buffer)); ASSERT_TRUE(cache_->OpenEntry(buffer, &entry2)); EXPECT_TRUE(entry1 == entry2); entry2->Close(); - base::strlcpy(buffer + 1, kName1, sizeof(buffer) - 1); + base::strlcpy(buffer + 1, kName1, arraysize(buffer) - 1); ASSERT_TRUE(cache_->OpenEntry(buffer + 1, &entry2)); EXPECT_TRUE(entry1 == entry2); entry2->Close(); - base::strlcpy(buffer + 3, kName1, sizeof(buffer) - 3); + base::strlcpy(buffer + 3, kName1, arraysize(buffer) - 3); ASSERT_TRUE(cache_->OpenEntry(buffer + 3, &entry2)); EXPECT_TRUE(entry1 == entry2); entry2->Close(); diff --git a/net/disk_cache/entry_unittest.cc b/net/disk_cache/entry_unittest.cc index abd1008..4a93151 100644 --- a/net/disk_cache/entry_unittest.cc +++ b/net/disk_cache/entry_unittest.cc @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/basictypes.h" #include "base/platform_thread.h" #include "base/timer.h" #include "base/string_util.h" @@ -42,7 +43,7 @@ void DiskCacheEntryTest::InternalSyncIO() { char buffer1[10]; CacheTestFillBuffer(buffer1, sizeof(buffer1), false); EXPECT_EQ(0, entry1->ReadData(0, 0, buffer1, sizeof(buffer1), NULL)); - base::strlcpy(buffer1, "the data", sizeof(buffer1)); + base::strlcpy(buffer1, "the data", arraysize(buffer1)); EXPECT_EQ(10, entry1->WriteData(0, 0, buffer1, sizeof(buffer1), NULL, false)); memset(buffer1, 0, sizeof(buffer1)); EXPECT_EQ(10, entry1->ReadData(0, 0, buffer1, sizeof(buffer1), NULL)); @@ -51,7 +52,7 @@ void DiskCacheEntryTest::InternalSyncIO() { char buffer2[5000]; char buffer3[10000] = {0}; CacheTestFillBuffer(buffer2, sizeof(buffer2), false); - base::strlcpy(buffer2, "The really big data goes here", sizeof(buffer2)); + base::strlcpy(buffer2, "The really big data goes here", arraysize(buffer2)); EXPECT_EQ(5000, entry1->WriteData(1, 1500, buffer2, sizeof(buffer2), NULL, false)); memset(buffer2, 0, sizeof(buffer2)); @@ -117,7 +118,7 @@ void DiskCacheEntryTest::InternalAsyncIO() { CacheTestFillBuffer(buffer3, sizeof(buffer3), false); EXPECT_EQ(0, entry1->ReadData(0, 0, buffer1, sizeof(buffer1), &callback1)); - base::strlcpy(buffer1, "the data", sizeof(buffer1)); + base::strlcpy(buffer1, "the data", arraysize(buffer1)); int expected = 0; int ret = entry1->WriteData(0, 0, buffer1, sizeof(buffer1), &callback2, false); @@ -135,7 +136,7 @@ void DiskCacheEntryTest::InternalAsyncIO() { EXPECT_TRUE(helper.WaitUntilCacheIoFinished(expected)); EXPECT_STREQ("the data", buffer2); - base::strlcpy(buffer2, "The really big data goes here", sizeof(buffer2)); + base::strlcpy(buffer2, "The really big data goes here", arraysize(buffer2)); ret = entry1->WriteData(1, 1500, buffer2, sizeof(buffer2), &callback4, false); EXPECT_TRUE(5000 == ret || net::ERR_IO_PENDING == ret); if (net::ERR_IO_PENDING == ret) @@ -222,14 +223,14 @@ void DiskCacheEntryTest::ExternalSyncIO() { char buffer1[17000], buffer2[25000]; CacheTestFillBuffer(buffer1, sizeof(buffer1), false); CacheTestFillBuffer(buffer2, sizeof(buffer2), false); - base::strlcpy(buffer1, "the data", sizeof(buffer1)); + base::strlcpy(buffer1, "the data", arraysize(buffer1)); EXPECT_EQ(17000, entry1->WriteData(0, 0, buffer1, sizeof(buffer1), NULL, false)); memset(buffer1, 0, sizeof(buffer1)); EXPECT_EQ(17000, entry1->ReadData(0, 0, buffer1, sizeof(buffer1), NULL)); EXPECT_STREQ("the data", buffer1); - base::strlcpy(buffer2, "The really big data goes here", sizeof(buffer2)); + base::strlcpy(buffer2, "The really big data goes here", arraysize(buffer2)); EXPECT_EQ(25000, entry1->WriteData(1, 10000, buffer2, sizeof(buffer2), NULL, false)); memset(buffer2, 0, sizeof(buffer2)); @@ -287,7 +288,7 @@ void DiskCacheEntryTest::ExternalAsyncIO() { CacheTestFillBuffer(buffer1, sizeof(buffer1), false); CacheTestFillBuffer(buffer2, sizeof(buffer2), false); CacheTestFillBuffer(buffer3, sizeof(buffer3), false); - base::strlcpy(buffer1, "the data", sizeof(buffer1)); + base::strlcpy(buffer1, "the data", arraysize(buffer1)); int ret = entry1->WriteData(0, 0, buffer1, sizeof(buffer1), &callback1, false); EXPECT_TRUE(17000 == ret || net::ERR_IO_PENDING == ret); @@ -307,7 +308,7 @@ void DiskCacheEntryTest::ExternalAsyncIO() { EXPECT_TRUE(helper.WaitUntilCacheIoFinished(expected)); EXPECT_STREQ("the data", buffer1); - base::strlcpy(buffer2, "The really big data goes here", sizeof(buffer2)); + base::strlcpy(buffer2, "The really big data goes here", arraysize(buffer2)); ret = entry1->WriteData(1, 10000, buffer2, sizeof(buffer2), &callback3, false); EXPECT_TRUE(25000 == ret || net::ERR_IO_PENDING == ret); @@ -465,7 +466,7 @@ void DiskCacheEntryTest::GrowData() { CacheTestFillBuffer(buffer1, sizeof(buffer1), false); memset(buffer2, 0, sizeof(buffer2)); - base::strlcpy(buffer1, "the data", sizeof(buffer1)); + base::strlcpy(buffer1, "the data", arraysize(buffer1)); EXPECT_EQ(10, entry1->WriteData(0, 0, buffer1, 10, NULL, false)); EXPECT_EQ(10, entry1->ReadData(0, 0, buffer2, 10, NULL)); EXPECT_STREQ("the data", buffer2); diff --git a/net/disk_cache/mapped_file_unittest.cc b/net/disk_cache/mapped_file_unittest.cc index 28eeff5..a9b3754 100644 --- a/net/disk_cache/mapped_file_unittest.cc +++ b/net/disk_cache/mapped_file_unittest.cc @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "base/basictypes.h" #include "base/file_util.h" #include "base/string_util.h" #include "net/disk_cache/disk_cache_test_base.h" @@ -77,7 +78,7 @@ TEST_F(DiskCacheTest, MappedFile_SyncIO) { char buffer1[20]; char buffer2[20]; CacheTestFillBuffer(buffer1, sizeof(buffer1), false); - base::strlcpy(buffer1, "the data", sizeof(buffer1)); + base::strlcpy(buffer1, "the data", arraysize(buffer1)); EXPECT_TRUE(file->Write(buffer1, sizeof(buffer1), 8192)); EXPECT_TRUE(file->Read(buffer2, sizeof(buffer2), 8192)); EXPECT_STREQ(buffer1, buffer2); @@ -100,7 +101,7 @@ TEST_F(DiskCacheTest, MappedFile_AsyncIO) { char buffer1[20]; char buffer2[20]; CacheTestFillBuffer(buffer1, sizeof(buffer1), false); - base::strlcpy(buffer1, "the data", sizeof(buffer1)); + base::strlcpy(buffer1, "the data", arraysize(buffer1)); bool completed; EXPECT_TRUE(file->Write(buffer1, sizeof(buffer1), 1024 * 1024, &callback, &completed)); |