diff options
-rw-r--r-- | chrome/browser/cocoa/browser_test_helper.h | 11 | ||||
-rw-r--r-- | chrome/browser/cocoa/cookies_window_controller_unittest.mm | 4 | ||||
-rw-r--r-- | tools/valgrind/memcheck/suppressions_mac.txt | 18 |
3 files changed, 10 insertions, 23 deletions
diff --git a/chrome/browser/cocoa/browser_test_helper.h b/chrome/browser/cocoa/browser_test_helper.h index 77016f1..a264317 100644 --- a/chrome/browser/cocoa/browser_test_helper.h +++ b/chrome/browser/cocoa/browser_test_helper.h @@ -13,6 +13,13 @@ // Base class which contains a valid Browser*. Lots of boilerplate to // recycle between unit test classes. // +// This class creates fake UI, file, and IO threads because many objects that +// are attached to the TestingProfile (and other objects) have traits that limit +// their destruction to certain threads. For example, the URLRequestContext can +// only be deleted on the IO thread; without this fake IO thread, the object +// would never be deleted and would report as a leak under Valgrind. Note that +// these are fake threads and they all share the same MessageLoop. +// // TODO(jrg): move up a level (chrome/browser/cocoa --> // chrome/browser), and use in non-Mac unit tests such as // back_forward_menu_model_unittest.cc, @@ -21,7 +28,8 @@ class BrowserTestHelper { public: BrowserTestHelper() : ui_thread_(ChromeThread::UI, &message_loop_), - file_thread_(ChromeThread::FILE, &message_loop_) { + file_thread_(ChromeThread::FILE, &message_loop_), + io_thread_(ChromeThread::IO, &message_loop_) { profile_.reset(new TestingProfile()); profile_->CreateBookmarkModel(true); profile_->BlockUntilBookmarkModelLoaded(); @@ -72,6 +80,7 @@ class BrowserTestHelper { MessageLoopForUI message_loop_; ChromeThread ui_thread_; ChromeThread file_thread_; + ChromeThread io_thread_; }; #endif // CHROME_BROWSER_COCOA_BROWSER_TEST_HELPER_H_ diff --git a/chrome/browser/cocoa/cookies_window_controller_unittest.mm b/chrome/browser/cocoa/cookies_window_controller_unittest.mm index ea07ff1..b02031f 100644 --- a/chrome/browser/cocoa/cookies_window_controller_unittest.mm +++ b/chrome/browser/cocoa/cookies_window_controller_unittest.mm @@ -51,8 +51,6 @@ namespace { class CookiesWindowControllerTest : public CocoaTest { public: - CookiesWindowControllerTest() - : io_thread_(ChromeThread::IO, MessageLoop::current()) {} virtual void SetUp() { CocoaTest::SetUp(); @@ -84,8 +82,6 @@ class CookiesWindowControllerTest : public CocoaTest { protected: BrowserTestHelper browser_helper_; - // Need an IO thread to not leak from TestingProfile::CreateRequestContext(). - ChromeThread io_thread_; scoped_nsobject<CookiesWindowController> controller_; MockBrowsingDataDatabaseHelper* database_helper_; MockBrowsingDataLocalStorageHelper* local_storage_helper_; diff --git a/tools/valgrind/memcheck/suppressions_mac.txt b/tools/valgrind/memcheck/suppressions_mac.txt index c1463a8..a1380af 100644 --- a/tools/valgrind/memcheck/suppressions_mac.txt +++ b/tools/valgrind/memcheck/suppressions_mac.txt @@ -548,24 +548,6 @@ fun:_ZN13PluginService24FindOrStartPluginProcessERK8FilePath } { - bug_31586a - Memcheck:Leak - fun:_Znw* - ... - fun:_ZN3net13CookieMonster20InternalInsertCookieERKSsPNS0_15CanonicalCookieEb - fun:_ZN3net13CookieMonster18SetCanonicalCookieEP10scoped_ptrINS0_15CanonicalCookieEERKSsRKN4base4TimeERKNS_13CookieOptionsE - fun:_ZN3net13CookieMonster35SetCookieWithCreationTimeAndOptionsERK4GURLRKSsRKN4base4TimeERKNS_13CookieOptionsE - fun:_ZN3net13CookieMonster20SetCookieWithOptionsERK4GURLRKSsRKNS_13CookieOptionsE - fun:_ZN3net11CookieStore9SetCookieERK4GURLRKSs -} -{ - bug_31586b - Memcheck:Leak - fun:_Znw* - fun:_ZN14TestingProfile20CreateRequestContextEv - fun:_ZN12_GLOBAL__N_127CookiesWindowControllerTest5SetUpEv -} -{ bug_31634a Memcheck:Leak fun:malloc_zone_malloc |