Commit 3dee6140 authored by Thomas Tangl's avatar Thomas Tangl Committed by Commit Bot

[profile-menu] Re-enable tests for unconsented account

... and wait for the unconsented account to be set.

Bug: 995720
Change-Id: I2348b9c57309482040462afb73310b279e280fdf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1865329Reviewed-by: default avatarDavid Roger <droger@chromium.org>
Commit-Queue: Thomas Tangl <tangltom@chromium.org>
Cr-Commit-Position: refs/heads/master@{#706836}
parent d7f2ee7f
......@@ -29,6 +29,7 @@
#include "chrome/browser/sync/profile_sync_service_factory.h"
#include "chrome/browser/sync/test/integration/profile_sync_service_harness.h"
#include "chrome/browser/sync/test/integration/secondary_account_helper.h"
#include "chrome/browser/sync/test/integration/status_change_checker.h"
#include "chrome/browser/sync/test/integration/sync_test.h"
#include "chrome/browser/themes/theme_service.h"
#include "chrome/browser/themes/theme_service_factory.h"
......@@ -64,6 +65,37 @@
namespace {
class UnconsentedPrimaryAccountChecker
: public StatusChangeChecker,
public signin::IdentityManager::Observer {
public:
explicit UnconsentedPrimaryAccountChecker(
signin::IdentityManager* identity_manager)
: identity_manager_(identity_manager) {
identity_manager_->AddObserver(this);
}
~UnconsentedPrimaryAccountChecker() override {
identity_manager_->RemoveObserver(this);
}
// StatusChangeChecker overrides:
bool IsExitConditionSatisfied() override {
return identity_manager_->HasUnconsentedPrimaryAccount();
}
std::string GetDebugMessage() const override {
return "Unconsented primary account checker";
}
// signin::IdentityManager::Observer overrides:
void OnUnconsentedPrimaryAccountChanged(
const CoreAccountInfo& unconsented_primary_account_info) override {
CheckExitCondition();
}
private:
signin::IdentityManager* identity_manager_;
};
Profile* CreateTestingProfile(const base::FilePath& path) {
base::ScopedAllowBlockingForTesting allow_blocking;
ProfileManager* profile_manager = g_browser_process->profile_manager();
......@@ -856,13 +888,12 @@ constexpr ProfileMenuViewBase::ActionableItem
// there are no other buttons at the end.
ProfileMenuViewBase::ActionableItem::kEditProfileButton};
// TODO(crbug.com/1012167): Flaky.
PROFILE_MENU_CLICK_TEST(
kActionableItems_WithUnconsentedPrimaryAccount,
DISABLED_ProfileMenuClickTest_WithUnconsentedPrimaryAccount) {
PROFILE_MENU_CLICK_TEST(kActionableItems_WithUnconsentedPrimaryAccount,
ProfileMenuClickTest_WithUnconsentedPrimaryAccount) {
signin::MakeAccountAvailableWithCookies(identity_manager(),
&test_url_loader_factory_,
"user@example.com", "gaia_id");
UnconsentedPrimaryAccountChecker(identity_manager()).Wait();
// Check that the setup was successful.
ASSERT_FALSE(identity_manager()->HasPrimaryAccount());
ASSERT_TRUE(identity_manager()->HasUnconsentedPrimaryAccount());
......
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