chrome: Fix CorsTest.RedirectPost307HttpSchemeToCustomNonStandardScheme failure (see issue #2969)

This commit is contained in:
Marshall Greenblatt 2021-04-05 14:49:17 -04:00
parent 09c6586480
commit 1cddbeb12f
2 changed files with 35 additions and 0 deletions

View File

@ -13,6 +13,10 @@ void CreateBrowserDelegates(ClientAppBrowser::DelegateSet& delegates) {
extern void CreateAudioOutputTests(ClientAppBrowser::DelegateSet & delegates);
CreateAudioOutputTests(delegates);
// Bring in the plugin tests.
extern void CreateCorsBrowserTests(ClientAppBrowser::DelegateSet & delegates);
CreateCorsBrowserTests(delegates);
// Bring in the plugin tests.
extern void CreatePluginBrowserTests(ClientAppBrowser::DelegateSet &
delegates);

View File

@ -15,9 +15,34 @@
#include "tests/ceftests/test_request.h"
#include "tests/ceftests/test_server.h"
#include "tests/ceftests/test_util.h"
#include "tests/shared/browser/client_app_browser.h"
namespace {
// Browser-side app delegate.
class CorsBrowserTest : public client::ClientAppBrowser::Delegate {
public:
CorsBrowserTest() {}
void OnContextInitialized(CefRefPtr<client::ClientAppBrowser> app) override {
if (IsChromeRuntimeEnabled()) {
// Disable InsecureFormNavigationThrottle which blocks 307 redirect of
// POST requests from HTTPS to custom non-standard scheme causing the
// CorsTest.RedirectPost307HttpSchemeToCustomNonStandardScheme test to
// fail.
CefRefPtr<CefValue> value = CefValue::Create();
value->SetBool(false);
CefString error;
bool result = CefRequestContext::GetGlobalContext()->SetPreference(
"profile.mixed_forms_warnings", value, error);
CHECK(result) << error.ToString();
}
}
private:
IMPLEMENT_REFCOUNTING(CorsBrowserTest);
};
const char kMimeTypeHtml[] = "text/html";
const char kMimeTypeText[] = "text/plain";
@ -1633,3 +1658,9 @@ void SetupRedirectPostRequest(RedirectMode mode,
// Redirect GET requests.
CORS_TEST_REDIRECT_POST_ALL(302, MODE_302)
CORS_TEST_REDIRECT_POST_ALL(307, MODE_307)
// Entry point for creating plugin browser test objects.
// Called from client_app_delegates.cc.
void CreateCorsBrowserTests(client::ClientAppBrowser::DelegateSet& delegates) {
delegates.insert(new CorsBrowserTest);
}