diff options
Diffstat (limited to 'webkit/plugins')
-rw-r--r-- | webkit/plugins/ppapi/ppb_url_request_info_impl.cc | 10 | ||||
-rw-r--r-- | webkit/plugins/ppapi/ppb_url_request_info_impl.h | 8 | ||||
-rw-r--r-- | webkit/plugins/ppapi/url_request_info_unittest.cc | 26 |
3 files changed, 42 insertions, 2 deletions
diff --git a/webkit/plugins/ppapi/ppb_url_request_info_impl.cc b/webkit/plugins/ppapi/ppb_url_request_info_impl.cc index a3685d3..89cf3c1 100644 --- a/webkit/plugins/ppapi/ppb_url_request_info_impl.cc +++ b/webkit/plugins/ppapi/ppb_url_request_info_impl.cc @@ -200,7 +200,9 @@ PPB_URLRequestInfo_Impl::PPB_URLRequestInfo_Impl(PluginInstance* instance) follow_redirects_(true), record_download_progress_(false), record_upload_progress_(false), - has_custom_referrer_url_(false) { + has_custom_referrer_url_(false), + allow_cross_origin_requests_(false), + allow_credentials_(false) { } PPB_URLRequestInfo_Impl::~PPB_URLRequestInfo_Impl() { @@ -242,6 +244,12 @@ bool PPB_URLRequestInfo_Impl::SetBooleanProperty(PP_URLRequestProperty property, case PP_URLREQUESTPROPERTY_RECORDUPLOADPROGRESS: record_upload_progress_ = value; return true; + case PP_URLREQUESTPROPERTY_ALLOWCROSSORIGINREQUESTS: + allow_cross_origin_requests_ = value; + return true; + case PP_URLREQUESTPROPERTY_ALLOWCREDENTIALS: + allow_credentials_ = value; + return true; default: return false; } diff --git a/webkit/plugins/ppapi/ppb_url_request_info_impl.h b/webkit/plugins/ppapi/ppb_url_request_info_impl.h index a626e86..1b06aa7 100644 --- a/webkit/plugins/ppapi/ppb_url_request_info_impl.h +++ b/webkit/plugins/ppapi/ppb_url_request_info_impl.h @@ -55,6 +55,11 @@ class PPB_URLRequestInfo_Impl : public Resource { bool record_download_progress() const { return record_download_progress_; } bool record_upload_progress() const { return record_upload_progress_; } + bool allow_cross_origin_requests() const { + return allow_cross_origin_requests_; + } + bool allow_credentials() const { return allow_credentials_; } + private: struct BodyItem; typedef std::vector<BodyItem> Body; @@ -76,6 +81,9 @@ class PPB_URLRequestInfo_Impl : public Resource { bool has_custom_referrer_url_; std::string custom_referrer_url_; + bool allow_cross_origin_requests_; + bool allow_credentials_; + DISALLOW_COPY_AND_ASSIGN(PPB_URLRequestInfo_Impl); }; diff --git a/webkit/plugins/ppapi/url_request_info_unittest.cc b/webkit/plugins/ppapi/url_request_info_unittest.cc index c2e2e77..cc56abc 100644 --- a/webkit/plugins/ppapi/url_request_info_unittest.cc +++ b/webkit/plugins/ppapi/url_request_info_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -160,6 +160,30 @@ TEST_F(URLRequestInfoTest, RecordUploadProgress) { ASSERT_FALSE(info_->record_upload_progress()); } +TEST_F(URLRequestInfoTest, AllowCrossOriginRequests) { + ASSERT_FALSE(info_->allow_cross_origin_requests()); + + ASSERT_TRUE(info_->SetBooleanProperty( + PP_URLREQUESTPROPERTY_ALLOWCROSSORIGINREQUESTS, true)); + ASSERT_TRUE(info_->allow_cross_origin_requests()); + + ASSERT_TRUE(info_->SetBooleanProperty( + PP_URLREQUESTPROPERTY_ALLOWCROSSORIGINREQUESTS, false)); + ASSERT_FALSE(info_->allow_cross_origin_requests()); +} + +TEST_F(URLRequestInfoTest, AllowCredentials) { + ASSERT_FALSE(info_->allow_credentials()); + + ASSERT_TRUE(info_->SetBooleanProperty( + PP_URLREQUESTPROPERTY_ALLOWCREDENTIALS, true)); + ASSERT_TRUE(info_->allow_credentials()); + + ASSERT_TRUE(info_->SetBooleanProperty( + PP_URLREQUESTPROPERTY_ALLOWCREDENTIALS, false)); + ASSERT_FALSE(info_->allow_credentials()); +} + TEST_F(URLRequestInfoTest, SetURL) { // Test default URL is "about:blank". ASSERT_TRUE(IsExpected(GetURL(), "about:blank")); |