Commit ae18336c authored by Olivier Robin's avatar Olivier Robin Committed by Commit Bot

Fix autofill flaky tests

Add a timer to let the CRWCertVerificationController finish tasks.
This is a workaround crbug.com/776330.

Bug: 
Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet
Change-Id: Ide3f3b38a1e981db9b2c42a053e1caaae13c1348
Reviewed-on: https://chromium-review.googlesource.com/728100Reviewed-by: default avatarEric Noyau <noyau@chromium.org>
Commit-Queue: Olivier Robin <olivierrobin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#510079}
parent d7eb687c
......@@ -11,6 +11,8 @@
#include "base/path_service.h"
#include "base/stl_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task_scheduler/task_scheduler.h"
#import "base/test/ios/wait_util.h"
#include "components/autofill/core/browser/autofill_manager.h"
#include "components/autofill/core/browser/data_driven_test.h"
#import "components/autofill/ios/browser/autofill_agent.h"
......@@ -170,12 +172,18 @@ void FormStructureBrowserTest::SetUp() {
void FormStructureBrowserTest::TearDown() {
[autofillController_ detachFromWebState];
// TODO(crbug.com/776330): remove this manual sync.
// This is a workaround to manually sync the tasks posted by
// |CRWCertVerificationController verifyTrust:completionHandler:|.
// |WaitForBackgroundTasks| currently fails to wait for completion of them.
base::test::ios::SpinRunLoopWithMinDelay(base::TimeDelta::FromSecondsD(0.1));
ChromeWebTest::TearDown();
}
void FormStructureBrowserTest::GenerateResults(const std::string& input,
std::string* output) {
LoadHtml(input);
base::TaskScheduler::GetInstance()->FlushForTesting();
AutofillManager* autofill_manager =
AutofillDriverIOS::FromWebState(web_state())->autofill_manager();
ASSERT_NE(nullptr, autofill_manager);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment