Commit e0d1d22e authored by David Bertoni's avatar David Bertoni Committed by Commit Bot

[Extensions] Use canonical enum for test parameterization.

The ExtensionBrowserTest::ContextType should be used instead of a
custom enum.

Bug: 1100412
Change-Id: I7871b377cfdb134285b1f2c98b87c268a8779bd9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2390663Reviewed-by: default avatarDevlin <rdevlin.cronin@chromium.org>
Commit-Queue: David Bertoni <dbertoni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#805463}
parent f6d48a62
...@@ -148,26 +148,23 @@ class BrowserActionApiCanvasTest : public BrowserActionApiTest { ...@@ -148,26 +148,23 @@ class BrowserActionApiCanvasTest : public BrowserActionApiTest {
} }
}; };
enum class TestVariation { using ContextType = ExtensionBrowserTest::ContextType;
kUseEventPage,
kUseServiceWorker,
};
class BrowserActionApiLazyTest class BrowserActionApiLazyTest
: public BrowserActionApiTest, : public BrowserActionApiTest,
public testing::WithParamInterface<TestVariation> { public testing::WithParamInterface<ContextType> {
public: public:
BrowserActionApiLazyTest() { BrowserActionApiLazyTest() {
// Service Workers are currently only available on certain channels, so set // Service Workers are currently only available on certain channels, so set
// the channel for those tests. // the channel for those tests.
if (GetParam() == TestVariation::kUseServiceWorker) if (GetParam() == ContextType::kServiceWorker)
current_channel_ = std::make_unique<ScopedWorkerBasedExtensionsChannel>(); current_channel_ = std::make_unique<ScopedWorkerBasedExtensionsChannel>();
} }
const extensions::Extension* LoadExtensionWithParamFlags( const extensions::Extension* LoadExtensionWithParamFlags(
const base::FilePath& path) { const base::FilePath& path) {
int flags = kFlagEnableFileAccess; int flags = kFlagEnableFileAccess;
if (GetParam() == TestVariation::kUseServiceWorker) if (GetParam() == ContextType::kServiceWorker)
flags |= ExtensionBrowserTest::kFlagRunAsServiceWorkerBasedExtension; flags |= ExtensionBrowserTest::kFlagRunAsServiceWorkerBasedExtension;
return LoadExtensionWithFlags(path, flags); return LoadExtensionWithFlags(path, flags);
} }
...@@ -247,17 +244,17 @@ IN_PROC_BROWSER_TEST_P(BrowserActionApiLazyTest, Update) { ...@@ -247,17 +244,17 @@ IN_PROC_BROWSER_TEST_P(BrowserActionApiLazyTest, Update) {
IN_PROC_BROWSER_TEST_P(BrowserActionApiLazyTest, UpdateSvg) { IN_PROC_BROWSER_TEST_P(BrowserActionApiLazyTest, UpdateSvg) {
// TODO(crbug.com/1064671): Service Workers currently don't support loading // TODO(crbug.com/1064671): Service Workers currently don't support loading
// SVG images. // SVG images.
const bool expect_failure = GetParam() == TestVariation::kUseServiceWorker; const bool expect_failure = GetParam() == ContextType::kServiceWorker;
ASSERT_NO_FATAL_FAILURE( ASSERT_NO_FATAL_FAILURE(
RunUpdateTest("browser_action/update_svg", expect_failure)); RunUpdateTest("browser_action/update_svg", expect_failure));
} }
INSTANTIATE_TEST_SUITE_P(EventPage, INSTANTIATE_TEST_SUITE_P(EventPage,
BrowserActionApiLazyTest, BrowserActionApiLazyTest,
::testing::Values(TestVariation::kUseEventPage)); ::testing::Values(ContextType::kEventPage));
INSTANTIATE_TEST_SUITE_P(ServiceWorker, INSTANTIATE_TEST_SUITE_P(ServiceWorker,
BrowserActionApiLazyTest, BrowserActionApiLazyTest,
::testing::Values(TestVariation::kUseServiceWorker)); ::testing::Values(ContextType::kServiceWorker));
IN_PROC_BROWSER_TEST_F(BrowserActionApiCanvasTest, DynamicBrowserAction) { IN_PROC_BROWSER_TEST_F(BrowserActionApiCanvasTest, DynamicBrowserAction) {
ASSERT_TRUE(RunExtensionTest("browser_action/no_icon")) << message_; ASSERT_TRUE(RunExtensionTest("browser_action/no_icon")) << message_;
......
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