Index: content/public/test/render_view_test.cc |
diff --git a/content/public/test/render_view_test.cc b/content/public/test/render_view_test.cc |
index 94d7b63a584a65695b06cddec76d12479580e28e..24fff071b00b1083b109bffa51a7a577d57e1b95 100644 |
--- a/content/public/test/render_view_test.cc |
+++ b/content/public/test/render_view_test.cc |
@@ -113,16 +113,35 @@ bool RenderViewTest::ExecuteJavaScriptAndReturnIntValue( |
return true; |
} |
+class FrameLoadWaiter : public content::RenderViewObserver { |
+public: |
sky
2014/04/24 23:19:11
indent this and 132 one space (ya, one space, go f
|
+ FrameLoadWaiter(RenderView* view, base::MessageLoop& msg_loop) |
sky
2014/04/24 23:19:11
Only references allowed are to const object. Since
|
+ : content::RenderViewObserver(view), |
sky
2014/04/24 23:19:11
indent this 4 more spaces.
|
+ msg_loop_(msg_loop) { |
+ } |
+ |
+ virtual void DidFinishLoad(blink::WebLocalFrame* frame) { |
sky
2014/04/24 23:19:11
Add 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_; |
+}; |
sky
2014/04/24 23:19:11
Good practice to add DISALLOW_COPY_AND_ASSIGN.
|
+ |
void RenderViewTest::LoadHTML(const char* html) { |
std::string url_str = "data:text/html;charset=utf-8,"; |
url_str.append(html); |
GURL url(url_str); |
- |
+ FrameLoadWaiter waiter(view_, msg_loop_); |
GetMainFrame()->loadRequest(WebURLRequest(url)); |
- |
// The load actually happens asynchronously, so we pump messages to process |
// the pending continuation. |
- ProcessPendingMessages(); |
+ waiter.Wait(); |
} |
void RenderViewTest::GoBack(const blink::WebHistoryItem& item) { |