blob: 949d5a76a4a0bd09deb172763d3bcb383acbf6b8 [file] [log] [blame]
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_WEB_APPLICATIONS_TEST_WEB_APP_REGISTRATION_WAITER_H_
#define CHROME_BROWSER_WEB_APPLICATIONS_TEST_WEB_APP_REGISTRATION_WAITER_H_
#include "base/memory/raw_ptr.h"
#include "base/run_loop.h"
#include "chrome/browser/web_applications/externally_managed_app_manager.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
#include "url/gurl.h"
namespace web_app {
class WebAppRegistrationWaiter {
public:
explicit WebAppRegistrationWaiter(ExternallyManagedAppManager* manager);
~WebAppRegistrationWaiter();
void AwaitNextRegistration(const GURL& install_url,
RegistrationResultCode code);
void AwaitNextNonFailedRegistration(const GURL& install_url);
void AwaitRegistrationsComplete();
private:
const raw_ptr<ExternallyManagedAppManager> manager_;
base::RunLoop run_loop_;
GURL install_url_;
// If unset then check for any non failure result.
absl::optional<RegistrationResultCode> code_;
base::RunLoop complete_run_loop_;
};
} // namespace web_app
#endif // CHROME_BROWSER_WEB_APPLICATIONS_TEST_WEB_APP_REGISTRATION_WAITER_H_