#include "chrome/browser/printing/browser_printing_context_factory_for_test.h"
#include <memory>
#include <utility>
#include "base/functional/bind.h"
#include "base/types/optional_util.h"
#include "build/build_config.h"
#include "chrome/browser/printing/print_test_utils.h"
#include "printing/buildflags/buildflags.h"
#include "printing/test_printing_context.h"
namespace printing {
BrowserPrintingContextFactoryForTest::BrowserPrintingContextFactoryForTest() =
default;
BrowserPrintingContextFactoryForTest::~BrowserPrintingContextFactoryForTest() =
default;
std::unique_ptr<PrintingContext>
BrowserPrintingContextFactoryForTest::CreatePrintingContext(
PrintingContext::Delegate* delegate,
PrintingContext::ProcessBehavior process_behavior) { … }
void BrowserPrintingContextFactoryForTest::SetPrinterNameForSubsequentContexts(
const std::string& printer_name) { … }
#if BUILDFLAG(IS_WIN)
void BrowserPrintingContextFactoryForTest::
SetPrinterLanguageTypeForSubsequentContexts(
mojom::PrinterLanguageType printer_language_type) {
printer_language_type_ = printer_language_type;
}
#endif
void BrowserPrintingContextFactoryForTest::
SetUserSettingsPageRangesForSubsequentContext(
const PageRanges& page_ranges) { … }
void BrowserPrintingContextFactoryForTest::
SetFailedErrorOnUpdatePrinterSettings() { … }
void BrowserPrintingContextFactoryForTest::SetCancelErrorOnNewDocument(
bool cause_errors) { … }
void BrowserPrintingContextFactoryForTest::SetFailedErrorOnNewDocument(
bool cause_errors) { … }
void BrowserPrintingContextFactoryForTest::SetJobIdOnNewDocument(int job_id) { … }
void BrowserPrintingContextFactoryForTest::SetAccessDeniedErrorOnNewDocument(
bool cause_errors) { … }
#if BUILDFLAG(IS_WIN)
void BrowserPrintingContextFactoryForTest::SetAccessDeniedErrorOnRenderPage(
bool cause_errors) {
access_denied_errors_for_render_page_ = cause_errors;
}
void BrowserPrintingContextFactoryForTest::SetFailedErrorForRenderPage(
uint32_t page_number) {
failed_error_for_render_page_number_ = page_number;
}
#endif
void BrowserPrintingContextFactoryForTest::SetAccessDeniedErrorOnRenderDocument(
bool cause_errors) { … }
void BrowserPrintingContextFactoryForTest::SetAccessDeniedErrorOnDocumentDone(
bool cause_errors) { … }
void BrowserPrintingContextFactoryForTest::SetFailErrorOnUseDefaultSettings() { … }
#if BUILDFLAG(ENABLE_BASIC_PRINT_DIALOG)
void BrowserPrintingContextFactoryForTest::
SetCancelErrorOnAskUserForSettings() { … }
void BrowserPrintingContextFactoryForTest::SetFailErrorOnAskUserForSettings() { … }
#endif
void BrowserPrintingContextFactoryForTest::SetOnNewDocumentCallback(
TestPrintingContext::OnNewDocumentCallback callback) { … }
std::unique_ptr<TestPrintingContext>
BrowserPrintingContextFactoryForTest::MakeDefaultTestPrintingContext(
PrintingContext::Delegate* delegate,
PrintingContext::ProcessBehavior process_behavior,
const std::string& printer_name) { … }
}