Lacros web apps: Run WebAppBadgingBrowserTest with Ash
To ensure it works with crosapi enabled, we add the badging test to
lacros_chrome_browsertests_run_in_series.
Bug: 1208258
Change-Id: Iacf711eaaf63854f2bf635b5cecff2682b2f98e5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3898472
Commit-Queue: Eric Willigers <ericwilligers@chromium.org>
Reviewed-by: Glen Robertson <glenrob@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1049003}
diff --git a/chrome/browser/ui/web_applications/BUILD.gn b/chrome/browser/ui/web_applications/BUILD.gn
index 51256208..34c35c1 100644
--- a/chrome/browser/ui/web_applications/BUILD.gn
+++ b/chrome/browser/ui/web_applications/BUILD.gn
@@ -36,7 +36,6 @@
"create_shortcut_browsertest.cc",
"pwa_mixed_content_browsertest.cc",
"sub_apps_service_impl_browsertest.cc",
- "web_app_badging_browsertest.cc",
"web_app_browsertest.cc",
"web_app_dark_mode_browsertest.cc",
"web_app_engagement_browsertest.cc",
@@ -89,12 +88,14 @@
}
}
-# On Lacros, these browser tests require Ash to be running.
+# On Lacros, these browser tests require Ash to be running, as they rely on
+# web apps being registered with the App Service.
source_set("app_service_browser_tests") {
testonly = true
sources = [
"launch_web_app_browsertest.cc",
+ "web_app_badging_browsertest.cc",
"web_app_link_capturing_browsertest.cc",
"web_app_protocol_handling_browsertest.cc",
"web_app_url_handling_browsertest.cc",
@@ -116,6 +117,7 @@
deps = [
"//chrome/app:command_ids",
+ "//chrome/browser/browsing_data:constants",
"//chrome/browser/web_applications",
"//chrome/browser/web_applications:web_applications_test_support",
"//chrome/test:test_support",
diff --git a/chrome/browser/ui/web_applications/web_app_badging_browsertest.cc b/chrome/browser/ui/web_applications/web_app_badging_browsertest.cc
index 930602a..2cb1b8b 100644
--- a/chrome/browser/ui/web_applications/web_app_badging_browsertest.cc
+++ b/chrome/browser/ui/web_applications/web_app_badging_browsertest.cc
@@ -15,6 +15,8 @@
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/web_applications/web_app_controller_browsertest.h"
+#include "chrome/browser/web_applications/test/app_registry_cache_waiter.h"
+#include "chrome/browser/web_applications/test/web_app_install_test_utils.h"
#include "chrome/browser/web_applications/user_display_mode.h"
#include "chrome/browser/web_applications/web_app_install_info.h"
#include "chrome/browser/web_applications/web_app_provider.h"
@@ -55,6 +57,10 @@
sub_app_info->user_display_mode = UserDisplayMode::kStandalone;
sub_app_id_ = InstallWebApp(std::move(sub_app_info));
+ AppReadinessWaiter(profile(), cross_site_app_id_).Await();
+ AppReadinessWaiter(profile(), main_app_id_).Await();
+ AppReadinessWaiter(profile(), sub_app_id_).Await();
+
content::WebContents* web_contents = OpenApplication(main_app_id_);
// There should be exactly 4 frames:
// 1) The main frame.
@@ -115,6 +121,18 @@
badge_manager->SetDelegate(std::move(owned_delegate));
}
+ // WebAppControllerBrowserTest:
+ void TearDownOnMainThread() override {
+ WebAppRegistrar& registrar = provider().registrar();
+ for (const auto& app_id : registrar.GetAppIds()) {
+ web_app::test::UninstallWebApp(profile(), app_id);
+ AppReadinessWaiter(profile(), app_id, apps::Readiness::kUninstalledByUser)
+ .Await();
+ }
+
+ WebAppControllerBrowserTest::TearDownOnMainThread();
+ }
+
void OnBadgeChanged() {
// This is only set up to deal with one badge change at a time per app,
// in order to make asserting the result of a badge change easier. A single
diff --git a/chrome/test/BUILD.gn b/chrome/test/BUILD.gn
index 086d865..6882cb4 100644
--- a/chrome/test/BUILD.gn
+++ b/chrome/test/BUILD.gn
@@ -4849,6 +4849,7 @@
"data/media/",
"data/policy/test_certs/",
"data/webapps_integration/",
+ "data/web_app_badging/",
"data/web_app_shortcuts/",
"data/web_apps/",
"data/web_share_target/",