Commit 6e2c1b16 authored by Eric Willigers's avatar Eric Willigers Committed by Commit Bot

Desktop PWAs: PendingAppManagerImpl test cleanup

PendingAppManagerImplBrowserTest no longer uses web app
ProviderType.

Bug: 1065748
Change-Id: I7628ec04f5f990e37b17cdf4a9823a1e16bde8bd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2454962
Auto-Submit: Eric Willigers <ericwilligers@chromium.org>
Commit-Queue: Daniel Murphy <dmurph@chromium.org>
Reviewed-by: default avatarDaniel Murphy <dmurph@chromium.org>
Cr-Commit-Position: refs/heads/master@{#814740}
parent b44710c3
......@@ -10,7 +10,6 @@
#include "base/optional.h"
#include "base/run_loop.h"
#include "base/test/bind_test_util.h"
#include "base/test/scoped_feature_list.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/web_applications/test/web_app_browsertest_util.h"
......@@ -22,8 +21,6 @@
#include "chrome/browser/web_applications/components/web_app_provider_base.h"
#include "chrome/browser/web_applications/pending_app_registration_task.h"
#include "chrome/browser/web_applications/test/web_app_registration_waiter.h"
#include "chrome/browser/web_applications/test/web_app_test.h"
#include "chrome/common/chrome_features.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "content/public/browser/service_worker_context.h"
#include "content/public/browser/storage_partition.h"
......@@ -34,20 +31,8 @@
namespace web_app {
class PendingAppManagerImplBrowserTest
: public InProcessBrowserTest,
public ::testing::WithParamInterface<ProviderType> {
class PendingAppManagerImplBrowserTest : public InProcessBrowserTest {
protected:
PendingAppManagerImplBrowserTest() {
if (GetParam() == ProviderType::kWebApps) {
scoped_feature_list_.InitAndEnableFeature(
features::kDesktopPWAsWithoutExtensions);
} else if (GetParam() == ProviderType::kBookmarkApps) {
scoped_feature_list_.InitAndDisableFeature(
features::kDesktopPWAsWithoutExtensions);
}
}
void SetUpOnMainThread() override {
InProcessBrowserTest::SetUpOnMainThread();
// Allow different origins to be handled by the embedded_test_server.
......@@ -95,13 +80,12 @@ class PendingAppManagerImplBrowserTest
run_loop.Run();
}
base::test::ScopedFeatureList scoped_feature_list_;
base::Optional<InstallResultCode> result_code_;
};
// Basic integration test to make sure the whole flow works. Each step in the
// flow is unit tested separately.
IN_PROC_BROWSER_TEST_P(PendingAppManagerImplBrowserTest, InstallSucceeds) {
IN_PROC_BROWSER_TEST_F(PendingAppManagerImplBrowserTest, InstallSucceeds) {
ASSERT_TRUE(embedded_test_server()->Start());
GURL url(embedded_test_server()->GetURL("/banners/manifest_test_page.html"));
InstallApp(CreateInstallOptions(url));
......@@ -114,7 +98,7 @@ IN_PROC_BROWSER_TEST_P(PendingAppManagerImplBrowserTest, InstallSucceeds) {
}
// If install URL redirects, install should still succeed.
IN_PROC_BROWSER_TEST_P(PendingAppManagerImplBrowserTest,
IN_PROC_BROWSER_TEST_F(PendingAppManagerImplBrowserTest,
InstallSucceedsWithRedirect) {
ASSERT_TRUE(embedded_test_server()->Start());
GURL start_url =
......@@ -137,7 +121,7 @@ IN_PROC_BROWSER_TEST_P(PendingAppManagerImplBrowserTest,
}
// If install URL redirects, install should still succeed.
IN_PROC_BROWSER_TEST_P(PendingAppManagerImplBrowserTest,
IN_PROC_BROWSER_TEST_F(PendingAppManagerImplBrowserTest,
InstallSucceedsWithRedirectNoManifest) {
ASSERT_TRUE(embedded_test_server()->Start());
GURL final_url =
......@@ -162,7 +146,7 @@ IN_PROC_BROWSER_TEST_P(PendingAppManagerImplBrowserTest,
}
// Installing a placeholder app with shortcuts should succeed.
IN_PROC_BROWSER_TEST_P(PendingAppManagerImplBrowserTest,
IN_PROC_BROWSER_TEST_F(PendingAppManagerImplBrowserTest,
PlaceholderInstallSucceedsWithShortcuts) {
ASSERT_TRUE(embedded_test_server()->Start());
os_integration_manager().SuppressOsHooksForTesting();
......@@ -189,7 +173,7 @@ IN_PROC_BROWSER_TEST_P(PendingAppManagerImplBrowserTest,
// Tests that the browser doesn't crash if it gets shutdown with a pending
// installation.
IN_PROC_BROWSER_TEST_P(PendingAppManagerImplBrowserTest,
IN_PROC_BROWSER_TEST_F(PendingAppManagerImplBrowserTest,
ShutdownWithPendingInstallation) {
ASSERT_TRUE(embedded_test_server()->Start());
......@@ -205,7 +189,7 @@ IN_PROC_BROWSER_TEST_P(PendingAppManagerImplBrowserTest,
// installation.
}
IN_PROC_BROWSER_TEST_P(PendingAppManagerImplBrowserTest,
IN_PROC_BROWSER_TEST_F(PendingAppManagerImplBrowserTest,
BypassServiceWorkerCheck) {
ASSERT_TRUE(embedded_test_server()->Start());
GURL url(embedded_test_server()->GetURL(
......@@ -220,7 +204,7 @@ IN_PROC_BROWSER_TEST_P(PendingAppManagerImplBrowserTest,
EXPECT_EQ("Manifest test app", registrar().GetAppShortName(*app_id));
}
IN_PROC_BROWSER_TEST_P(PendingAppManagerImplBrowserTest,
IN_PROC_BROWSER_TEST_F(PendingAppManagerImplBrowserTest,
PerformServiceWorkerCheck) {
ASSERT_TRUE(embedded_test_server()->Start());
GURL url(embedded_test_server()->GetURL(
......@@ -232,7 +216,7 @@ IN_PROC_BROWSER_TEST_P(PendingAppManagerImplBrowserTest,
EXPECT_TRUE(registrar().GetAppScopeInternal(app_id.value()).has_value());
}
IN_PROC_BROWSER_TEST_P(PendingAppManagerImplBrowserTest, ForceReinstall) {
IN_PROC_BROWSER_TEST_F(PendingAppManagerImplBrowserTest, ForceReinstall) {
ASSERT_TRUE(embedded_test_server()->Start());
{
GURL url(embedded_test_server()->GetURL(
......@@ -261,7 +245,7 @@ IN_PROC_BROWSER_TEST_P(PendingAppManagerImplBrowserTest, ForceReinstall) {
// Test that adding a manifest that points to a chrome:// URL does not actually
// install a web app that points to a chrome:// URL.
IN_PROC_BROWSER_TEST_P(PendingAppManagerImplBrowserTest,
IN_PROC_BROWSER_TEST_F(PendingAppManagerImplBrowserTest,
InstallChromeURLFails) {
ASSERT_TRUE(embedded_test_server()->Start());
GURL url(embedded_test_server()->GetURL(
......@@ -281,7 +265,7 @@ IN_PROC_BROWSER_TEST_P(PendingAppManagerImplBrowserTest,
// Test that adding a web app without a manifest while using the
// |require_manifest| flag fails.
IN_PROC_BROWSER_TEST_P(PendingAppManagerImplBrowserTest,
IN_PROC_BROWSER_TEST_F(PendingAppManagerImplBrowserTest,
RequireManifestFailsIfNoManifest) {
ASSERT_TRUE(embedded_test_server()->Start());
GURL url(
......@@ -298,7 +282,7 @@ IN_PROC_BROWSER_TEST_P(PendingAppManagerImplBrowserTest,
ASSERT_FALSE(id.has_value());
}
IN_PROC_BROWSER_TEST_P(PendingAppManagerImplBrowserTest, RegistrationSucceeds) {
IN_PROC_BROWSER_TEST_F(PendingAppManagerImplBrowserTest, RegistrationSucceeds) {
ASSERT_TRUE(embedded_test_server()->Start());
// Delay service worker registration to second load to simulate it not loading
......@@ -317,7 +301,7 @@ IN_PROC_BROWSER_TEST_P(PendingAppManagerImplBrowserTest, RegistrationSucceeds) {
content::ServiceWorkerCapability::SERVICE_WORKER_WITH_FETCH_HANDLER);
}
IN_PROC_BROWSER_TEST_P(PendingAppManagerImplBrowserTest,
IN_PROC_BROWSER_TEST_F(PendingAppManagerImplBrowserTest,
RegistrationAlternateUrlSucceeds) {
ASSERT_TRUE(embedded_test_server()->Start());
......@@ -339,7 +323,7 @@ IN_PROC_BROWSER_TEST_P(PendingAppManagerImplBrowserTest,
content::ServiceWorkerCapability::SERVICE_WORKER_WITH_FETCH_HANDLER);
}
IN_PROC_BROWSER_TEST_P(PendingAppManagerImplBrowserTest, RegistrationSkipped) {
IN_PROC_BROWSER_TEST_F(PendingAppManagerImplBrowserTest, RegistrationSkipped) {
ASSERT_TRUE(embedded_test_server()->Start());
// Delay service worker registration to second load to simulate it not loading
......@@ -359,7 +343,7 @@ IN_PROC_BROWSER_TEST_P(PendingAppManagerImplBrowserTest, RegistrationSkipped) {
content::ServiceWorkerCapability::NO_SERVICE_WORKER);
}
IN_PROC_BROWSER_TEST_P(PendingAppManagerImplBrowserTest, AlreadyRegistered) {
IN_PROC_BROWSER_TEST_F(PendingAppManagerImplBrowserTest, AlreadyRegistered) {
ASSERT_TRUE(embedded_test_server()->Start());
// Ensure service worker registered for http://embedded_test_server/web_apps/.
......@@ -395,7 +379,7 @@ IN_PROC_BROWSER_TEST_P(PendingAppManagerImplBrowserTest, AlreadyRegistered) {
}
}
IN_PROC_BROWSER_TEST_P(PendingAppManagerImplBrowserTest, CannotFetchManifest) {
IN_PROC_BROWSER_TEST_F(PendingAppManagerImplBrowserTest, CannotFetchManifest) {
// With a flaky network connection, clients may request an app whose manifest
// cannot currently be retrieved. The app display mode is then assumed to be
// 'browser'.
......@@ -441,7 +425,7 @@ IN_PROC_BROWSER_TEST_P(PendingAppManagerImplBrowserTest, CannotFetchManifest) {
EXPECT_FALSE(registrar().GetAppThemeColor(*app_id).has_value());
}
IN_PROC_BROWSER_TEST_P(PendingAppManagerImplBrowserTest, RegistrationTimeout) {
IN_PROC_BROWSER_TEST_F(PendingAppManagerImplBrowserTest, RegistrationTimeout) {
ASSERT_TRUE(embedded_test_server()->Start());
PendingAppRegistrationTask::SetTimeoutForTesting(0);
GURL url(embedded_test_server()->GetURL(
......@@ -457,10 +441,4 @@ IN_PROC_BROWSER_TEST_P(PendingAppManagerImplBrowserTest, RegistrationTimeout) {
.AwaitNextRegistration(url, RegistrationResultCode::kTimeout);
}
INSTANTIATE_TEST_SUITE_P(All,
PendingAppManagerImplBrowserTest,
::testing::Values(ProviderType::kBookmarkApps,
ProviderType::kWebApps),
ProviderTypeParamToString);
} // namespace web_app
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