Skip to content

Commit

Permalink
File leak part 1 of 2: temporary user_data_dir.
Browse files Browse the repository at this point in the history
BUG=130501
TEST=browser_tests --gtest_filter=RecordApiTest.*


Review URL: https://chromiumcodereview.appspot.com/10444112

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@139935 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
scr@chromium.org committed Jun 1, 2012
1 parent a9c81f0 commit 3b67cc0
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions chrome/browser/extensions/extension_record_api_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,24 @@ class TestProcessStrategy : public ProcessStrategy {

class RecordApiTest : public InProcessBrowserTest {
public:
RecordApiTest() {}
virtual ~RecordApiTest() {}

// Override to scope known temp directories outside the scope of the running
// browser test.
virtual void SetUp() OVERRIDE {
InProcessBrowserTest::SetUp();
if (!scoped_temp_user_data_dir_.Set(FilePath(kDummyDirName)))
NOTREACHED();
}

// Override to delete temp directories.
virtual void TearDown() OVERRIDE {
if (!scoped_temp_user_data_dir_.Delete())
NOTREACHED();
InProcessBrowserTest::TearDown();
}

// Override SetUpCommandline to specify a dummy user_data_dir, which
// should be replaced. Clear record-mode, playback-mode, visit-urls,
// record-stats, and load-extension.
Expand Down Expand Up @@ -221,6 +239,11 @@ class RecordApiTest : public InProcessBrowserTest {

return true;
}

private:
ScopedTempDir scoped_temp_user_data_dir_;

DISALLOW_COPY_AND_ASSIGN(RecordApiTest);
};


Expand Down

0 comments on commit 3b67cc0

Please sign in to comment.