Commit e3ae8468 authored by rbpotter's avatar rbpotter Committed by Commit Bot

PDFViewerUpdate: Run ContentSettingJSTests with both flag states

Run the PDFExtensionContentSettingJSTests with the PDFViewerUpdate flag
both enabled and disabled.

These tests already pass with both flag states, so this CL just updates
the tests to take a second parameter, to prevent future regressions.

Bug: 1120279
Change-Id: I0fec604ea79ab9197d7467360e10659989ffae2b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2379401
Commit-Queue: Rebekah Potter <rbpotter@chromium.org>
Reviewed-by: default avatarLei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#802530}
parent 03b3e069
...@@ -974,26 +974,36 @@ INSTANTIATE_TEST_SUITE_P(/* no prefix */, PDFExtensionJSTest, testing::Bool()); ...@@ -974,26 +974,36 @@ INSTANTIATE_TEST_SUITE_P(/* no prefix */, PDFExtensionJSTest, testing::Bool());
class PDFExtensionContentSettingJSTest class PDFExtensionContentSettingJSTest
: public PDFExtensionJSTestBase, : public PDFExtensionJSTestBase,
public testing::WithParamInterface<bool> { public testing::WithParamInterface<std::pair<bool, bool>> {
public: public:
~PDFExtensionContentSettingJSTest() override = default; ~PDFExtensionContentSettingJSTest() override = default;
protected: protected:
const std::vector<base::Feature> GetEnabledFeatures() const override { const std::vector<base::Feature> GetEnabledFeatures() const override {
std::vector<base::Feature> features;
if (ShouldHonorJsContentSettings()) { if (ShouldHonorJsContentSettings()) {
return {chrome_pdf::features::kPdfHonorJsContentSettings}; features.push_back(chrome_pdf::features::kPdfHonorJsContentSettings);
} }
return {}; if (ShouldEnablePDFViewerUpdate()) {
features.push_back(chrome_pdf::features::kPDFViewerUpdate);
}
return features;
} }
const std::vector<base::Feature> GetDisabledFeatures() const override { const std::vector<base::Feature> GetDisabledFeatures() const override {
if (ShouldHonorJsContentSettings()) { std::vector<base::Feature> features;
return {}; if (!ShouldHonorJsContentSettings()) {
features.push_back(chrome_pdf::features::kPdfHonorJsContentSettings);
}
if (!ShouldEnablePDFViewerUpdate()) {
features.push_back(chrome_pdf::features::kPDFViewerUpdate);
} }
return {chrome_pdf::features::kPdfHonorJsContentSettings}; return features;
} }
bool ShouldHonorJsContentSettings() const { return GetParam(); } bool ShouldEnablePDFViewerUpdate() const { return GetParam().first; }
bool ShouldHonorJsContentSettings() const { return GetParam().second; }
// When blocking JavaScript, block the exact query from pdf/main.js while // When blocking JavaScript, block the exact query from pdf/main.js while
// still allowing enough JavaScript to run in the extension for the test // still allowing enough JavaScript to run in the extension for the test
...@@ -1048,7 +1058,10 @@ IN_PROC_BROWSER_TEST_P(PDFExtensionContentSettingJSTest, NoBeepThenBeep) { ...@@ -1048,7 +1058,10 @@ IN_PROC_BROWSER_TEST_P(PDFExtensionContentSettingJSTest, NoBeepThenBeep) {
INSTANTIATE_TEST_SUITE_P(/* no prefix */, INSTANTIATE_TEST_SUITE_P(/* no prefix */,
PDFExtensionContentSettingJSTest, PDFExtensionContentSettingJSTest,
testing::Bool()); testing::ValuesIn({std::make_pair(true, false),
std::make_pair(false, false),
std::make_pair(true, true),
std::make_pair(false, true)}));
// Service worker tests are regression tests for // Service worker tests are regression tests for
// https://crbug.com/916514. // https://crbug.com/916514.
......
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