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