Commit 7b25a148 authored by eseidel@chromium.org's avatar eseidel@chromium.org

Revert of Prepare browser_tests for data: urls being async...

Revert of Prepare browser_tests for data: urls being async (https://codereview.chromium.org/257723002/)

Reason for revert:
This didn't fully solve the issue, no need to add the complexity.

Original issue's description:
> Prepare browser_tests for data: urls being async
> 
> RenderViewTest::LoadHTML assumed that issuing a load
> of a data url, posting a task to quit the message loop
> and then pumping the message loop until it quits was
> sufficient to end up with a fully parsed page.
> 
> That very soon won't be true once we send data: urls
> to the threaded parser, as the parser thread posts
> back to the main thread and may post tasks after the
> quit message.
> https://codereview.chromium.org/210253003/
> 
> Instead I've added a FrameLoadWaiter class which
> implements RenderViewObserver to listen for the
> load event for the frame and only post the quit
> task once the load event had come in.
> 
> BUG=308321
> 
> Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=266163

TBR=abarth@chromium.org,sky@chromium.org
NOTREECHECKS=true
NOTRY=true
BUG=308321

Review URL: https://codereview.chromium.org/252743006

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@266607 0039d316-1c4b-4281-b951-d872f2087c98
parent 61a1b401
...@@ -113,36 +113,16 @@ bool RenderViewTest::ExecuteJavaScriptAndReturnIntValue( ...@@ -113,36 +113,16 @@ bool RenderViewTest::ExecuteJavaScriptAndReturnIntValue(
return true; return true;
} }
class FrameLoadWaiter : public content::RenderViewObserver {
public:
FrameLoadWaiter(RenderView* view, base::MessageLoop* msg_loop)
: content::RenderViewObserver(view),
msg_loop_(msg_loop) {}
virtual void DidFinishLoad(blink::WebLocalFrame* frame) OVERRIDE {
msg_loop_->PostTask(FROM_HERE, base::MessageLoop::QuitClosure());
}
void Wait() {
// We can't just post a quit message here, blink parses on another
// thread and may post additional messages as it parses content.
msg_loop_->Run();
}
private:
base::MessageLoop* msg_loop_;
DISALLOW_COPY_AND_ASSIGN(FrameLoadWaiter);
};
void RenderViewTest::LoadHTML(const char* html) { void RenderViewTest::LoadHTML(const char* html) {
std::string url_str = "data:text/html;charset=utf-8,"; std::string url_str = "data:text/html;charset=utf-8,";
url_str.append(html); url_str.append(html);
GURL url(url_str); GURL url(url_str);
FrameLoadWaiter waiter(view_, &msg_loop_);
GetMainFrame()->loadRequest(WebURLRequest(url)); GetMainFrame()->loadRequest(WebURLRequest(url));
// The load actually happens asynchronously, so we pump messages to process // The load actually happens asynchronously, so we pump messages to process
// the pending continuation. // the pending continuation.
waiter.Wait(); ProcessPendingMessages();
} }
void RenderViewTest::GoBack(const blink::WebHistoryItem& item) { void RenderViewTest::GoBack(const blink::WebHistoryItem& item) {
......
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