Skip to content

Commit

Permalink
Used ScopedTempDir dir for the FileBackedDC unit test.
Browse files Browse the repository at this point in the history
BUG=None
TEST=Printing unittests.

Review URL: http://codereview.chromium.org/3535011

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62013 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
sanjeevr@chromium.org committed Oct 8, 2010
1 parent 091cb24 commit f21104d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion printing/emf_win_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "base/path_service.h"
#include "base/scoped_handle_win.h"
#include "base/scoped_ptr.h"
#include "base/scoped_temp_dir.h"
#include "printing/printing_context.h"
#include "testing/gtest/include/gtest/gtest.h"

Expand Down Expand Up @@ -162,8 +163,11 @@ TEST(EmfTest, FileBackedDC) {
RECT rect = {100, 100, 200, 200};
HDC hdc = CreateCompatibleDC(NULL);
EXPECT_TRUE(hdc != NULL);
ScopedTempDir scratch_metafile_dir;
ASSERT_TRUE(scratch_metafile_dir.CreateUniqueTempDir());
FilePath metafile_path;
EXPECT_TRUE(file_util::CreateTemporaryFile(&metafile_path));
EXPECT_TRUE(file_util::CreateTemporaryFileInDir(scratch_metafile_dir.path(),
&metafile_path));
EXPECT_TRUE(emf.CreateFileBackedDc(hdc, &rect, metafile_path));
EXPECT_TRUE(emf.hdc() != NULL);
// In theory, you'd use the HDC with GDI functions here.
Expand All @@ -187,5 +191,6 @@ TEST(EmfTest, FileBackedDC) {
RECT output_rect = {0, 0, 10, 10};
EXPECT_TRUE(emf.Playback(hdc, &output_rect));
EXPECT_TRUE(DeleteDC(hdc));
emf.CloseEmf();
}

0 comments on commit f21104d

Please sign in to comment.