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

Side by Side Diff: net/disk_cache/backend_unittest.cc

Issue 42309: Avoid valgrinding unit tests that intentionally leak memory,... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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/data/valgrind/net_unittests.gtest.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/path_service.h" 7 #include "base/path_service.h"
8 #include "base/platform_thread.h" 8 #include "base/platform_thread.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "net/base/io_buffer.h" 10 #include "net/base/io_buffer.h"
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 scoped_refptr<net::IOBuffer> buffer2 = new net::IOBuffer(kSize); 349 scoped_refptr<net::IOBuffer> buffer2 = new net::IOBuffer(kSize);
350 memset(buffer2->data(), 0, kSize); 350 memset(buffer2->data(), 0, kSize);
351 EXPECT_EQ(kSize, entry1->ReadData(0, 0, buffer2, kSize, NULL)); 351 EXPECT_EQ(kSize, entry1->ReadData(0, 0, buffer2, kSize, NULL));
352 entry1->Close(); 352 entry1->Close();
353 EXPECT_STREQ(buffer1->data(), buffer2->data()); 353 EXPECT_STREQ(buffer1->data(), buffer2->data());
354 } 354 }
355 355
356 // The same logic of the previous test (ValidEntry), but this time force the 356 // The same logic of the previous test (ValidEntry), but this time force the
357 // entry to be invalid, simulating a crash in the middle. 357 // entry to be invalid, simulating a crash in the middle.
358 // We'll be leaking memory from this test. 358 // We'll be leaking memory from this test.
359 //
360 // This and the other intentionally leaky tests below are excluded from
361 // purify and valgrind runs by naming them in the files
362 // net/data/purify/net_unittests.exe.gtest.txt and
363 // net/data/valgrind/net_unittests.gtest.txt
364 // The scripts tools/{purify,valgrind}/chrome_tests.sh
365 // read those files and pass the appropriate --gtest_filter to net_unittests.
366 //
359 TEST_F(DiskCacheBackendTest, InvalidEntry) { 367 TEST_F(DiskCacheBackendTest, InvalidEntry) {
360 // Use the implementation directly... we need to simulate a crash. 368 // Use the implementation directly... we need to simulate a crash.
361 SetDirectMode(); 369 SetDirectMode();
362 InitCache(); 370 InitCache();
363 371
364 std::string key("Some key"); 372 std::string key("Some key");
365 disk_cache::Entry* entry1; 373 disk_cache::Entry* entry1;
366 ASSERT_TRUE(cache_->CreateEntry(key, &entry1)); 374 ASSERT_TRUE(cache_->CreateEntry(key, &entry1));
367 375
368 const int kSize = 50; 376 const int kSize = 50;
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after
977 TEST_F(DiskCacheBackendTest, DoomAll) { 985 TEST_F(DiskCacheBackendTest, DoomAll) {
978 InitCache(); 986 InitCache();
979 BackendDoomAll(); 987 BackendDoomAll();
980 } 988 }
981 989
982 TEST_F(DiskCacheBackendTest, MemoryOnlyDoomAll) { 990 TEST_F(DiskCacheBackendTest, MemoryOnlyDoomAll) {
983 SetMemoryOnlyMode(); 991 SetMemoryOnlyMode();
984 InitCache(); 992 InitCache();
985 BackendDoomAll(); 993 BackendDoomAll();
986 } 994 }
OLDNEW
« no previous file with comments | « net/data/valgrind/net_unittests.gtest.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698