#include "chrome/browser/ui/web_applications/web_app_metrics.h"
#include <stdint.h>
#include <memory>
#include <optional>
#include <string>
#include <utility>
#include <vector>
#include "base/check.h"
#include "base/numerics/clamped_math.h"
#include "base/run_loop.h"
#include "base/task/thread_pool/thread_pool_instance.h"
#include "base/test/test_future.h"
#include "base/time/time.h"
#include "base/time/time_override.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/apps/intent_helper/preferred_apps_test_util.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/web_applications/test/web_app_browsertest_util.h"
#include "chrome/browser/ui/web_applications/web_app_browsertest_base.h"
#include "chrome/browser/web_applications/daily_metrics_helper.h"
#include "chrome/browser/web_applications/mojom/user_display_mode.mojom-shared.h"
#include "chrome/browser/web_applications/test/web_app_install_test_utils.h"
#include "chrome/browser/web_applications/web_app_command_scheduler.h"
#include "chrome/browser/web_applications/web_app_constants.h"
#include "chrome/browser/web_applications/web_app_install_info.h"
#include "chrome/browser/web_applications/web_app_provider.h"
#include "chrome/browser/web_applications/web_app_registrar.h"
#include "chrome/common/chrome_features.h"
#include "components/ukm/test_ukm_recorder.h"
#include "components/webapps/browser/installable/installable_metrics.h"
#include "components/webapps/common/web_app_id.h"
#include "content/public/test/browser_test.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "services/metrics/public/cpp/ukm_builders.h"
#include "services/metrics/public/mojom/ukm_interface.mojom.h"
#include "testing/gmock/include/gmock/gmock-matchers.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/mojom/manifest/display_mode.mojom-shared.h"
#include "url/gurl.h"
#if BUILDFLAG(IS_CHROMEOS_LACROS)
#include "chrome/browser/web_applications/app_service/test/loopback_crosapi_app_service_proxy.h"
#endif
namespace web_app {
UkmEntry;
Contains;
Key;
Not;
Pair;
class WebAppMetricsBrowserTest : public WebAppBrowserTestBase { … };
IN_PROC_BROWSER_TEST_F(WebAppMetricsBrowserTest,
NonInstalledWebApp_RecordsDailyInteraction) { … }
IN_PROC_BROWSER_TEST_F(WebAppMetricsBrowserTest,
InstalledWebAppInTab_RecordsDailyInteraction) { … }
IN_PROC_BROWSER_TEST_F(WebAppMetricsBrowserTest,
PreinstalledWebAppInTab_RecordsDailyInteraction) { … }
IN_PROC_BROWSER_TEST_F(
WebAppMetricsBrowserTest,
InstalledWebAppInWindow_RecordsDailyInteractionWithSessionDurations) { … }
IN_PROC_BROWSER_TEST_F(WebAppMetricsBrowserTest,
DISABLED_NonWebApp_RecordsNothing) { … }
IN_PROC_BROWSER_TEST_F(WebAppMetricsBrowserTest,
NavigationsWithinInstalledWebApp_RecordsOneSession) { … }
IN_PROC_BROWSER_TEST_F(WebAppMetricsBrowserTest,
InstalledWebApp_RecordsTimeAndSessions) { … }
IN_PROC_BROWSER_TEST_F(WebAppMetricsBrowserTest,
InstalledWebApp_RecordsTimeAndSessionWhenClosed) { … }
IN_PROC_BROWSER_TEST_F(WebAppMetricsBrowserTest,
MultipleWebAppInstances_StillRecordsTime) { … }
IN_PROC_BROWSER_TEST_F(WebAppMetricsBrowserTest,
InstalledWebApp_RecordsZeroTimeIfOverLimit) { … }
IN_PROC_BROWSER_TEST_F(WebAppMetricsBrowserTest, Suspend_FlushesSessionTimes) { … }
IN_PROC_BROWSER_TEST_F(WebAppMetricsBrowserTest,
SessionEnd_FlushesSessionTimes) { … }
IN_PROC_BROWSER_TEST_F(WebAppMetricsBrowserTest,
InstalledWebApp_CraftedIsPromotable) { … }
IN_PROC_BROWSER_TEST_F(WebAppMetricsBrowserTest,
InstalledWebApp_DiyIsNonPromotable) { … }
}