diff options
author | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-21 19:18:05 +0000 |
---|---|---|
committer | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-21 19:18:05 +0000 |
commit | b719142cac87c33ec2d6e99a238b5ecd48f87d68 (patch) | |
tree | cb073e88f553db6c3acab1c18c1f9e31793a80b7 | |
parent | b119a1e6bdd11040f93245e0b71d654a4883b40a (diff) | |
download | chromium_src-b719142cac87c33ec2d6e99a238b5ecd48f87d68.zip chromium_src-b719142cac87c33ec2d6e99a238b5ecd48f87d68.tar.gz chromium_src-b719142cac87c33ec2d6e99a238b5ecd48f87d68.tar.bz2 |
Printing: Implement PrintingContext::UseDefaultSettings for Linux/Cairo.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/3389005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@60087 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/printing/print_job_worker.cc | 18 | ||||
-rw-r--r-- | chrome/browser/printing/print_job_worker.h | 5 | ||||
-rw-r--r-- | chrome/browser/renderer_host/resource_message_filter.cc | 10 | ||||
-rw-r--r-- | chrome/browser/renderer_host/resource_message_filter.h | 4 | ||||
-rw-r--r-- | chrome/common/render_messages_internal.h | 2 | ||||
-rw-r--r-- | chrome/renderer/mock_render_thread.cc | 2 | ||||
-rw-r--r-- | chrome/renderer/print_web_view_helper.cc | 2 | ||||
-rw-r--r-- | chrome/renderer/print_web_view_helper_linux.cc | 36 | ||||
-rw-r--r-- | gfx/native_widget_types.h | 12 | ||||
-rw-r--r-- | printing/print_settings.cc | 41 | ||||
-rw-r--r-- | printing/print_settings.h | 9 | ||||
-rw-r--r-- | printing/printing.gyp | 2 | ||||
-rw-r--r-- | printing/printing_context.h | 15 | ||||
-rw-r--r-- | printing/printing_context_cairo.cc | 29 | ||||
-rw-r--r-- | printing/printing_context_mac.mm | 10 | ||||
-rw-r--r-- | printing/printing_context_win.cc | 12 | ||||
-rw-r--r-- | printing/printing_context_win_unittest.cc | 21 |
17 files changed, 142 insertions, 88 deletions
diff --git a/chrome/browser/printing/print_job_worker.cc b/chrome/browser/printing/print_job_worker.cc index 3a9ae03..dbc9544 100644 --- a/chrome/browser/printing/print_job_worker.cc +++ b/chrome/browser/printing/print_job_worker.cc @@ -85,9 +85,11 @@ void PrintJobWorker::GetSettings(bool ask_user_for_settings, parent_view, document_page_count, has_selection)); #else - PrintingContext::Result result = printing_context_.AskUserForSettings( - parent_view, document_page_count, has_selection); - GetSettingsDone(result); + printing_context_.AskUserForSettings( + parent_view, + document_page_count, + has_selection, + NewCallback(this, &PrintJobWorker::GetSettingsDone)); #endif } else { PrintingContext::Result result = printing_context_.UseDefaultSettings(); @@ -116,8 +118,14 @@ void PrintJobWorker::GetSettingsWithUI(gfx::NativeView parent_view, bool has_selection) { DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); - PrintingContext::Result result = printing_context_.AskUserForSettings( - parent_view, document_page_count, has_selection); + printing_context_.AskUserForSettings( + parent_view, + document_page_count, + has_selection, + NewCallback(this, &PrintJobWorker::GetSettingsWithUIDone)); +} + +void PrintJobWorker::GetSettingsWithUIDone(PrintingContext::Result result) { message_loop()->PostTask(FROM_HERE, NewRunnableMethod( this, &PrintJobWorker::GetSettingsDone, result)); } diff --git a/chrome/browser/printing/print_job_worker.h b/chrome/browser/printing/print_job_worker.h index 0849ccc..f79ca86 100644 --- a/chrome/browser/printing/print_job_worker.h +++ b/chrome/browser/printing/print_job_worker.h @@ -87,6 +87,11 @@ class PrintJobWorker : public base::Thread { void GetSettingsWithUI(gfx::NativeView parent_view, int document_page_count, bool has_selection); + + // The callback used by PrintingContext::GetSettingsWithUI() to notify this + // object that the print settings are set. This is needed in order to bounce + // back into the IO thread for GetSettingsDone(). + void GetSettingsWithUIDone(PrintingContext::Result result); #endif // Reports settings back to owner_. diff --git a/chrome/browser/renderer_host/resource_message_filter.cc b/chrome/browser/renderer_host/resource_message_filter.cc index 4cac19c..2ab1aca 100644 --- a/chrome/browser/renderer_host/resource_message_filter.cc +++ b/chrome/browser/renderer_host/resource_message_filter.cc @@ -159,7 +159,6 @@ class WriteClipboardTask : public Task { void RenderParamsFromPrintSettings(const printing::PrintSettings& settings, ViewMsg_Print_Params* params) { DCHECK(params); -#if defined(OS_WIN) || defined(OS_MACOSX) params->page_size = settings.page_setup_device_units().physical_size(); params->printable_size.SetSize( settings.page_setup_device_units().content_area().width(), @@ -176,9 +175,6 @@ void RenderParamsFromPrintSettings(const printing::PrintSettings& settings, // Always use an invalid cookie. params->document_cookie = 0; params->selection_only = settings.selection_only; -#else - NOTIMPLEMENTED(); -#endif } class ClearCacheCompletion : public net::CompletionCallback { @@ -497,10 +493,8 @@ bool ResourceMessageFilter::OnMessageReceived(const IPC::Message& msg) { IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_ResolveProxy, OnResolveProxy) IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_GetDefaultPrintSettings, OnGetDefaultPrintSettings) -#if defined(OS_WIN) || defined(OS_MACOSX) IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_ScriptedPrint, OnScriptedPrint) -#endif #if defined(OS_MACOSX) IPC_MESSAGE_HANDLER(ViewHostMsg_AllocTransportDIB, OnAllocTransportDIB) @@ -1183,8 +1177,6 @@ void ResourceMessageFilter::OnGetDefaultPrintSettingsReply( } } -#if defined(OS_WIN) || defined(OS_MACOSX) - void ResourceMessageFilter::OnScriptedPrint( const ViewHostMsg_ScriptedPrint_Params& params, IPC::Message* reply_msg) { @@ -1235,8 +1227,6 @@ void ResourceMessageFilter::OnScriptedPrintReply( } } -#endif // OS_WIN || OS_MACOSX - // static Clipboard* ResourceMessageFilter::GetClipboard() { // We have a static instance of the clipboard service for use by all message diff --git a/chrome/browser/renderer_host/resource_message_filter.h b/chrome/browser/renderer_host/resource_message_filter.h index 633d587..3dd76bb 100644 --- a/chrome/browser/renderer_host/resource_message_filter.h +++ b/chrome/browser/renderer_host/resource_message_filter.h @@ -303,7 +303,7 @@ class ResourceMessageFilter : public IPC::ChannelProxy::MessageFilter, void OnGetDefaultPrintSettingsReply( scoped_refptr<printing::PrinterQuery> printer_query, IPC::Message* reply_msg); -#if defined(OS_WIN) || defined(OS_MACOSX) + // A javascript code requested to print the current page. The renderer host // have to show to the user the print dialog and returns the selected print // settings. @@ -313,7 +313,7 @@ class ResourceMessageFilter : public IPC::ChannelProxy::MessageFilter, scoped_refptr<printing::PrinterQuery> printer_query, int routing_id, IPC::Message* reply_msg); -#endif + // Browser side transport DIB allocation void OnAllocTransportDIB(size_t size, bool cache_in_browser, diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h index ed5a914..070123d 100644 --- a/chrome/common/render_messages_internal.h +++ b/chrome/common/render_messages_internal.h @@ -1682,7 +1682,6 @@ IPC_BEGIN_MESSAGES(ViewHost) IPC_SYNC_MESSAGE_ROUTED0_1(ViewHostMsg_GetDefaultPrintSettings, ViewMsg_Print_Params /* default_settings */) -#if defined(OS_WIN) || defined(OS_MACOSX) // It's the renderer that controls the printing process when it is generated // by javascript. This step is about showing UI to the user to select the // final print settings. The output parameter is the same as @@ -1691,7 +1690,6 @@ IPC_BEGIN_MESSAGES(ViewHost) ViewHostMsg_ScriptedPrint_Params, ViewMsg_PrintPages_Params /* settings chosen by the user*/) -#endif // defined(OS_WIN) || defined(OS_MACOSX) // WebKit and JavaScript error messages to log to the console // or debugger UI. diff --git a/chrome/renderer/mock_render_thread.cc b/chrome/renderer/mock_render_thread.cc index 484ba54..359b713 100644 --- a/chrome/renderer/mock_render_thread.cc +++ b/chrome/renderer/mock_render_thread.cc @@ -92,11 +92,11 @@ void MockRenderThread::OnMessageReceived(const IPC::Message& msg) { IPC_MESSAGE_HANDLER(ViewHostMsg_CreateWidget, OnMsgCreateWidget) IPC_MESSAGE_HANDLER(ViewHostMsg_OpenChannelToExtension, OnMsgOpenChannelToExtension) -#if defined(OS_WIN) || defined(OS_MACOSX) IPC_MESSAGE_HANDLER(ViewHostMsg_GetDefaultPrintSettings, OnGetDefaultPrintSettings) IPC_MESSAGE_HANDLER(ViewHostMsg_ScriptedPrint, OnScriptedPrint) +#if defined(OS_WIN) || defined(OS_MACOSX) IPC_MESSAGE_HANDLER(ViewHostMsg_DidGetPrintedPagesCount, OnDidGetPrintedPagesCount) IPC_MESSAGE_HANDLER(ViewHostMsg_DidPrintPage, OnDidPrintPage) diff --git a/chrome/renderer/print_web_view_helper.cc b/chrome/renderer/print_web_view_helper.cc index 3a37e9d..f56ff53 100644 --- a/chrome/renderer/print_web_view_helper.cc +++ b/chrome/renderer/print_web_view_helper.cc @@ -86,7 +86,6 @@ PrintWebViewHelper::PrintWebViewHelper(RenderView* render_view) PrintWebViewHelper::~PrintWebViewHelper() {} -#if defined(OS_MACOSX) || defined(OS_WIN) void PrintWebViewHelper::Print(WebFrame* frame, bool script_initiated) { const int kMinSecondsToIgnoreJavascriptInitiatedPrint = 2; const int kMaxSecondsToIgnoreJavascriptInitiatedPrint = 2 * 60; // 2 Minutes. @@ -224,7 +223,6 @@ void PrintWebViewHelper::Print(WebFrame* frame, bool script_initiated) { // printing resources, since we don't need them anymore. DidFinishPrinting(print_cancelled); } -#endif // OS_MACOSX || OS_WIN void PrintWebViewHelper::DidFinishPrinting(bool success) { if (!success) { diff --git a/chrome/renderer/print_web_view_helper_linux.cc b/chrome/renderer/print_web_view_helper_linux.cc index a616ee43..53e021a 100644 --- a/chrome/renderer/print_web_view_helper_linux.cc +++ b/chrome/renderer/print_web_view_helper_linux.cc @@ -46,42 +46,6 @@ static void FillDefaultPrintParams(ViewMsg_Print_Params* params) { params->desired_dpi = params->dpi; } -void PrintWebViewHelper::Print(WebFrame* frame, bool script_initiated) { - // If still not finished with earlier print request simply ignore. - if (IsPrinting()) - return; - - ViewMsg_Print_Params default_settings; - FillDefaultPrintParams(&default_settings); - double content_width, content_height; - - { - // PrepareFrameAndViewForPrint instance must be destructed before calling - // PrintPages where another instance is created. - PrepareFrameAndViewForPrint prepare(default_settings, - frame, - frame->view()); - GetPageSizeAndMarginsInPoints(frame, 0, default_settings, - &content_width, &content_height, - NULL, NULL, NULL, NULL); - } - - default_settings.dpi = printing::kPointsPerInch; - default_settings.min_shrink = 1.25; - default_settings.max_shrink = 2.0; - default_settings.desired_dpi = printing::kPointsPerInch; - default_settings.document_cookie = 0; - default_settings.selection_only = false; - - default_settings.printable_size = gfx::Size( - static_cast<int>(content_width), static_cast<int>(content_height)); - - ViewMsg_PrintPages_Params print_settings; - print_settings.params = default_settings; - - PrintPages(print_settings, frame); -} - void PrintWebViewHelper::PrintPages(const ViewMsg_PrintPages_Params& params, WebFrame* frame) { PrepareFrameAndViewForPrint prep_frame_view(params.params, diff --git a/gfx/native_widget_types.h b/gfx/native_widget_types.h index 51b0885..729a9e9 100644 --- a/gfx/native_widget_types.h +++ b/gfx/native_widget_types.h @@ -104,20 +104,20 @@ static inline NativeView NativeViewFromId(NativeViewId id) { return reinterpret_cast<NativeView>(id); } #define NativeViewFromIdInBrowser(x) NativeViewFromId(x) -#elif defined(OS_MACOSX) -// On the Mac, a NativeView is a pointer to an object, and is useless outside -// the process in which it was created. NativeViewFromId should only be used -// inside the appropriate platform ifdef outside of the browser. +#elif defined(OS_MACOSX) || defined(USE_X11) +// On Mac and Linux, a NativeView is a pointer to an object, and is useless +// outside the process in which it was created. NativeViewFromId should only be +// used inside the appropriate platform ifdef outside of the browser. // (NativeViewFromIdInBrowser can be used everywhere in the browser.) If your // cross-platform design involves a call to NativeViewFromId from outside the -// browser it will never work on the Mac and is fundamentally broken. +// browser it will never work on Mac or Linux and is fundamentally broken. // Please do not call this from outside the browser. It won't work; the name // should give you a subtle hint. static inline NativeView NativeViewFromIdInBrowser(NativeViewId id) { return reinterpret_cast<NativeView>(id); } -#endif +#endif // defined(OS_MACOSX) || defined(USE_X11) // Convert a NativeView to a NativeViewId. See the comments at the top of // this file. diff --git a/printing/print_settings.cc b/printing/print_settings.cc index bfc7868..98a9ebf 100644 --- a/printing/print_settings.cc +++ b/printing/print_settings.cc @@ -4,9 +4,16 @@ #include "printing/print_settings.h" +// TODO(jhawkins): Move platform-specific implementations to their own files. +#if defined(USE_X11) +#include <gtk/gtk.h> +#endif // defined(USE_X11) + #include "base/atomic_sequence_num.h" #include "base/logging.h" +#include "base/string_piece.h" #include "base/sys_string_conversions.h" +#include "base/utf_string_conversions.h" #include "printing/units.h" namespace printing { @@ -37,7 +44,7 @@ void PrintSettings::Clear() { landscape_ = false; } -#ifdef WIN32 +#if defined(OS_WIN) void PrintSettings::Init(HDC hdc, const DEVMODE& dev_mode, const PageRanges& new_ranges, @@ -119,6 +126,38 @@ void PrintSettings::Init(PMPrinter printer, PMPageFormat page_format, printable_area_device_units, 72); } +#elif defined(OS_LINUX) +void PrintSettings::Init(GtkPrintSettings* settings, + GtkPageSetup* page_setup, + const PageRanges& new_ranges, + bool print_selection_only) { + // TODO(jhawkins): |printer_name_| and |device_name_| should be string16. + base::StringPiece name( + reinterpret_cast<const char*>(gtk_print_settings_get_printer(settings))); + printer_name_ = UTF8ToWide(name); + device_name_ = printer_name_; + ranges = new_ranges; + + GtkPageOrientation orientation = gtk_print_settings_get_orientation(settings); + landscape_ = orientation == GTK_PAGE_ORIENTATION_LANDSCAPE; + selection_only = print_selection_only; + + dpi_ = gtk_print_settings_get_resolution(settings); + + // Initialize page_setup_device_units_. + gfx::Size physical_size_device_units( + gtk_page_setup_get_paper_width(page_setup, GTK_UNIT_INCH) * dpi_, + gtk_page_setup_get_paper_height(page_setup, GTK_UNIT_INCH) * dpi_); + gfx::Rect printable_area_device_units( + gtk_page_setup_get_left_margin(page_setup, GTK_UNIT_INCH) * dpi_, + gtk_page_setup_get_top_margin(page_setup, GTK_UNIT_INCH) * dpi_, + gtk_page_setup_get_page_width(page_setup, GTK_UNIT_INCH) * dpi_, + gtk_page_setup_get_page_height(page_setup, GTK_UNIT_INCH) * dpi_); + + SetPrinterPrintableArea(physical_size_device_units, + printable_area_device_units, + dpi_); +} #endif void PrintSettings::SetPrinterPrintableArea( diff --git a/printing/print_settings.h b/printing/print_settings.h index fc52aeb..bdea485 100644 --- a/printing/print_settings.h +++ b/printing/print_settings.h @@ -16,6 +16,8 @@ typedef struct HDC__* HDC; typedef struct _devicemodeW DEVMODE; +typedef struct _GtkPrintSettings GtkPrintSettings; +typedef struct _GtkPageSetup GtkPageSetup; namespace printing { @@ -39,6 +41,13 @@ class PrintSettings { // Reads the settings from the given PMPrinter and PMPageFormat. void Init(PMPrinter printer, PMPageFormat page_format, const PageRanges& new_ranges, bool print_selection_only); +#elif defined(OS_LINUX) + // Initializes the settings from the given GtkPrintSettings and GtkPageSetup. + // TODO(jhawkins): This method is a mess across the platforms. Refactor. + void Init(GtkPrintSettings* settings, + GtkPageSetup* page_setup, + const PageRanges& new_ranges, + bool print_selection_onl); #endif // Set printer printable area in in device units. diff --git a/printing/printing.gyp b/printing/printing.gyp index 48e31a1..050f830 100644 --- a/printing/printing.gyp +++ b/printing/printing.gyp @@ -76,6 +76,8 @@ 'dependencies': [ # For FT_Init_FreeType and friends. '../build/linux/system.gyp:freetype2', + '../build/linux/system.gyp:gtk', + '../build/linux/system.gyp:gtkprint', ], }], ], diff --git a/printing/printing_context.h b/printing/printing_context.h index eb1b0c7..d5c6b00 100644 --- a/printing/printing_context.h +++ b/printing/printing_context.h @@ -15,6 +15,7 @@ #include <string> #include "base/basictypes.h" +#include "base/callback.h" #if !(defined(OS_WIN) || defined(OS_MACOSX)) // TODO(port) Remove after implementing PrintingContext::context() #include "base/logging.h" @@ -50,10 +51,18 @@ class PrintingContext { PrintingContext(); ~PrintingContext(); + // Callback of AskUserForSettings, used to notify the PrintJobWorker when + // print settings are available. + typedef Callback1<Result>::Type PrintSettingsCallback; + // Asks the user what printer and format should be used to print. Updates the - // context with the select device settings. - Result AskUserForSettings(gfx::NativeView parent_view, int max_pages, - bool has_selection); + // context with the select device settings. The result of the call is returned + // in the callback. This is necessary for Linux, which only has an + // asynchronous printing API. + void AskUserForSettings(gfx::NativeView parent_view, + int max_pages, + bool has_selection, + PrintSettingsCallback* callback); #if defined(OS_WIN) && defined(UNIT_TEST) // Sets a fake PrintDlgEx function pointer in tests. diff --git a/printing/printing_context_cairo.cc b/printing/printing_context_cairo.cc index 78b5235..d82f626 100644 --- a/printing/printing_context_cairo.cc +++ b/printing/printing_context_cairo.cc @@ -4,6 +4,9 @@ #include "printing/printing_context.h" +#include <gtk/gtk.h> +#include <gtk/gtkprintunixdialog.h> + #include "base/logging.h" namespace printing { @@ -22,22 +25,34 @@ PrintingContext::~PrintingContext() { ResetSettings(); } -PrintingContext::Result PrintingContext::AskUserForSettings( +void PrintingContext::AskUserForSettings( gfx::NativeView parent_view, int max_pages, - bool has_selection) { - + bool has_selection, + PrintSettingsCallback* callback) { NOTIMPLEMENTED(); - - return FAILED; + callback->Run(OK); } PrintingContext::Result PrintingContext::UseDefaultSettings() { DCHECK(!in_print_job_); - NOTIMPLEMENTED(); + ResetSettings(); - return FAILED; + GtkWidget* dialog = gtk_print_unix_dialog_new(NULL, NULL); + GtkPrintSettings* settings = + gtk_print_unix_dialog_get_settings(GTK_PRINT_UNIX_DIALOG(dialog)); + GtkPageSetup* page_setup = + gtk_print_unix_dialog_get_page_setup(GTK_PRINT_UNIX_DIALOG(dialog)); + + PageRanges ranges_vector; // Nothing to initialize for default settings. + settings_.Init(settings, page_setup, ranges_vector, false); + + g_object_unref(settings); + // |page_setup| is owned by dialog, so it does not need to be unref'ed. + gtk_widget_destroy(dialog); + + return OK; } PrintingContext::Result PrintingContext::InitWithSettings( diff --git a/printing/printing_context_mac.mm b/printing/printing_context_mac.mm index 762cade..ea6474c 100644 --- a/printing/printing_context_mac.mm +++ b/printing/printing_context_mac.mm @@ -28,8 +28,10 @@ PrintingContext::~PrintingContext() { } -PrintingContext::Result PrintingContext::AskUserForSettings( - gfx::NativeView parent_view, int max_pages, bool has_selection) { +void PrintingContext::AskUserForSettings(gfx::NativeView parent_view, + int max_pages, + bool has_selection, + PrintSettingsCallback* callback) { DCHECK([NSThread isMainThread]); // We deliberately don't feed max_pages into the dialog, because setting @@ -62,11 +64,11 @@ PrintingContext::Result PrintingContext::AskUserForSettings( // Will require restructuring the PrintingContext API to use a callback. NSInteger selection = [panel runModalWithPrintInfo:printInfo]; if (selection != NSOKButton) { - return CANCEL; + callback->Run(CANCEL); } ParsePrintInfo([panel printInfo]); - return OK; + callback->Run(OK); } PrintingContext::Result PrintingContext::UseDefaultSettings() { diff --git a/printing/printing_context_win.cc b/printing/printing_context_win.cc index ef07833..a94c71f 100644 --- a/printing/printing_context_win.cc +++ b/printing/printing_context_win.cc @@ -136,10 +136,10 @@ PrintingContext::~PrintingContext() { ResetSettings(); } -PrintingContext::Result PrintingContext::AskUserForSettings( - HWND view, - int max_pages, - bool has_selection) { +void PrintingContext::AskUserForSettings(HWND view, + int max_pages, + bool has_selection, + PrintSettingsCallback* callback) { DCHECK(!in_print_job_); dialog_box_dismissed_ = false; @@ -190,11 +190,11 @@ PrintingContext::Result PrintingContext::AskUserForSettings( { if ((*print_dialog_func_)(&dialog_options) != S_OK) { ResetSettings(); - return FAILED; + callback->Run(FAILED); } } // TODO(maruel): Support PD_PRINTTOFILE. - return ParseDialogResultEx(dialog_options); + callback->Run(ParseDialogResultEx(dialog_options)); } PrintingContext::Result PrintingContext::UseDefaultSettings() { diff --git a/printing/printing_context_win_unittest.cc b/printing/printing_context_win_unittest.cc index c2e377b..625af54 100644 --- a/printing/printing_context_win_unittest.cc +++ b/printing/printing_context_win_unittest.cc @@ -10,6 +10,16 @@ // This test is automatically disabled if no printer is available. class PrintingContextTest : public PrintingTest<testing::Test> { + public: + void PrintSettingsCallback(printing::PrintingContext::Result result) { + result_ = result; + } + + protected: + printing::PrintingContext::Result result() const { return result_; } + + private: + printing::PrintingContext::Result result_; }; // This is a fake PrintDlgEx implementation that sets the right fields in @@ -105,8 +115,13 @@ TEST_F(PrintingContextTest, Base) { TEST_F(PrintingContextTest, PrintAll) { printing::PrintingContext context; context.SetPrintDialog(&PrintDlgExMock); - ASSERT_EQ(printing::PrintingContext::OK, - context.AskUserForSettings(NULL, 123, false)); + context.AskUserForSettings( + NULL, + 123, + false, + NewCallback(static_cast<PrintingContextTest*>(this), + &PrintingContextTest::PrintSettingsCallback)); + ASSERT_EQ(printing::PrintingContext::OK, result()); printing::PrintSettings settings = context.settings(); EXPECT_EQ(settings.ranges.size(), 0); -}
\ No newline at end of file +} |