| Index: chrome/browser/ui/webui/print_preview/print_preview_handler.cc
|
| diff --git a/chrome/browser/ui/webui/print_preview/print_preview_handler.cc b/chrome/browser/ui/webui/print_preview/print_preview_handler.cc
|
| index 86ee312de2523d6cdec431d45fdeac0d8f56af72..afe08ac8834e65a2878516646adc6db84aa2b1df 100644
|
| --- a/chrome/browser/ui/webui/print_preview/print_preview_handler.cc
|
| +++ b/chrome/browser/ui/webui/print_preview/print_preview_handler.cc
|
| @@ -278,11 +278,14 @@ void ReportPrintSettingsStats(const base::DictionaryValue& settings) {
|
|
|
| // Callback that stores a PDF file on disk.
|
| void PrintToPdfCallback(printing::Metafile* metafile,
|
| - const base::FilePath& path) {
|
| + const base::FilePath& path,
|
| + const base::Closure* callback_for_test) {
|
| DCHECK_CURRENTLY_ON(BrowserThread::FILE);
|
| metafile->SaveTo(path);
|
| // |metafile| must be deleted on the UI thread.
|
| BrowserThread::DeleteSoon(BrowserThread::UI, FROM_HERE, metafile);
|
| + if (callback_for_test)
|
| + callback_for_test->Run();
|
| }
|
|
|
| std::string GetDefaultPrinterOnFileThread() {
|
| @@ -1372,7 +1375,10 @@ void PrintPreviewHandler::PostPrintToPdfTask() {
|
| metafile->InitFromData(static_cast<const void*>(data->front()), data->size());
|
| BrowserThread::PostTask(
|
| BrowserThread::FILE, FROM_HERE,
|
| - base::Bind(&PrintToPdfCallback, metafile.release(), print_to_pdf_path_));
|
| + base::Bind(&PrintToPdfCallback,
|
| + metafile.release(),
|
| + print_to_pdf_path_,
|
| + callback_for_test_));
|
| print_to_pdf_path_ = base::FilePath();
|
| ClosePreviewDialog();
|
| }
|
| @@ -1631,3 +1637,7 @@ void PrintPreviewHandler::UnregisterForMergeSession() {
|
| if (reconcilor_)
|
| reconcilor_->RemoveMergeSessionObserver(this);
|
| }
|
| +
|
| +void PrintPreviewHandler::SetCallbackForTesting(const base::Closure* callback) {
|
| + callback_for_test_ = callback;
|
| +}
|
|
|