Commit 32814de3 authored by Dominique Fauteux-Chapleau's avatar Dominique Fauteux-Chapleau Committed by Commit Bot

Fix DeepScanningDialogViews browser tests duration flakiness

Bug: 1065880
Change-Id: Ieb3264606cb1188c08e085328ab4e69bd64f3840
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2132030Reviewed-by: default avatarDominique Fauteux-Chapleau <domfc@chromium.org>
Reviewed-by: default avatarRoger Tawa <rogerta@chromium.org>
Commit-Queue: Dominique Fauteux-Chapleau <domfc@chromium.org>
Cr-Commit-Position: refs/heads/master@{#757509}
parent c1dab74f
......@@ -193,14 +193,14 @@ DeepScanningDialogViews::DeepScanningDialogViews(
web_contents_(web_contents),
access_point_(std::move(access_point)),
is_file_scan_(is_file_scan) {
if (observer_for_testing)
observer_for_testing->ConstructorCalled(this, base::TimeTicks::Now());
// Show the pending dialog after a delay in case the response is fast enough.
base::PostDelayedTask(FROM_HERE, {content::BrowserThread::UI},
base::BindOnce(&DeepScanningDialogViews::Show,
weak_ptr_factory_.GetWeakPtr()),
GetInitialUIDelay());
if (observer_for_testing)
observer_for_testing->ConstructorCalled(this);
}
base::string16 DeepScanningDialogViews::GetWindowTitle() const {
......
......@@ -71,10 +71,11 @@ class DeepScanningDialogViews : public views::DialogDelegate,
public:
virtual ~TestObserver() {}
// Called at the end of DeepScanningDialogViews's constructor. |views| is a
// pointer to the newly constructed DeepScanningDialogViews and should be
// Called at the start of DeepScanningDialogViews's constructor. |views| is
// a pointer to the newly constructed DeepScanningDialogViews and should be
// kept in memory by the test in order to validate its state.
virtual void ConstructorCalled(DeepScanningDialogViews* views) {}
virtual void ConstructorCalled(DeepScanningDialogViews* views,
base::TimeTicks timestamp) {}
// Called at the end of DeepScanningDialogViews::Show. |timestamp| is the
// time used by DeepScanningDialogViews to decide whether the pending state
......
......@@ -48,8 +48,9 @@ class DeepScanningDialogViewsBehaviorBrowserTest
expected_scan_result_ = dlp_result && malware_result;
}
void ConstructorCalled(DeepScanningDialogViews* views) override {
ctor_called_timestamp_ = base::TimeTicks::Now();
void ConstructorCalled(DeepScanningDialogViews* views,
base::TimeTicks timestamp) override {
ctor_called_timestamp_ = timestamp;
dialog_ = views;
// The scan should be pending when constructed.
......
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