Commit c80b2871 authored by Eric Willigers's avatar Eric Willigers Committed by Commit Bot

PwaInstallViewBrowserTest cleanup

DesktopPWAsWithoutExtensions has shipped. The test
no longer needs to be parameterized.

Bug: 1065748
Change-Id: Id0f546f5add36b3f43e1599088d63063e9619d68
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2459258
Auto-Submit: Eric Willigers <ericwilligers@chromium.org>
Commit-Queue: Alan Cutter <alancutter@chromium.org>
Reviewed-by: default avatarAlan Cutter <alancutter@chromium.org>
Cr-Commit-Position: refs/heads/master@{#815027}
parent 8c6afe3a
......@@ -8,7 +8,6 @@
#include "base/run_loop.h"
#include "base/test/bind_test_util.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/scoped_feature_list.h"
#include "chrome/browser/banners/test_app_banner_manager_desktop.h"
#include "chrome/browser/extensions/extension_browsertest.h"
#include "chrome/browser/ui/browser_commands.h"
......@@ -23,9 +22,7 @@
#include "chrome/browser/web_applications/components/install_bounce_metric.h"
#include "chrome/browser/web_applications/components/install_finalizer.h"
#include "chrome/browser/web_applications/components/os_integration_manager.h"
#include "chrome/browser/web_applications/test/web_app_test.h"
#include "chrome/browser/web_applications/web_app_provider.h"
#include "chrome/common/chrome_features.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
......@@ -53,12 +50,7 @@ namespace {
class PwaInstallIconChangeWaiter : public views::ViewObserver {
public:
static void VerifyIconVisibility(views::View* iconView, bool visible) {
if (visible != iconView->GetVisible())
PwaInstallIconChangeWaiter(iconView).run_loop_.Run();
EXPECT_EQ(visible, iconView->GetVisible());
}
static void VerifyIconVisibility(views::View* iconView, bool visible);
private:
explicit PwaInstallIconChangeWaiter(views::View* view) {
......@@ -79,21 +71,21 @@ class PwaInstallIconChangeWaiter : public views::ViewObserver {
DISALLOW_COPY_AND_ASSIGN(PwaInstallIconChangeWaiter);
};
// static
void PwaInstallIconChangeWaiter::VerifyIconVisibility(views::View* iconView,
bool visible) {
if (visible != iconView->GetVisible())
PwaInstallIconChangeWaiter(iconView).run_loop_.Run();
EXPECT_EQ(visible, iconView->GetVisible());
}
} // namespace
class PwaInstallViewBrowserTest
: public extensions::ExtensionBrowserTest,
public ::testing::WithParamInterface<web_app::ProviderType> {
class PwaInstallViewBrowserTest : public extensions::ExtensionBrowserTest {
public:
PwaInstallViewBrowserTest()
: https_server_(net::EmbeddedTestServer::TYPE_HTTPS) {
if (GetParam() == web_app::ProviderType::kWebApps) {
scoped_feature_list_.InitAndEnableFeature(
features::kDesktopPWAsWithoutExtensions);
} else if (GetParam() == web_app::ProviderType::kBookmarkApps) {
scoped_feature_list_.InitAndDisableFeature(
features::kDesktopPWAsWithoutExtensions);
}
}
~PwaInstallViewBrowserTest() override = default;
......@@ -257,7 +249,6 @@ class PwaInstallViewBrowserTest
}
protected:
base::test::ScopedFeatureList scoped_feature_list_;
net::EmbeddedTestServer https_server_;
std::string intercept_request_path_;
std::string intercept_request_response_;
......@@ -271,7 +262,7 @@ class PwaInstallViewBrowserTest
// Tests that the plus icon is not shown when an existing app is installed and
// set to open in a window.
IN_PROC_BROWSER_TEST_P(PwaInstallViewBrowserTest,
IN_PROC_BROWSER_TEST_F(PwaInstallViewBrowserTest,
PwaSetToOpenInWindowIsNotInstallable) {
bool installable = OpenTab(GetInstallableAppURL()).installable;
ASSERT_TRUE(installable);
......@@ -289,7 +280,7 @@ IN_PROC_BROWSER_TEST_P(PwaInstallViewBrowserTest,
// Tests that the plus icon is not shown when an outer app is installed and we
// navigate to a nested app.
IN_PROC_BROWSER_TEST_P(PwaInstallViewBrowserTest,
IN_PROC_BROWSER_TEST_F(PwaInstallViewBrowserTest,
NestedPwaIsNotInstallableWhenOuterPwaIsInstalled) {
// When nothing is installed, the nested PWA should be installable.
StartNavigateToUrl(GetNestedInstallableAppURL());
......@@ -313,7 +304,7 @@ IN_PROC_BROWSER_TEST_P(PwaInstallViewBrowserTest,
// Tests that the install icon is shown when an existing app is installed and
// set to open in a tab.
IN_PROC_BROWSER_TEST_P(PwaInstallViewBrowserTest,
IN_PROC_BROWSER_TEST_F(PwaInstallViewBrowserTest,
PwaSetToOpenInTabIsInstallable) {
bool installable = OpenTab(GetInstallableAppURL()).installable;
ASSERT_TRUE(installable);
......@@ -334,7 +325,7 @@ IN_PROC_BROWSER_TEST_P(PwaInstallViewBrowserTest,
}
// Test that the accept metrics is reported correctly.
IN_PROC_BROWSER_TEST_P(PwaInstallViewBrowserTest, PwaInstalledMetricRecorded) {
IN_PROC_BROWSER_TEST_F(PwaInstallViewBrowserTest, PwaInstalledMetricRecorded) {
bool installable = OpenTab(GetInstallableAppURL()).installable;
ASSERT_TRUE(installable);
......@@ -347,7 +338,7 @@ IN_PROC_BROWSER_TEST_P(PwaInstallViewBrowserTest, PwaInstalledMetricRecorded) {
// Tests that the plus icon updates its visibility when switching between
// installable/non-installable tabs.
IN_PROC_BROWSER_TEST_P(PwaInstallViewBrowserTest,
IN_PROC_BROWSER_TEST_F(PwaInstallViewBrowserTest,
IconVisibilityAfterTabSwitching) {
content::WebContents* installable_web_contents;
{
......@@ -373,7 +364,7 @@ IN_PROC_BROWSER_TEST_P(PwaInstallViewBrowserTest,
}
// Tests that the install icon updates its visibility when tab crashes.
IN_PROC_BROWSER_TEST_P(PwaInstallViewBrowserTest,
IN_PROC_BROWSER_TEST_F(PwaInstallViewBrowserTest,
IconVisibilityAfterTabCrashed) {
StartNavigateToUrl(GetInstallableAppURL());
ASSERT_TRUE(app_banner_manager_->WaitForInstallableCheck());
......@@ -386,7 +377,7 @@ IN_PROC_BROWSER_TEST_P(PwaInstallViewBrowserTest,
// Tests that the plus icon updates its visibility once the installability check
// completes.
IN_PROC_BROWSER_TEST_P(PwaInstallViewBrowserTest,
IN_PROC_BROWSER_TEST_F(PwaInstallViewBrowserTest,
IconVisibilityAfterInstallabilityCheck) {
StartNavigateToUrl(GetInstallableAppURL());
EXPECT_FALSE(pwa_install_view_->GetVisible());
......@@ -400,7 +391,7 @@ IN_PROC_BROWSER_TEST_P(PwaInstallViewBrowserTest,
}
// Tests that the plus icon updates its visibility after installation.
IN_PROC_BROWSER_TEST_P(PwaInstallViewBrowserTest,
IN_PROC_BROWSER_TEST_F(PwaInstallViewBrowserTest,
IconVisibilityAfterInstallation) {
StartNavigateToUrl(GetInstallableAppURL());
content::WebContents* first_tab = GetCurrentTab();
......@@ -418,7 +409,7 @@ IN_PROC_BROWSER_TEST_P(PwaInstallViewBrowserTest,
// Tests that the plus icon animates its label when the installability check
// passes but doesn't animate more than once for the same installability check.
IN_PROC_BROWSER_TEST_P(PwaInstallViewBrowserTest, LabelAnimation) {
IN_PROC_BROWSER_TEST_F(PwaInstallViewBrowserTest, LabelAnimation) {
StartNavigateToUrl(GetInstallableAppURL());
EXPECT_FALSE(pwa_install_view_->GetVisible());
ASSERT_TRUE(app_banner_manager_->WaitForInstallableCheck());
......@@ -435,7 +426,7 @@ IN_PROC_BROWSER_TEST_P(PwaInstallViewBrowserTest, LabelAnimation) {
// Tests that the plus icon becomes invisible when the user is typing in the
// omnibox.
IN_PROC_BROWSER_TEST_P(PwaInstallViewBrowserTest, InputInOmnibox) {
IN_PROC_BROWSER_TEST_F(PwaInstallViewBrowserTest, InputInOmnibox) {
StartNavigateToUrl(GetInstallableAppURL());
ASSERT_TRUE(app_banner_manager_->WaitForInstallableCheck());
EXPECT_TRUE(pwa_install_view_->GetVisible());
......@@ -449,7 +440,7 @@ IN_PROC_BROWSER_TEST_P(PwaInstallViewBrowserTest, InputInOmnibox) {
// Tests that the icon persists while loading the same scope and omits running
// the label animation again.
IN_PROC_BROWSER_TEST_P(PwaInstallViewBrowserTest, NavigateToSameScope) {
IN_PROC_BROWSER_TEST_F(PwaInstallViewBrowserTest, NavigateToSameScope) {
StartNavigateToUrl(https_server_.GetURL("/banners/scope_a/page_1.html"));
EXPECT_FALSE(pwa_install_view_->GetVisible());
ASSERT_TRUE(app_banner_manager_->WaitForInstallableCheck());
......@@ -465,7 +456,7 @@ IN_PROC_BROWSER_TEST_P(PwaInstallViewBrowserTest, NavigateToSameScope) {
// Tests that the icon persists while loading the same scope but goes away when
// the installability check fails.
IN_PROC_BROWSER_TEST_P(PwaInstallViewBrowserTest,
IN_PROC_BROWSER_TEST_F(PwaInstallViewBrowserTest,
NavigateToSameScopeNonInstallable) {
StartNavigateToUrl(https_server_.GetURL("/banners/scope_a/page_1.html"));
EXPECT_FALSE(pwa_install_view_->GetVisible());
......@@ -482,7 +473,7 @@ IN_PROC_BROWSER_TEST_P(PwaInstallViewBrowserTest,
}
// Tests that the icon and animation resets while loading a different scope.
IN_PROC_BROWSER_TEST_P(PwaInstallViewBrowserTest, NavigateToDifferentScope) {
IN_PROC_BROWSER_TEST_F(PwaInstallViewBrowserTest, NavigateToDifferentScope) {
StartNavigateToUrl(https_server_.GetURL("/banners/scope_a/page_1.html"));
EXPECT_FALSE(pwa_install_view_->GetVisible());
ASSERT_TRUE(app_banner_manager_->WaitForInstallableCheck());
......@@ -498,7 +489,7 @@ IN_PROC_BROWSER_TEST_P(PwaInstallViewBrowserTest, NavigateToDifferentScope) {
// Tests that the icon and animation resets while loading a different empty
// scope.
IN_PROC_BROWSER_TEST_P(PwaInstallViewBrowserTest,
IN_PROC_BROWSER_TEST_F(PwaInstallViewBrowserTest,
NavigateToDifferentEmptyScope) {
StartNavigateToUrl(https_server_.GetURL("/banners/scope_a/page_1.html"));
EXPECT_FALSE(pwa_install_view_->GetVisible());
......@@ -515,7 +506,7 @@ IN_PROC_BROWSER_TEST_P(PwaInstallViewBrowserTest,
// Tests that the animation is suppressed for navigations within the same scope
// for an exponentially increasing period of time.
IN_PROC_BROWSER_TEST_P(PwaInstallViewBrowserTest, AnimationSuppression) {
IN_PROC_BROWSER_TEST_F(PwaInstallViewBrowserTest, AnimationSuppression) {
std::vector<bool> animation_shown_for_day = {
true, true, false, true, false, false, false, true,
false, false, false, false, false, false, false, true,
......@@ -534,7 +525,7 @@ IN_PROC_BROWSER_TEST_P(PwaInstallViewBrowserTest, AnimationSuppression) {
// Tests that the icon label is visible against the omnibox background after the
// native widget becomes active.
IN_PROC_BROWSER_TEST_P(PwaInstallViewBrowserTest, TextContrast) {
IN_PROC_BROWSER_TEST_F(PwaInstallViewBrowserTest, TextContrast) {
StartNavigateToUrl(GetInstallableAppURL());
ASSERT_TRUE(app_banner_manager_->WaitForInstallableCheck());
EXPECT_TRUE(pwa_install_view_->GetVisible());
......@@ -551,17 +542,17 @@ IN_PROC_BROWSER_TEST_P(PwaInstallViewBrowserTest, TextContrast) {
color_utils::kMinimumReadableContrastRatio);
}
IN_PROC_BROWSER_TEST_P(PwaInstallViewBrowserTest, BouncedInstallMeasured) {
IN_PROC_BROWSER_TEST_F(PwaInstallViewBrowserTest, BouncedInstallMeasured) {
TestInstallBounce(base::TimeDelta::FromMinutes(50), 1);
}
IN_PROC_BROWSER_TEST_P(PwaInstallViewBrowserTest, BouncedInstallIgnored) {
IN_PROC_BROWSER_TEST_F(PwaInstallViewBrowserTest, BouncedInstallIgnored) {
TestInstallBounce(base::TimeDelta::FromMinutes(70), 0);
}
// Omnibox install promotion should show if there are no viable related apps
// even if prefer_related_applications is true.
IN_PROC_BROWSER_TEST_P(PwaInstallViewBrowserTest, PreferRelatedAppUnknown) {
IN_PROC_BROWSER_TEST_F(PwaInstallViewBrowserTest, PreferRelatedAppUnknown) {
StartNavigateToUrl(
https_server_.GetURL("/banners/manifest_test_page.html?manifest="
"manifest_prefer_related_apps_unknown.json"));
......@@ -572,7 +563,7 @@ IN_PROC_BROWSER_TEST_P(PwaInstallViewBrowserTest, PreferRelatedAppUnknown) {
// Omnibox install promotion should not show if prefer_related_applications is
// false but a related Chrome app is installed.
IN_PROC_BROWSER_TEST_P(PwaInstallViewBrowserTest, PreferRelatedChromeApp) {
IN_PROC_BROWSER_TEST_F(PwaInstallViewBrowserTest, PreferRelatedChromeApp) {
StartNavigateToUrl(
https_server_.GetURL("/banners/manifest_test_page.html?manifest="
"manifest_prefer_related_chrome_app.json"));
......@@ -586,7 +577,7 @@ IN_PROC_BROWSER_TEST_P(PwaInstallViewBrowserTest, PreferRelatedChromeApp) {
// Omnibox install promotion should not show if prefer_related_applications is
// true and a Chrome app listed as related.
IN_PROC_BROWSER_TEST_P(PwaInstallViewBrowserTest,
IN_PROC_BROWSER_TEST_F(PwaInstallViewBrowserTest,
ListedRelatedChromeAppInstalled) {
const extensions::Extension* extension =
LoadExtension(test_data_dir_.AppendASCII("app"));
......@@ -629,7 +620,7 @@ IN_PROC_BROWSER_TEST_P(PwaInstallViewBrowserTest,
#if defined(OS_CHROMEOS)
// Omnibox install promotion should not show if prefer_related_applications is
// true and an ARC app listed as related.
IN_PROC_BROWSER_TEST_P(PwaInstallViewBrowserTest,
IN_PROC_BROWSER_TEST_F(PwaInstallViewBrowserTest,
ListedRelatedAndroidAppInstalled) {
arc::SetArcPlayStoreEnabledForProfile(browser()->profile(), true);
ArcAppListPrefs* arc_app_list_prefs =
......@@ -655,9 +646,3 @@ IN_PROC_BROWSER_TEST_P(PwaInstallViewBrowserTest,
"Manifest listing related android app"));
}
#endif // defined(OS_CHROMEOS)
INSTANTIATE_TEST_SUITE_P(All,
PwaInstallViewBrowserTest,
::testing::Values(web_app::ProviderType::kBookmarkApps,
web_app::ProviderType::kWebApps),
web_app::ProviderTypeParamToString);
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