#include <string_view>
#include "base/test/metrics/histogram_tester.h"
#include "build/build_config.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/web_applications/test/web_app_browsertest_util.h"
#include "chrome/browser/web_applications/test/os_integration_test_override_impl.h"
#include "chrome/browser/web_applications/test/web_app_icon_waiter.h"
#include "chrome/browser/web_applications/test/web_app_install_test_utils.h"
#include "chrome/browser/web_applications/test/web_app_test_utils.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
#include "components/metrics/content/subprocess_metrics_provider.h"
#include "components/webapps/browser/test/service_worker_registration_waiter.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_base.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/test_navigation_observer.h"
#include "content/public/test/url_loader_interceptor.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/ui_base_switches.h"
#include "ui/native_theme/native_theme.h"
#if BUILDFLAG(IS_WIN)
#include "base/win/windows_version.h"
#endif
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "ash/public/cpp/style/dark_light_mode_controller.h"
#endif
ElementsAre;
namespace {
constexpr char kHistogramClosingReason[] = …;
constexpr char kHistogramDurationShown[] = …;
}
namespace web_app {
enum class PageFlagParam { … };
class WebAppOfflineTest : public InProcessBrowserTest { … };
class WebAppOfflinePageTest : public WebAppOfflineTest { … };
IN_PROC_BROWSER_TEST_F(WebAppOfflinePageTest, WebAppOfflinePageIsDisplayed) { … }
IN_PROC_BROWSER_TEST_F(WebAppOfflinePageTest,
WebAppOfflineWithEmptyServiceWorker) { … }
IN_PROC_BROWSER_TEST_F(WebAppOfflinePageTest, WebAppOfflineWithServiceWorker) { … }
IN_PROC_BROWSER_TEST_F(WebAppOfflinePageTest, WebAppOfflinePageIconShowing) { … }
IN_PROC_BROWSER_TEST_F(WebAppOfflinePageTest, WebAppOfflineMetricsNavigation) { … }
IN_PROC_BROWSER_TEST_F(WebAppOfflinePageTest, WebAppOfflineMetricsBackOnline) { … }
IN_PROC_BROWSER_TEST_F(WebAppOfflinePageTest, WebAppOfflineMetricsPwaClosing) { … }
class WebAppOfflineDarkModeTest
: public WebAppOfflineTest,
public testing::WithParamInterface<blink::mojom::PreferredColorScheme> { … };
#if BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_LINUX)
#define MAYBE_WebAppOfflineDarkModeNoServiceWorker …
#else
#define MAYBE_WebAppOfflineDarkModeNoServiceWorker …
#endif
IN_PROC_BROWSER_TEST_P(WebAppOfflineDarkModeTest,
MAYBE_WebAppOfflineDarkModeNoServiceWorker) { … }
#if BUILDFLAG(IS_CHROMEOS_LACROS) || BUILDFLAG(IS_LINUX)
#define MAYBE_WebAppOfflineDarkModeEmptyServiceWorker …
#else
#define MAYBE_WebAppOfflineDarkModeEmptyServiceWorker …
#endif
IN_PROC_BROWSER_TEST_P(WebAppOfflineDarkModeTest,
MAYBE_WebAppOfflineDarkModeEmptyServiceWorker) { … }
INSTANTIATE_TEST_SUITE_P(…);
}