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

Unified Diff: printing/pdf_ps_metafile_linux_unittest.cc

Issue 203062: Linux: print page to file rather than using shared memory to send it to the b... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: style Created 11 years, 3 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 | « printing/pdf_ps_metafile_linux.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: printing/pdf_ps_metafile_linux_unittest.cc
===================================================================
--- printing/pdf_ps_metafile_linux_unittest.cc (revision 26282)
+++ printing/pdf_ps_metafile_linux_unittest.cc (working copy)
@@ -4,15 +4,24 @@
#include "printing/pdf_ps_metafile_linux.h"
+#include <fcntl.h>
#include <string>
#include <vector>
+#include "base/file_descriptor_posix.h"
#include "base/file_util.h"
#include "testing/gtest/include/gtest/gtest.h"
typedef struct _cairo cairo_t;
-TEST(PdfTest, ThreePages) {
+class PdfPsTest : public testing::Test {
+ protected:
+ base::FileDescriptor DevNullFD() {
+ return base::FileDescriptor(open("/dev/null", O_WRONLY), true);
+ }
+};
+
+TEST_F(PdfPsTest, Pdf) {
// Tests in-renderer constructor.
printing::PdfPsMetafile pdf(printing::PdfPsMetafile::PDF);
EXPECT_TRUE(pdf.Init());
@@ -53,10 +62,10 @@
EXPECT_EQ(header.find("%PDF", 0), 0u);
// Tests if we can save data.
- EXPECT_TRUE(pdf.SaveTo(FilePath("/dev/null")));
+ EXPECT_TRUE(pdf.SaveTo(DevNullFD()));
}
-TEST(PsTest, TwoPages) {
+TEST_F(PdfPsTest, Ps) {
// Tests in-renderer constructor.
printing::PdfPsMetafile ps(printing::PdfPsMetafile::PS);
EXPECT_TRUE(ps.Init());
@@ -97,5 +106,5 @@
EXPECT_EQ(header.find("%!PS", 0), 0u);
// Tests if we can save data.
- EXPECT_TRUE(ps.SaveTo(FilePath("/dev/null")));
+ EXPECT_TRUE(ps.SaveTo(DevNullFD()));
}
« no previous file with comments | « printing/pdf_ps_metafile_linux.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698