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

Unified Diff: chrome/browser/user_style_sheet_watcher_unittest.cc

Issue 6693075: Fix up leak in FilePathWatcherTest and UserStyleSheetTest (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/common/file_path_watcher/file_path_watcher_mac.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/user_style_sheet_watcher_unittest.cc
diff --git a/chrome/browser/user_style_sheet_watcher_unittest.cc b/chrome/browser/user_style_sheet_watcher_unittest.cc
index dd4ad8ab940e986ddb7de73939b53acf386ac3b2..59f52aa7a7dc29b1aed2fda617ba0f254b2035c0 100644
--- a/chrome/browser/user_style_sheet_watcher_unittest.cc
+++ b/chrome/browser/user_style_sheet_watcher_unittest.cc
@@ -25,16 +25,19 @@ TEST(UserStyleSheetWatcherTest, StyleLoad) {
ASSERT_TRUE(file_util::WriteFile(style_sheet_file,
css_file_contents.data(), css_file_contents.length()));
- scoped_refptr<UserStyleSheetWatcher> style_sheet_watcher(
- new UserStyleSheetWatcher(dir.path()));
-
MessageLoop loop(MessageLoop::TYPE_UI);
base::Thread io_thread("UserStyleSheetWatcherTestIOThread");
base::Thread::Options options(MessageLoop::TYPE_IO, 0);
- io_thread.StartWithOptions(options);
+ ASSERT_TRUE(io_thread.StartWithOptions(options));
BrowserThread browser_ui_thread(BrowserThread::UI, &loop);
BrowserThread browser_file_thread(BrowserThread::FILE,
io_thread.message_loop());
+
+ // It is important that the creation of |style_sheet_watcher| occur after the
+ // creation of |browser_ui_thread| because UserStyleSheetWatchers are
+ // restricted to being deleted only on UI browser threads.
+ scoped_refptr<UserStyleSheetWatcher> style_sheet_watcher(
+ new UserStyleSheetWatcher(dir.path()));
style_sheet_watcher->Init();
io_thread.Stop();
« no previous file with comments | « no previous file | content/common/file_path_watcher/file_path_watcher_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698