namespace {
+#if !defined(OS_CHROMEOS)
+
// A simple web page.
const char kHelloWorldHTML[] = "<body><p>Hello World!</p></body>";
-#if !defined(OS_CHROMEOS)
-
// A simple webpage with a button to print itself with.
const char kPrintOnUserAction[] =
"<body>"
explicit DidPreviewPageListener(base::RunLoop* run_loop)
: run_loop_(run_loop) {}
- virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE {
+ bool OnMessageReceived(const IPC::Message& message) override {
if (message.type() == PrintHostMsg_MetafileReadyForPrinting::ID ||
message.type() == PrintHostMsg_PrintPreviewFailed::ID ||
message.type() == PrintHostMsg_PrintPreviewCancelled::ID)
class PrintWebViewHelperTestBase : public ChromeRenderViewTest {
public:
PrintWebViewHelperTestBase() {}
- virtual ~PrintWebViewHelperTestBase() {}
+ ~PrintWebViewHelperTestBase() override {}
protected:
void PrintWithJavaScript() {
#endif // defined(OS_CHROMEOS)
}
-#if !defined(DISABLE_BASIC_PRINTING)
+#if defined(ENABLE_BASIC_PRINTING)
void OnPrintPages() {
PrintWebViewHelper::Get(view_)->OnPrintPages();
ProcessPendingMessages();
}
-#endif // !DISABLE_BASIC_PRINTING
+#endif // ENABLE_BASIC_PRINTING
void VerifyPreviewRequest(bool requested) {
const IPC::Message* print_msg =
class PrintWebViewHelperTest : public PrintWebViewHelperTestBase {
public:
PrintWebViewHelperTest() {}
- virtual ~PrintWebViewHelperTest() {}
+ ~PrintWebViewHelperTest() override {}
- virtual void SetUp() OVERRIDE {
- ChromeRenderViewTest::SetUp();
- }
+ void SetUp() override { ChromeRenderViewTest::SetUp(); }
protected:
DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelperTest);
};
// This tests only for platforms without print preview.
-#if !defined(ENABLE_FULL_PRINTING)
+#if !defined(ENABLE_PRINT_PREVIEW)
// Tests that the renderer blocks window.print() calls if they occur too
// frequently.
TEST_F(PrintWebViewHelperTest, BlockScriptInitiatedPrinting) {
VerifyPageCount(1);
VerifyPagesPrinted(true);
}
-#endif // !ENABLE_FULL_PRINTING
+#endif // !ENABLE_PRINT_PREVIEW
-#if !defined(DISABLE_BASIC_PRINTING)
+#if defined(ENABLE_BASIC_PRINTING)
// Tests that printing pages work and sending and receiving messages through
// that channel all works.
TEST_F(PrintWebViewHelperTest, OnPrintPages) {
VerifyPageCount(1);
VerifyPagesPrinted(true);
}
-#endif // !DISABLE_BASIC_PRINTING
+#endif // ENABLE_BASIC_PRINTING
-#if defined(OS_MACOSX) && !defined(DISABLE_BASIC_PRINTING)
+#if defined(OS_MACOSX) && defined(ENABLE_BASIC_PRINTING)
// TODO(estade): I don't think this test is worth porting to Linux. We will have
// to rip out and replace most of the IPC code if we ever plan to improve
// printing, and the comment below by sverrir suggests that it doesn't do much
EXPECT_NE(0, image1.size().width());
EXPECT_NE(0, image1.size().height());
}
-#endif // OS_MACOSX && !DISABLE_BASIC_PRINTING
+#endif // OS_MACOSX && ENABLE_BASIC_PRINTING
// Tests if we can print a page and verify its results.
// This test prints HTML pages into a pseudo printer and check their outputs,
// hooking up Cairo to read a pdf stream, or accessing the cairo surface in the
// metafile directly.
// Same for printing via PDF on Windows.
-#if defined(OS_MACOSX) && !defined(DISABLE_BASIC_PRINTING)
+#if defined(OS_MACOSX) && defined(ENABLE_BASIC_PRINTING)
TEST_F(PrintWebViewHelperTest, PrintLayoutTest) {
bool baseline = false;
}
}
}
-#endif // OS_MACOSX && !DISABLE_BASIC_PRINTING
+#endif // OS_MACOSX && ENABLE_BASIC_PRINTING
// These print preview tests do not work on Chrome OS yet.
#if !defined(OS_CHROMEOS)
class PrintWebViewHelperPreviewTest : public PrintWebViewHelperTestBase {
public:
PrintWebViewHelperPreviewTest() {}
- virtual ~PrintWebViewHelperPreviewTest() {}
+ ~PrintWebViewHelperPreviewTest() override {}
protected:
void VerifyPrintPreviewCancelled(bool did_cancel) {
DISALLOW_COPY_AND_ASSIGN(PrintWebViewHelperPreviewTest);
};
-#if defined(ENABLE_FULL_PRINTING)
+#if defined(ENABLE_PRINT_PREVIEW)
TEST_F(PrintWebViewHelperPreviewTest, BlockScriptInitiatedPrinting) {
LoadHTML(kHelloWorldHTML);
PrintWebViewHelper* print_web_view_helper = PrintWebViewHelper::Get(view_);
VerifyPreviewRequest(true);
}
-#endif // ENABLE_FULL_PRINTING
+#endif // ENABLE_PRINT_PREVIEW
// Tests that print preview work and sending and receiving messages through
// that channel all works.