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

Unified Diff: components/printing/test/print_web_view_helper_browsertest.cc

Issue 2458833005: Move printing defines to buildflag system. (Closed)
Patch Set: Merge Created 4 years, 1 month 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
Index: components/printing/test/print_web_view_helper_browsertest.cc
diff --git a/components/printing/test/print_web_view_helper_browsertest.cc b/components/printing/test/print_web_view_helper_browsertest.cc
index 74a68f3f86229214d159cb9864e7ce053250a26c..5ed2d75a7273f10ea3ece2863f9b155f6f2e6b96 100644
--- a/components/printing/test/print_web_view_helper_browsertest.cc
+++ b/components/printing/test/print_web_view_helper_browsertest.cc
@@ -21,6 +21,7 @@
#include "content/public/renderer/render_view.h"
#include "content/public/test/render_view_test.h"
#include "ipc/ipc_listener.h"
+#include "printing/features/features.h"
#include "printing/print_job_constants.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/WebKit/public/platform/WebString.h"
@@ -51,7 +52,7 @@ const char kPrintOnUserAction[] =
" <button id=\"print\" onclick=\"window.print();\">Hello World!</button>"
"</body>";
-#if defined(ENABLE_PRINT_PREVIEW)
+#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
// HTML with 3 pages.
const char kMultipageHTML[] =
"<html><head><style>"
@@ -113,10 +114,10 @@ void CreatePrintSettingsDictionary(base::DictionaryValue* dict) {
dict->SetBoolean(kSettingShouldPrintBackgrounds, false);
dict->SetBoolean(kSettingShouldPrintSelectionOnly, false);
}
-#endif // defined(ENABLE_PRINT_PREVIEW)
+#endif // BUILDFLAG(ENABLE_PRINT_PREVIEW)
#endif // !defined(OS_CHROMEOS)
-#if defined(ENABLE_PRINT_PREVIEW)
+#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
class DidPreviewPageListener : public IPC::Listener {
public:
explicit DidPreviewPageListener(base::RunLoop* run_loop)
@@ -134,7 +135,7 @@ class DidPreviewPageListener : public IPC::Listener {
base::RunLoop* const run_loop_;
DISALLOW_COPY_AND_ASSIGN(DidPreviewPageListener);
};
-#endif // defined(ENABLE_PRINT_PREVIEW)
+#endif // BUILDFLAG(ENABLE_PRINT_PREVIEW)
} // namespace
@@ -191,7 +192,7 @@ class PrintWebViewHelperTestBase : public content::RenderViewTest {
#endif // defined(OS_CHROMEOS)
}
-#if defined(ENABLE_PRINT_PREVIEW)
+#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
// The renderer should be done calculating the number of rendered pages
// according to the specified settings defined in the mock render thread.
// Verify the page count is correct.
@@ -205,7 +206,7 @@ class PrintWebViewHelperTestBase : public content::RenderViewTest {
&post_page_count_param);
EXPECT_EQ(count, std::get<0>(post_page_count_param).page_count);
}
-#endif // defined(ENABLE_PRINT_PREVIEW)
+#endif // BUILDFLAG(ENABLE_PRINT_PREVIEW)
// Verifies whether the pages printed or not.
void VerifyPagesPrinted(bool printed) {
@@ -221,14 +222,14 @@ class PrintWebViewHelperTestBase : public content::RenderViewTest {
}
}
-#if defined(ENABLE_BASIC_PRINTING)
+#if BUILDFLAG(ENABLE_BASIC_PRINTING)
void OnPrintPages() {
PrintWebViewHelper::Get(view_)->OnPrintPages();
ProcessPendingMessages();
}
-#endif // defined(ENABLE_BASIC_PRINTING)
+#endif // BUILDFLAG(ENABLE_BASIC_PRINTING)
-#if defined(ENABLE_PRINT_PREVIEW)
+#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
void VerifyPreviewRequest(bool requested) {
const IPC::Message* print_msg =
render_thread_->sink().GetUniqueMessageMatching(
@@ -247,14 +248,14 @@ class PrintWebViewHelperTestBase : public content::RenderViewTest {
run_loop.Run();
render_thread_->sink().RemoveFilter(&filter);
}
-#endif // defined(ENABLE_PRINT_PREVIEW)
+#endif // BUILDFLAG(ENABLE_PRINT_PREVIEW)
-#if defined(ENABLE_BASIC_PRINTING)
+#if BUILDFLAG(ENABLE_BASIC_PRINTING)
void OnPrintForPrintPreview(const base::DictionaryValue& dict) {
PrintWebViewHelper::Get(view_)->OnPrintForPrintPreview(dict);
ProcessPendingMessages();
}
-#endif // defined(ENABLE_BASIC_PRINTING)
+#endif // BUILDFLAG(ENABLE_BASIC_PRINTING)
// Naked pointer as ownership is with content::RenderViewTest::render_thread_.
PrintMockRenderThread* print_render_thread_;
@@ -283,7 +284,7 @@ class MAYBE_PrintWebViewHelperTest : public PrintWebViewHelperTestBase {
};
// This tests only for platforms without print preview.
-#if !defined(ENABLE_PRINT_PREVIEW)
+#if !BUILDFLAG(ENABLE_PRINT_PREVIEW)
// Tests that the renderer blocks window.print() calls if they occur too
// frequently.
TEST_F(MAYBE_PrintWebViewHelperTest, BlockScriptInitiatedPrinting) {
@@ -354,9 +355,9 @@ TEST_F(MAYBE_PrintWebViewHelperTest, PrintWithJavascript) {
VerifyPageCount(1);
VerifyPagesPrinted(true);
}
-#endif // !defined(ENABLE_PRINT_PREVIEW)
+#endif // !BUILDFLAG(ENABLE_PRINT_PREVIEW)
-#if defined(ENABLE_BASIC_PRINTING)
+#if BUILDFLAG(ENABLE_BASIC_PRINTING)
// Tests that printing pages work and sending and receiving messages through
// that channel all works.
TEST_F(MAYBE_PrintWebViewHelperTest, OnPrintPages) {
@@ -366,9 +367,9 @@ TEST_F(MAYBE_PrintWebViewHelperTest, OnPrintPages) {
VerifyPageCount(1);
VerifyPagesPrinted(true);
}
-#endif // defined(ENABLE_BASIC_PRINTING)
+#endif // BUILDFLAG(ENABLE_BASIC_PRINTING)
-#if defined(OS_MACOSX) && defined(ENABLE_BASIC_PRINTING)
+#if defined(OS_MACOSX) && BUILDFLAG(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
@@ -426,7 +427,7 @@ struct TestPageData {
const wchar_t* file;
};
-#if defined(OS_MACOSX) && defined(ENABLE_BASIC_PRINTING)
+#if defined(OS_MACOSX) && BUILDFLAG(ENABLE_BASIC_PRINTING)
const TestPageData kTestPages[] = {
{
"<html>"
@@ -446,14 +447,14 @@ const TestPageData kTestPages[] = {
600, 780, nullptr, nullptr,
},
};
-#endif // defined(OS_MACOSX) && defined(ENABLE_BASIC_PRINTING)
+#endif // defined(OS_MACOSX) && BUILDFLAG(ENABLE_BASIC_PRINTING)
} // namespace
// TODO(estade): need to port MockPrinter to get this on Linux. This involves
// 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(ENABLE_BASIC_PRINTING)
+#if defined(OS_MACOSX) && BUILDFLAG(ENABLE_BASIC_PRINTING)
TEST_F(MAYBE_PrintWebViewHelperTest, PrintLayoutTest) {
bool baseline = false;
@@ -520,7 +521,7 @@ TEST_F(MAYBE_PrintWebViewHelperTest, PrintLayoutTest) {
#define MAYBE_PrintWebViewHelperPreviewTest PrintWebViewHelperPreviewTest
#endif // defined(OS_ANDROID)
-#if defined(ENABLE_PRINT_PREVIEW)
+#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
class MAYBE_PrintWebViewHelperPreviewTest : public PrintWebViewHelperTestBase {
public:
MAYBE_PrintWebViewHelperPreviewTest() {}
@@ -947,7 +948,7 @@ TEST_F(MAYBE_PrintWebViewHelperPreviewTest, OnPrintPreviewCancel) {
VerifyPagesPrinted(false);
}
-#if defined(ENABLE_BASIC_PRINTING)
+#if BUILDFLAG(ENABLE_BASIC_PRINTING)
// Tests that printing from print preview works and sending and receiving
// messages through that channel all works.
TEST_F(MAYBE_PrintWebViewHelperPreviewTest, OnPrintForPrintPreview) {
@@ -973,7 +974,7 @@ TEST_F(MAYBE_PrintWebViewHelperPreviewTest, OnPrintForPrintPreviewFail) {
VerifyPagesPrinted(false);
}
-#endif // defined(ENABLE_BASIC_PRINTING)
+#endif // BUILDFLAG(ENABLE_BASIC_PRINTING)
// Tests that when default printer has invalid printer settings, print preview
// receives error message.
@@ -1038,7 +1039,7 @@ TEST_F(MAYBE_PrintWebViewHelperPreviewTest,
VerifyPrintPreviewGenerated(false);
}
-#if defined(ENABLE_BASIC_PRINTING)
+#if BUILDFLAG(ENABLE_BASIC_PRINTING)
TEST_F(MAYBE_PrintWebViewHelperPreviewTest,
OnPrintForPrintPreviewUsingInvalidPrinterSettings) {
LoadHTML(kPrintPreviewHTML);
@@ -1054,8 +1055,8 @@ TEST_F(MAYBE_PrintWebViewHelperPreviewTest,
VerifyPrintFailed(true);
VerifyPagesPrinted(false);
}
-#endif // defined(ENABLE_BASIC_PRINTING)
-#endif // defined(ENABLE_PRINT_PREVIEW)
+#endif // BUILDFLAG(ENABLE_BASIC_PRINTING)
+#endif // BUILDFLAG(ENABLE_PRINT_PREVIEW)
#endif // !defined(OS_CHROMEOS)
« no previous file with comments | « components/printing/test/print_test_content_renderer_client.cc ('k') | components/renderer_context_menu/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698