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

Unified Diff: printing/pdf_ps_metafile_cairo_unittest.cc

Issue 2807027: Added support for vector printing for Pepper v1 plugins for Linux.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Merged Created 10 years, 6 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_cairo.cc ('k') | third_party/npapi/bindings/npapi_extensions.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: printing/pdf_ps_metafile_cairo_unittest.cc
===================================================================
--- printing/pdf_ps_metafile_cairo_unittest.cc (revision 51151)
+++ printing/pdf_ps_metafile_cairo_unittest.cc (working copy)
@@ -10,6 +10,7 @@
#include "base/file_descriptor_posix.h"
#include "base/file_util.h"
+#include "base/string_util.h"
#include "testing/gtest/include/gtest/gtest.h"
typedef struct _cairo cairo_t;
@@ -29,6 +30,7 @@
// Renders page 1.
cairo_t* context = pdf.StartPage(72, 72, 1, 2, 3, 4);
EXPECT_TRUE(context != NULL);
+ EXPECT_EQ(printing::PdfPsMetafile::FromCairoContext(context), &pdf);
// In theory, we should use Cairo to draw something on |context|.
EXPECT_TRUE(pdf.FinishPage());
@@ -63,6 +65,21 @@
// Tests if we can save data.
EXPECT_TRUE(pdf.SaveTo(DevNullFD()));
+
+ // Test overriding the metafile with raw data.
+ printing::PdfPsMetafile pdf3(printing::PdfPsMetafile::PDF);
+ EXPECT_TRUE(pdf3.Init());
+ context = pdf3.StartPage(72, 72, 1, 2, 3, 4);
+ EXPECT_TRUE(context != NULL);
+ std::string test_raw_data = "Dummy PDF";
+ EXPECT_TRUE(pdf3.SetRawData(test_raw_data.c_str(), test_raw_data.size()));
+ EXPECT_TRUE(pdf3.FinishPage());
+ pdf3.Close();
+ size = pdf3.GetDataSize();
+ EXPECT_EQ(test_raw_data.size(), size);
+ std::string output;
+ pdf3.GetData(WriteInto(&output, size + 1), size);
+ EXPECT_EQ(test_raw_data, output);
}
TEST_F(PdfPsTest, Ps) {
@@ -73,6 +90,7 @@
// Renders page 1.
cairo_t* context = ps.StartPage(72, 72, 1, 2, 3, 4);
EXPECT_TRUE(context != NULL);
+ EXPECT_EQ(printing::PdfPsMetafile::FromCairoContext(context), &ps);
// In theory, we should use Cairo to draw something on |context|.
EXPECT_TRUE(ps.FinishPage());
« no previous file with comments | « printing/pdf_ps_metafile_cairo.cc ('k') | third_party/npapi/bindings/npapi_extensions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698