Call FORM_DoDocumentAAction() in EmbedderTest::CloseDocument().

The |FPDFDOC_AACTION_WC| action is meant to run when the document is
closing. Tie this to CloseDocument(), rather than TearDown().

Change-Id: Ic7dd9c42430e834dec5fdff1480133cbcc391d08
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/68854
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/testing/embedder_test.cpp b/testing/embedder_test.cpp
index caba758..69842a4 100644
--- a/testing/embedder_test.cpp
+++ b/testing/embedder_test.cpp
@@ -86,10 +86,8 @@
   EXPECT_EQ(0U, page_map_.size());
   EXPECT_EQ(0U, saved_page_map_.size());
 
-  if (document_) {
-    FORM_DoDocumentAAction(form_handle_, FPDFDOC_AACTION_WC);
+  if (document_)
     CloseDocument();
-  }
 
   FPDFAvail_Destroy(avail_);
   FPDF_DestroyLibrary();
@@ -229,6 +227,7 @@
 }
 
 void EmbedderTest::CloseDocument() {
+  FORM_DoDocumentAAction(form_handle_, FPDFDOC_AACTION_WC);
   FPDFDOC_ExitFormFillEnvironment(form_handle_);
   form_handle_ = nullptr;