blob: d1f33f4fc495917eaebd8fefefd28b7cc375f7a7 [file]
// Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/test/base/profile_destruction_waiter.h"
ProfileDestructionWaiter::ProfileDestructionWaiter(Profile* profile) {
profile_observer_.Observe(profile);
}
ProfileDestructionWaiter::~ProfileDestructionWaiter() = default;
void ProfileDestructionWaiter::Wait() {
run_loop_.Run();
}
void ProfileDestructionWaiter::OnProfileWillBeDestroyed(Profile* profile) {
DCHECK(!destroyed_);
destroyed_ = true;
run_loop_.Quit();
profile_observer_.Reset();
}