#ifndef CHROME_TEST_BASE_PROFILE_DESTRUCTION_WAITER_H_
#define CHROME_TEST_BASE_PROFILE_DESTRUCTION_WAITER_H_
#include "base/memory/raw_ptr.h"
#include "base/run_loop.h"
#include "base/scoped_observation.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_observer.h"
class Profile;
class ProfileDestructionWaiter : public ProfileObserver {
public:
explicit ProfileDestructionWaiter(Profile* profile);
~ProfileDestructionWaiter() override;
void Wait();
bool destroyed() const { return destroyed_; }
private:
void OnProfileWillBeDestroyed(Profile* profile) override;
base::ScopedObservation<Profile, ProfileObserver> profile_observer_{this};
bool destroyed_ = false;
base::RunLoop run_loop_;
};
#endif