Commit bd2c6530 authored by Elly Fong-Jones's avatar Elly Fong-Jones Committed by Commit Bot

polychrome: fix PasswordDialogViewTest suite

These tests assume window closure via views::Widget::Close() is synchronous,
which is not guaranteed to be the case. Spinning the runloop allows async
window closure to happen properly in these tests, which fixes them for MacViews.

Bug: 817408
Change-Id: Ic2d0443283a46573631a628cf57d077514674326
Reviewed-on: https://chromium-review.googlesource.com/970725Reviewed-by: default avatarLeonard Grey <lgrey@chromium.org>
Commit-Queue: Elly Fong-Jones <ellyjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#544358}
parent 7d6ceb1e
......@@ -5,6 +5,7 @@
#include <memory>
#include "base/memory/ptr_util.h"
#include "base/run_loop.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/password_manager/chrome_password_manager_client.h"
......@@ -200,6 +201,7 @@ IN_PROC_BROWSER_TEST_F(PasswordDialogViewTest,
EXPECT_CALL(*this, OnChooseCredential(nullptr));
EXPECT_CALL(*controller(), OnDialogClosed());
dialog->GetWidget()->Close();
base::RunLoop().RunUntilIdle();
EXPECT_FALSE(controller()->current_autosignin_prompt());
}
......@@ -254,6 +256,7 @@ IN_PROC_BROWSER_TEST_F(PasswordDialogViewTest,
EXPECT_CALL(*this, OnChooseCredential(nullptr));
EXPECT_CALL(*controller(), OnDialogClosed());
dialog->GetWidget()->Close();
base::RunLoop().RunUntilIdle();
EXPECT_FALSE(controller()->current_autosignin_prompt());
}
......@@ -383,6 +386,7 @@ IN_PROC_BROWSER_TEST_F(PasswordDialogViewTest, PopupAutoSigninPrompt) {
EXPECT_TRUE(dialog->GetWidget()->client_view()->AcceleratorPressed(esc));
EXPECT_TRUE(bubble_observer.widget_closed());
content::RunAllPendingInMessageLoop();
base::RunLoop().RunUntilIdle();
testing::Mock::VerifyAndClearExpectations(controller());
EXPECT_TRUE(
password_bubble_experiment::ShouldShowAutoSignInPromptFirstRunExperience(
......
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