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

Desktop PWAs: WebFileTasksTest cleanup

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

Bug: 1065748
Change-Id: Iafe781bd9b2b21e725cbba5b1f20033bec483fd7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2455511
Auto-Submit: Eric Willigers <ericwilligers@chromium.org>
Commit-Queue: Joel Hockey <joelhockey@chromium.org>
Reviewed-by: default avatarJoel Hockey <joelhockey@chromium.org>
Cr-Commit-Position: refs/heads/master@{#814881}
parent 0ec64532
...@@ -17,8 +17,6 @@ ...@@ -17,8 +17,6 @@
#include "chrome/browser/web_applications/test/test_file_handler_manager.h" #include "chrome/browser/web_applications/test/test_file_handler_manager.h"
#include "chrome/browser/web_applications/test/test_os_integration_manager.h" #include "chrome/browser/web_applications/test/test_os_integration_manager.h"
#include "chrome/browser/web_applications/test/test_web_app_provider.h" #include "chrome/browser/web_applications/test/test_web_app_provider.h"
#include "chrome/browser/web_applications/test/web_app_test.h"
#include "chrome/common/chrome_features.h"
#include "chrome/test/base/testing_profile.h" #include "chrome/test/base/testing_profile.h"
#include "content/public/test/browser_task_environment.h" #include "content/public/test/browser_task_environment.h"
#include "extensions/browser/entry_info.h" #include "extensions/browser/entry_info.h"
...@@ -26,21 +24,12 @@ ...@@ -26,21 +24,12 @@
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "third_party/blink/public/common/features.h" #include "third_party/blink/public/common/features.h"
using web_app::ProviderType;
namespace file_manager { namespace file_manager {
namespace file_tasks { namespace file_tasks {
class WebFileTasksTest : public ::testing::TestWithParam<ProviderType> { class WebFileTasksTest : public ::testing::Test {
protected: protected:
WebFileTasksTest() { WebFileTasksTest() {
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);
}
} }
void SetUp() override { void SetUp() override {
...@@ -78,7 +67,6 @@ class WebFileTasksTest : public ::testing::TestWithParam<ProviderType> { ...@@ -78,7 +67,6 @@ class WebFileTasksTest : public ::testing::TestWithParam<ProviderType> {
} }
private: private:
base::test::ScopedFeatureList scoped_feature_list_;
content::BrowserTaskEnvironment task_environment_; content::BrowserTaskEnvironment task_environment_;
std::unique_ptr<TestingProfile> profile_; std::unique_ptr<TestingProfile> profile_;
web_app::TestWebAppProvider* app_provider_; web_app::TestWebAppProvider* app_provider_;
...@@ -86,7 +74,7 @@ class WebFileTasksTest : public ::testing::TestWithParam<ProviderType> { ...@@ -86,7 +74,7 @@ class WebFileTasksTest : public ::testing::TestWithParam<ProviderType> {
web_app::TestFileHandlerManager* file_handler_manager_; web_app::TestFileHandlerManager* file_handler_manager_;
}; };
TEST_P(WebFileTasksTest, WebAppFileHandlingCanBeDisabledByFlag) { TEST_F(WebFileTasksTest, WebAppFileHandlingCanBeDisabledByFlag) {
const char kGraphrId[] = "graphr-app-id"; const char kGraphrId[] = "graphr-app-id";
const char kGraphrAction[] = "https://graphr.tld/csv"; const char kGraphrAction[] = "https://graphr.tld/csv";
InstallFileHandler(kGraphrId, GURL(kGraphrAction), {{"text/csv", {".csv"}}}); InstallFileHandler(kGraphrId, GURL(kGraphrAction), {{"text/csv", {".csv"}}});
...@@ -130,7 +118,7 @@ TEST_P(WebFileTasksTest, WebAppFileHandlingCanBeDisabledByFlag) { ...@@ -130,7 +118,7 @@ TEST_P(WebFileTasksTest, WebAppFileHandlingCanBeDisabledByFlag) {
} }
} }
TEST_P(WebFileTasksTest, DisabledFileHandlersAreNotVisible) { TEST_F(WebFileTasksTest, DisabledFileHandlersAreNotVisible) {
const char kGraphrId[] = "graphr-app-id"; const char kGraphrId[] = "graphr-app-id";
const char kGraphrAction[] = "https://graphr.tld/csv"; const char kGraphrAction[] = "https://graphr.tld/csv";
...@@ -165,7 +153,7 @@ TEST_P(WebFileTasksTest, DisabledFileHandlersAreNotVisible) { ...@@ -165,7 +153,7 @@ TEST_P(WebFileTasksTest, DisabledFileHandlersAreNotVisible) {
EXPECT_EQ(kFooId, tasks[0].task_descriptor().app_id); EXPECT_EQ(kFooId, tasks[0].task_descriptor().app_id);
} }
TEST_P(WebFileTasksTest, FindWebFileHandlerTasks) { TEST_F(WebFileTasksTest, FindWebFileHandlerTasks) {
base::test::ScopedFeatureList scoped_feature_list; base::test::ScopedFeatureList scoped_feature_list;
scoped_feature_list.InitWithFeatures({blink::features::kFileHandlingAPI}, {}); scoped_feature_list.InitWithFeatures({blink::features::kFileHandlingAPI}, {});
const char kFooId[] = "foo-app-id"; const char kFooId[] = "foo-app-id";
...@@ -213,7 +201,7 @@ TEST_P(WebFileTasksTest, FindWebFileHandlerTasks) { ...@@ -213,7 +201,7 @@ TEST_P(WebFileTasksTest, FindWebFileHandlerTasks) {
FindWebTasks(profile(), entries, &tasks); FindWebTasks(profile(), entries, &tasks);
} }
TEST_P(WebFileTasksTest, FindWebFileHandlerTask_Generic) { TEST_F(WebFileTasksTest, FindWebFileHandlerTask_Generic) {
base::test::ScopedFeatureList scoped_feature_list; base::test::ScopedFeatureList scoped_feature_list;
scoped_feature_list.InitWithFeatures({blink::features::kFileHandlingAPI}, {}); scoped_feature_list.InitWithFeatures({blink::features::kFileHandlingAPI}, {});
...@@ -296,11 +284,5 @@ TEST_P(WebFileTasksTest, FindWebFileHandlerTask_Generic) { ...@@ -296,11 +284,5 @@ TEST_P(WebFileTasksTest, FindWebFileHandlerTask_Generic) {
EXPECT_TRUE(tasks[2].is_generic_file_handler()); EXPECT_TRUE(tasks[2].is_generic_file_handler());
} }
INSTANTIATE_TEST_SUITE_P(All,
WebFileTasksTest,
::testing::Values(ProviderType::kBookmarkApps,
ProviderType::kWebApps),
web_app::ProviderTypeParamToString);
} // namespace file_tasks } // namespace file_tasks
} // namespace file_manager } // namespace file_manager
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