Commit 17da1064 authored by Alexey Baskakov's avatar Alexey Baskakov Committed by Commit Bot

WebApp: Extend testing functionality of WebAppInstallObserver.

Implement WebAppInstallObserver::SetWebAppInstalledDelegate.
It will be used with lambdas in sync tests.

Bug: 1020037
Change-Id: I01f5a60bd24f3b74dd52d62f3d7d61bdf477d929
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2162401
Auto-Submit: Alexey Baskakov <loyso@chromium.org>
Reviewed-by: default avatarEric Willigers <ericwilligers@chromium.org>
Commit-Queue: Alexey Baskakov <loyso@chromium.org>
Cr-Commit-Position: refs/heads/master@{#762722}
parent 8c47c490
......@@ -23,6 +23,11 @@ AppId WebAppInstallObserver::AwaitNextInstall() {
return std::move(app_id_);
}
void WebAppInstallObserver::SetWebAppInstalledDelegate(
WebAppInstalledDelegate delegate) {
app_installed_delegate_ = delegate;
}
void WebAppInstallObserver::SetWebAppWillBeUninstalledDelegate(
WebAppUninstalledDelegate delegate) {
app_will_be_uninstalled_delegate_ = delegate;
......@@ -34,6 +39,9 @@ void WebAppInstallObserver::SetWebAppUninstalledDelegate(
}
void WebAppInstallObserver::OnWebAppInstalled(const AppId& app_id) {
if (app_installed_delegate_)
app_installed_delegate_.Run(app_id);
app_id_ = app_id;
run_loop_.Quit();
}
......
......@@ -25,6 +25,10 @@ class WebAppInstallObserver final : public AppRegistrarObserver {
AppId AwaitNextInstall();
using WebAppInstalledDelegate =
base::RepeatingCallback<void(const AppId& app_id)>;
void SetWebAppInstalledDelegate(WebAppInstalledDelegate delegate);
using WebAppUninstalledDelegate =
base::RepeatingCallback<void(const AppId& app_id)>;
void SetWebAppWillBeUninstalledDelegate(WebAppUninstalledDelegate delegate);
......@@ -39,6 +43,8 @@ class WebAppInstallObserver final : public AppRegistrarObserver {
base::RunLoop run_loop_;
AppId app_id_;
WebAppUninstalledDelegate app_installed_delegate_;
WebAppUninstalledDelegate app_will_be_uninstalled_delegate_;
WebAppUninstalledDelegate app_uninstalled_delegate_;
......
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