Revert revision 1765 changes due to broken sub-frame loading.

- Move LoadRequest execution to the browser process and use data: URLs for LoadString (issue #579).

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1780 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2014-07-16 21:27:25 +00:00
parent 18f634c11f
commit b34963b743
12 changed files with 370 additions and 282 deletions

View File

@ -145,7 +145,7 @@ class RequestSendRecvTestHandler : public TestHandler {
CreateRequest(request_);
// Create the browser
CreateBrowser("");
CreateBrowser("about:blank");
}
virtual void OnAfterCreated(CefRefPtr<CefBrowser> browser) OVERRIDE {
@ -161,7 +161,7 @@ class RequestSendRecvTestHandler : public TestHandler {
// Verify that the request is the same
TestRequestEqual(request_, request, true);
EXPECT_EQ(RT_MAIN_FRAME, request->GetResourceType());
EXPECT_EQ(request_->GetTransitionType(), request->GetTransitionType());
EXPECT_EQ(TT_LINK, request->GetTransitionType());
got_before_resource_load_.yes();
@ -175,7 +175,7 @@ class RequestSendRecvTestHandler : public TestHandler {
// Verify that the request is the same
TestRequestEqual(request_, request, true);
EXPECT_EQ(RT_MAIN_FRAME, request->GetResourceType());
EXPECT_EQ(request_->GetTransitionType(), request->GetTransitionType());
EXPECT_EQ(TT_LINK, request->GetTransitionType());
got_resource_handler_.yes();
@ -205,64 +205,6 @@ TEST(RequestTest, SendRecv) {
namespace {
class LoadStringTestHandler : public TestHandler,
public CefStringVisitor {
public:
LoadStringTestHandler() {
source_ = "<html><head></head><body>Test</body></html>";
url_ = "http://tests/run.html";
}
virtual void RunTest() OVERRIDE {
CreateBrowser("");
}
virtual void OnAfterCreated(CefRefPtr<CefBrowser> browser) OVERRIDE {
TestHandler::OnAfterCreated(browser);
browser->GetMainFrame()->LoadString(source_, url_);
}
virtual void OnLoadEnd(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefFrame> frame,
int httpStatusCode) OVERRIDE {
EXPECT_EQ(url_, frame->GetURL().ToString());
CefRefPtr<CefStringVisitor> visitor(this);
frame->GetSource(visitor);
got_on_load_end_.yes();
}
virtual void Visit(const CefString& source) OVERRIDE {
EXPECT_EQ(source_, source.ToString());
got_source_.yes();
DestroyTest();
}
std::string source_;
std::string url_;
TrackCallback got_on_load_end_;
TrackCallback got_source_;
private:
IMPLEMENT_REFCOUNTING(LoadStringTestHandler);
};
} // namespace
TEST(RequestTest, LoadStringTest) {
CefRefPtr<LoadStringTestHandler> handler =
new LoadStringTestHandler();
handler->ExecuteTest();
ASSERT_TRUE(handler->got_on_load_end_);
ASSERT_TRUE(handler->got_source_);
}
namespace {
const char kTypeTestCompleteMsg[] = "RequestTest.Type";
const char kTypeTestOrigin[] = "http://tests-requesttt.com/";