Commit cae1f823 authored by Takashi Toyoshima's avatar Takashi Toyoshima Committed by Commit Bot

OOR-CORS: Remove BlinkCORS related tests from ExtensionWebRequestApiTest

This patch modifies tests that see kOutOfBlinkCors feature flag, so
to make them run only with OOR-CORS enabled.

BlinkCors has already been deprecated and this is part of the work
to remove the kOutOfBlinkCors feature work.

Bug: 1053866
Change-Id: I59d3b9c42e61641053cc74aacc99493261ad51fb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2368642
Commit-Queue: Takashi Toyoshima <toyoshim@chromium.org>
Reviewed-by: default avatarKaran Bhatia <karandeepb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#800959}
parent 61543f93
...@@ -60,7 +60,6 @@ ...@@ -60,7 +60,6 @@
#include "chromeos/login/login_state/scoped_test_public_session_login_state.h" #include "chromeos/login/login_state/scoped_test_public_session_login_state.h"
#include "components/embedder_support/switches.h" #include "components/embedder_support/switches.h"
#include "components/google/core/common/google_switches.h" #include "components/google/core/common/google_switches.h"
#include "components/policy/core/browser/browser_policy_connector.h"
#include "components/policy/core/common/mock_configuration_policy_provider.h" #include "components/policy/core/common/mock_configuration_policy_provider.h"
#include "components/policy/policy_constants.h" #include "components/policy/policy_constants.h"
#include "components/prefs/pref_service.h" #include "components/prefs/pref_service.h"
...@@ -628,65 +627,12 @@ IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest, ...@@ -628,65 +627,12 @@ IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest,
<< message_; << message_;
} }
enum class CorsMode { IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest,
kOutOfBlinkCors,
kBlinkCors,
};
class ExtensionWebRequestApiPolicyTest
: public ExtensionWebRequestApiTest,
public ::testing::WithParamInterface<CorsMode> {
public:
const std::string& test_name() { return test_name_; }
private:
void SetUpInProcessBrowserTestFixture() override {
EXPECT_CALL(provider_, IsInitializationComplete(testing::_))
.WillRepeatedly(testing::Return(true));
policy::BrowserPolicyConnector::SetPolicyProviderForTesting(&provider_);
switch (GetParam()) {
case CorsMode::kOutOfBlinkCors:
feature_list_.InitAndEnableFeature(network::features::kOutOfBlinkCors);
test_name_ += "?cors_mode=network_service";
break;
case CorsMode::kBlinkCors:
feature_list_.InitAndDisableFeature(network::features::kOutOfBlinkCors);
test_name_ += "?cors_mode=blink";
break;
}
ExtensionWebRequestApiTest::SetUpInProcessBrowserTestFixture();
}
void UpdatePolicy(const std::string& policy, base::Value value) {
policy::PolicyMap policy_map;
policy_map.Set(policy, policy::POLICY_LEVEL_MANDATORY,
policy::POLICY_SCOPE_USER, policy::POLICY_SOURCE_CLOUD,
std::move(value), nullptr);
provider_.UpdateChromePolicy(policy_map);
}
private:
base::test::ScopedFeatureList feature_list_;
policy::MockConfigurationPolicyProvider provider_;
std::string test_name_ = "test_cors.html";
};
IN_PROC_BROWSER_TEST_P(ExtensionWebRequestApiPolicyTest,
WebRequestCORSWithExtraHeaders) { WebRequestCORSWithExtraHeaders) {
ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(StartEmbeddedTestServer());
ASSERT_TRUE(RunExtensionSubtest("webrequest", test_name())) << message_; ASSERT_TRUE(RunExtensionSubtest("webrequest", "test_cors.html")) << message_;
} }
INSTANTIATE_TEST_SUITE_P(Enabled,
ExtensionWebRequestApiPolicyTest,
testing::Values(CorsMode::kOutOfBlinkCors));
INSTANTIATE_TEST_SUITE_P(Disabled,
ExtensionWebRequestApiPolicyTest,
testing::Values(CorsMode::kBlinkCors));
IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest, WebRequestRedirects) { IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest, WebRequestRedirects) {
ASSERT_TRUE(StartEmbeddedTestServer()); ASSERT_TRUE(StartEmbeddedTestServer());
ASSERT_TRUE(RunExtensionSubtest("webrequest", "test_redirects.html")) ASSERT_TRUE(RunExtensionSubtest("webrequest", "test_redirects.html"))
......
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