- Add missing files.
- Fix Mac compile errors. git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@185 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
parent
a125c0d964
commit
44ca592cff
|
@ -112,7 +112,7 @@ void CefRequestImpl::Set(const WebKit::WebURLRequest& request)
|
||||||
url_ = request.url().spec().utf16();
|
url_ = request.url().spec().utf16();
|
||||||
method_ = request.httpMethod();
|
method_ = request.httpMethod();
|
||||||
|
|
||||||
WebHTTPBody& body = request.httpBody();
|
const WebHTTPBody& body = request.httpBody();
|
||||||
if (!body.isNull()) {
|
if (!body.isNull()) {
|
||||||
postdata_ = new CefPostDataImpl();
|
postdata_ = new CefPostDataImpl();
|
||||||
static_cast<CefPostDataImpl*>(postdata_.get())->Set(body);
|
static_cast<CefPostDataImpl*>(postdata_.get())->Set(body);
|
||||||
|
|
|
@ -0,0 +1,78 @@
|
||||||
|
// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights
|
||||||
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
|
// can be found in the LICENSE file.
|
||||||
|
//
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// A portion of this file was generated by the CEF translator tool. When
|
||||||
|
// making changes by hand only do so within the body of existing function
|
||||||
|
// implementations. See the translator.README.txt file in the tools directory
|
||||||
|
// for more information.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "libcef_dll/cpptoc/response_cpptoc.h"
|
||||||
|
#include "libcef_dll/transfer_util.h"
|
||||||
|
|
||||||
|
|
||||||
|
// MEMBER FUNCTIONS - Body may be edited by hand.
|
||||||
|
|
||||||
|
int CEF_CALLBACK response_get_status(struct _cef_response_t* self)
|
||||||
|
{
|
||||||
|
DCHECK(self);
|
||||||
|
if(!self)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return CefResponseCppToC::Get(self)->GetStatus();
|
||||||
|
}
|
||||||
|
|
||||||
|
cef_string_userfree_t CEF_CALLBACK response_get_status_text(
|
||||||
|
struct _cef_response_t* self)
|
||||||
|
{
|
||||||
|
DCHECK(self);
|
||||||
|
if(!self)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
CefString text = CefResponseCppToC::Get(self)->GetStatusText();
|
||||||
|
return text.DetachToUserFree();
|
||||||
|
}
|
||||||
|
|
||||||
|
cef_string_userfree_t CEF_CALLBACK response_get_header(
|
||||||
|
struct _cef_response_t* self, const cef_string_t* name)
|
||||||
|
{
|
||||||
|
DCHECK(self);
|
||||||
|
if(!self)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
CefString text = CefResponseCppToC::Get(self)->GetHeader(CefString(name));
|
||||||
|
return text.DetachToUserFree();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CEF_CALLBACK response_get_header_map(struct _cef_response_t* self,
|
||||||
|
cef_string_map_t headerMap)
|
||||||
|
{
|
||||||
|
DCHECK(self);
|
||||||
|
if(!self)
|
||||||
|
return;
|
||||||
|
|
||||||
|
CefResponse::HeaderMap map;
|
||||||
|
CefResponseCppToC::Get(self)->GetHeaderMap(map);
|
||||||
|
transfer_string_map_contents(map, headerMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// CONSTRUCTOR - Do not edit by hand.
|
||||||
|
|
||||||
|
CefResponseCppToC::CefResponseCppToC(CefResponse* cls)
|
||||||
|
: CefCppToC<CefResponseCppToC, CefResponse, cef_response_t>(cls)
|
||||||
|
{
|
||||||
|
struct_.struct_.get_status = response_get_status;
|
||||||
|
struct_.struct_.get_status_text = response_get_status_text;
|
||||||
|
struct_.struct_.get_header = response_get_header;
|
||||||
|
struct_.struct_.get_header_map = response_get_header_map;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
template<> long CefCppToC<CefResponseCppToC, CefResponse,
|
||||||
|
cef_response_t>::DebugObjCt = 0;
|
||||||
|
#endif
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights
|
||||||
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
|
// can be found in the LICENSE file.
|
||||||
|
//
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// This file was generated by the CEF translator tool and should not edited
|
||||||
|
// by hand. See the translator.README.txt file in the tools directory for
|
||||||
|
// more information.
|
||||||
|
//
|
||||||
|
#ifndef _RESPONSE_CPPTOC_H
|
||||||
|
#define _RESPONSE_CPPTOC_H
|
||||||
|
|
||||||
|
#ifndef BUILDING_CEF_SHARED
|
||||||
|
#pragma message("Warning: "__FILE__" may be accessed DLL-side only")
|
||||||
|
#else // BUILDING_CEF_SHARED
|
||||||
|
|
||||||
|
#include "include/cef.h"
|
||||||
|
#include "include/cef_capi.h"
|
||||||
|
#include "libcef_dll/cpptoc/cpptoc.h"
|
||||||
|
|
||||||
|
// Wrap a C++ class with a C structure.
|
||||||
|
// This class may be instantiated and accessed DLL-side only.
|
||||||
|
class CefResponseCppToC
|
||||||
|
: public CefCppToC<CefResponseCppToC, CefResponse, cef_response_t>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CefResponseCppToC(CefResponse* cls);
|
||||||
|
virtual ~CefResponseCppToC() {}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // BUILDING_CEF_SHARED
|
||||||
|
#endif // _RESPONSE_CPPTOC_H
|
||||||
|
|
|
@ -0,0 +1,68 @@
|
||||||
|
// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights
|
||||||
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
|
// can be found in the LICENSE file.
|
||||||
|
//
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// A portion of this file was generated by the CEF translator tool. When
|
||||||
|
// making changes by hand only do so within the body of existing static and
|
||||||
|
// virtual method implementations. See the translator.README.txt file in the
|
||||||
|
// tools directory for more information.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "libcef_dll/ctocpp/response_ctocpp.h"
|
||||||
|
#include "libcef_dll/transfer_util.h"
|
||||||
|
|
||||||
|
|
||||||
|
// VIRTUAL METHODS - Body may be edited by hand.
|
||||||
|
|
||||||
|
int CefResponseCToCpp::GetStatus()
|
||||||
|
{
|
||||||
|
if(CEF_MEMBER_MISSING(struct_, get_status))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return struct_->get_status(struct_);
|
||||||
|
}
|
||||||
|
|
||||||
|
CefString CefResponseCToCpp::GetStatusText()
|
||||||
|
{
|
||||||
|
CefString str;
|
||||||
|
if(CEF_MEMBER_MISSING(struct_, get_status_text))
|
||||||
|
return str;
|
||||||
|
|
||||||
|
cef_string_userfree_t strPtr = struct_->get_status_text(struct_);
|
||||||
|
str.AttachToUserFree(strPtr);
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
|
CefString CefResponseCToCpp::GetHeader(const CefString& name)
|
||||||
|
{
|
||||||
|
CefString str;
|
||||||
|
if(CEF_MEMBER_MISSING(struct_, get_header))
|
||||||
|
return str;
|
||||||
|
|
||||||
|
cef_string_userfree_t strPtr = struct_->get_header(struct_, name.GetStruct());
|
||||||
|
str.AttachToUserFree(strPtr);
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CefResponseCToCpp::GetHeaderMap(HeaderMap& headerMap)
|
||||||
|
{
|
||||||
|
if(CEF_MEMBER_MISSING(struct_, get_header_map))
|
||||||
|
return;
|
||||||
|
|
||||||
|
cef_string_map_t map = cef_string_map_alloc();
|
||||||
|
if(!map)
|
||||||
|
return;
|
||||||
|
|
||||||
|
struct_->get_header_map(struct_, map);
|
||||||
|
transfer_string_map_contents(map, headerMap);
|
||||||
|
cef_string_map_free(map);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
template<> long CefCToCpp<CefResponseCToCpp, CefResponse,
|
||||||
|
cef_response_t>::DebugObjCt = 0;
|
||||||
|
#endif
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights
|
||||||
|
// reserved. Use of this source code is governed by a BSD-style license that
|
||||||
|
// can be found in the LICENSE file.
|
||||||
|
//
|
||||||
|
// -------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// This file was generated by the CEF translator tool and should not edited
|
||||||
|
// by hand. See the translator.README.txt file in the tools directory for
|
||||||
|
// more information.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef _RESPONSE_CTOCPP_H
|
||||||
|
#define _RESPONSE_CTOCPP_H
|
||||||
|
|
||||||
|
#ifndef USING_CEF_SHARED
|
||||||
|
#pragma message("Warning: "__FILE__" may be accessed wrapper-side only")
|
||||||
|
#else // USING_CEF_SHARED
|
||||||
|
|
||||||
|
#include "include/cef.h"
|
||||||
|
#include "include/cef_capi.h"
|
||||||
|
#include "libcef_dll/ctocpp/ctocpp.h"
|
||||||
|
|
||||||
|
// Wrap a C structure with a C++ class.
|
||||||
|
// This class may be instantiated and accessed wrapper-side only.
|
||||||
|
class CefResponseCToCpp
|
||||||
|
: public CefCToCpp<CefResponseCToCpp, CefResponse, cef_response_t>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CefResponseCToCpp(cef_response_t* str)
|
||||||
|
: CefCToCpp<CefResponseCToCpp, CefResponse, cef_response_t>(str) {}
|
||||||
|
virtual ~CefResponseCToCpp() {}
|
||||||
|
|
||||||
|
// CefResponse methods
|
||||||
|
virtual int GetStatus();
|
||||||
|
virtual CefString GetStatusText();
|
||||||
|
virtual CefString GetHeader(const CefString& name);
|
||||||
|
virtual void GetHeaderMap(HeaderMap& headerMap);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // USING_CEF_SHARED
|
||||||
|
#endif // _RESPONSE_CTOCPP_H
|
||||||
|
|
|
@ -54,7 +54,7 @@ public:
|
||||||
// will occur since that state change is never fired.
|
// will occur since that state change is never fired.
|
||||||
BrowserTestHandler(TestResults &tr,
|
BrowserTestHandler(TestResults &tr,
|
||||||
cef_weburlrequest_state_t cancelAtState = WUR_STATE_UNSENT):
|
cef_weburlrequest_state_t cancelAtState = WUR_STATE_UNSENT):
|
||||||
test_results_(tr), cancelAtState_(cancelAtState) { }
|
cancelAtState_(cancelAtState), test_results_(tr) { }
|
||||||
|
|
||||||
virtual void RunTest()
|
virtual void RunTest()
|
||||||
{
|
{
|
||||||
|
@ -94,7 +94,7 @@ class TestWebURLRequestClient:
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TestWebURLRequestClient(TestResults& tr, BrowserTestHandler* browser):
|
TestWebURLRequestClient(TestResults& tr, BrowserTestHandler* browser):
|
||||||
test_results_(tr), browser_(browser), cancelAtState_(WUR_STATE_UNSENT)
|
test_results_(tr), cancelAtState_(WUR_STATE_UNSENT), browser_(browser)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -151,6 +151,8 @@ public:
|
||||||
test_results_.got_abort.yes();
|
test_results_.got_abort.yes();
|
||||||
TestCompleted();
|
TestCompleted();
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -290,7 +292,7 @@ TEST(WebURLRequestTest, GET)
|
||||||
};
|
};
|
||||||
|
|
||||||
TestResults tr;
|
TestResults tr;
|
||||||
CefRefPtr<BrowserForTest> browser = new BrowserForTest(tr);
|
CefRefPtr<BrowserTestHandler> browser = new BrowserForTest(tr);
|
||||||
browser->ExecuteTest();
|
browser->ExecuteTest();
|
||||||
|
|
||||||
EXPECT_TRUE(tr.got_started);
|
EXPECT_TRUE(tr.got_started);
|
||||||
|
@ -353,7 +355,7 @@ TEST(WebURLRequestTest, POST)
|
||||||
};
|
};
|
||||||
|
|
||||||
TestResults tr;
|
TestResults tr;
|
||||||
CefRefPtr<BrowserForTest> browser = new BrowserForTest(tr);
|
CefRefPtr<BrowserTestHandler> browser = new BrowserForTest(tr);
|
||||||
browser->ExecuteTest();
|
browser->ExecuteTest();
|
||||||
|
|
||||||
EXPECT_TRUE(tr.got_started);
|
EXPECT_TRUE(tr.got_started);
|
||||||
|
@ -404,7 +406,7 @@ TEST(WebURLRequestTest, BADHOST)
|
||||||
};
|
};
|
||||||
|
|
||||||
TestResults tr;
|
TestResults tr;
|
||||||
CefRefPtr<BrowserForTest> browser = new BrowserForTest(tr);
|
CefRefPtr<BrowserTestHandler> browser = new BrowserForTest(tr);
|
||||||
browser->ExecuteTest();
|
browser->ExecuteTest();
|
||||||
|
|
||||||
// NOTE: THIS TEST WILL FAIL IF YOUR ISP REDIRECTS YOU TO
|
// NOTE: THIS TEST WILL FAIL IF YOUR ISP REDIRECTS YOU TO
|
||||||
|
@ -469,9 +471,9 @@ TEST(WebURLRequestTest, CANCEL)
|
||||||
WUR_STATE_LOADING
|
WUR_STATE_LOADING
|
||||||
};
|
};
|
||||||
|
|
||||||
for (int i=0; i < COUNTOF_(cancelAt); ++i) {
|
for (unsigned int i=0; i < COUNTOF_(cancelAt); ++i) {
|
||||||
TestResults tr;
|
TestResults tr;
|
||||||
CefRefPtr<BrowserForTest> browser = new BrowserForTest(tr, cancelAt[i]);
|
CefRefPtr<BrowserTestHandler> browser = new BrowserForTest(tr, cancelAt[i]);
|
||||||
browser->ExecuteTest();
|
browser->ExecuteTest();
|
||||||
EXPECT_TRUE(tr.got_abort);
|
EXPECT_TRUE(tr.got_abort);
|
||||||
EXPECT_TRUE(tr.got_deleted);
|
EXPECT_TRUE(tr.got_deleted);
|
||||||
|
|
Loading…
Reference in New Issue