Include client and context cleanup for UpdatePrintSettings cancel
Add the missing cleanup for client ID in PrintViewManagerBase and
PrinterQueryOop when there has been a cancel from
UpdatePrintSettings().
Add the missing context ID cleanup in PrintBackendServiceImpl when
UpdatePrintSettings() is not successful, similar to how it is done in
other methods.
These changes can demonstrate the system print from Print Preview
cancel retry test to now pass, but only when the test is run with flag
--single-process-tests. More changes to the test framework are needed
to support the second invocation of the Print Preview not getting
stuck.
Bug: 1435566
Change-Id: Idb1a197d3a105949853da36bd85837fff7e6ab9e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4474347
Reviewed-by: Andy Phan <andyphan@chromium.org>
Commit-Queue: Alan Screen <awscreen@chromium.org>
Code-Coverage: Findit <findit-for-me@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/heads/main@{#1135385}
diff --git a/chrome/services/printing/print_backend_service_impl.cc b/chrome/services/printing/print_backend_service_impl.cc
index 67b9c18..95491f4c 100644
--- a/chrome/services/printing/print_backend_service_impl.cc
+++ b/chrome/services/printing/print_backend_service_impl.cc
@@ -696,6 +696,7 @@
context->UpdatePrintSettings(std::move(job_settings));
if (result != mojom::ResultCode::kSuccess) {
+ persistent_printing_contexts_.erase(context_id);
std::move(callback).Run(mojom::PrintSettingsResult::NewResultCode(result));
return;
}