summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorevanm@google.com <evanm@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-29 20:32:31 +0000
committerevanm@google.com <evanm@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-29 20:32:31 +0000
commitfcbaeacfce08303236709e2603e64fc40bdba435 (patch)
tree115a3402a9e71344d4e68e47705c2c09e1520f08
parent250c6a4df01732194e05559918174bcf5fb05f42 (diff)
downloadchromium_src-fcbaeacfce08303236709e2603e64fc40bdba435.zip
chromium_src-fcbaeacfce08303236709e2603e64fc40bdba435.tar.gz
chromium_src-fcbaeacfce08303236709e2603e64fc40bdba435.tar.bz2
Free memory in unit test, so purify doesn't complain.
Review URL: http://codereview.chromium.org/8405 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4163 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/greasemonkey_master.cc3
-rw-r--r--chrome/browser/greasemonkey_master_unittest.cc8
2 files changed, 6 insertions, 5 deletions
diff --git a/chrome/browser/greasemonkey_master.cc b/chrome/browser/greasemonkey_master.cc
index 2648fa0..288b379 100644
--- a/chrome/browser/greasemonkey_master.cc
+++ b/chrome/browser/greasemonkey_master.cc
@@ -164,7 +164,8 @@ GreasemonkeyMaster::GreasemonkeyMaster(MessageLoop* worker_loop,
const FilePath& script_dir)
: user_script_dir_(new FilePath(script_dir)),
dir_watcher_(new DirectoryWatcher),
- worker_loop_(worker_loop) {
+ worker_loop_(worker_loop),
+ pending_scan_(false) {
// Watch our scripts directory for modifications.
bool ok = dir_watcher_->Watch(script_dir, this);
DCHECK(ok);
diff --git a/chrome/browser/greasemonkey_master_unittest.cc b/chrome/browser/greasemonkey_master_unittest.cc
index b3ce12f..0987a6b 100644
--- a/chrome/browser/greasemonkey_master_unittest.cc
+++ b/chrome/browser/greasemonkey_master_unittest.cc
@@ -53,7 +53,7 @@ class GreasemonkeyMasterTest : public testing::Test,
const NotificationDetails& details) {
DCHECK(type == NOTIFY_NEW_USER_SCRIPTS);
- shared_memory_ = Details<SharedMemory>(details).ptr();
+ shared_memory_.reset(Details<SharedMemory>(details).ptr());
if (MessageLoop::current() == &message_loop_)
MessageLoop::current()->Quit();
}
@@ -65,13 +65,13 @@ class GreasemonkeyMasterTest : public testing::Test,
FilePath script_dir_;
// Updated to the script shared memory when we get notified.
- SharedMemory* shared_memory_;
+ scoped_ptr<SharedMemory> shared_memory_;
};
// Test that we *don't* get spurious notifications.
TEST_F(GreasemonkeyMasterTest, NoScripts) {
// Set shared_memory_ to something non-NULL, so we can check it became NULL.
- shared_memory_ = reinterpret_cast<SharedMemory*>(1);
+ shared_memory_.reset(reinterpret_cast<SharedMemory*>(1));
scoped_refptr<GreasemonkeyMaster> master(
new GreasemonkeyMaster(MessageLoop::current(), script_dir_));
@@ -80,7 +80,7 @@ TEST_F(GreasemonkeyMasterTest, NoScripts) {
// There were no scripts in the script dir, so we shouldn't have gotten
// a notification.
- ASSERT_EQ(NULL, shared_memory_);
+ ASSERT_EQ(NULL, shared_memory_.get());
}
// Test that we get notified about new scripts after they're added.