Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / content / public / test / frame_load_waiter.cc
blobc9cee107d590af0a88bde83e11038c0cb3de51b5
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "content/public/test/frame_load_waiter.h"
7 #include "base/location.h"
8 #include "base/single_thread_task_runner.h"
9 #include "base/thread_task_runner_handle.h"
11 namespace content {
13 FrameLoadWaiter::FrameLoadWaiter(RenderFrame* frame)
14 : RenderFrameObserver(frame) {
17 void FrameLoadWaiter::Wait() {
18 // Pump messages until Blink's threaded HTML parser finishes.
19 run_loop_.Run();
22 void FrameLoadWaiter::DidFinishLoad() {
23 // Post a task to quit instead of quitting directly, since the load completion
24 // may trigger other IPCs that tests are expecting.
25 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE,
26 run_loop_.QuitClosure());
29 } // namespace content