| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/public/test/test_frame_navigation_observer.h" | 5 #include "content/public/test/test_frame_navigation_observer.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 } // namespace | 26 } // namespace |
| 27 | 27 |
| 28 TestFrameNavigationObserver::TestFrameNavigationObserver( | 28 TestFrameNavigationObserver::TestFrameNavigationObserver( |
| 29 const ToRenderFrameHost& adapter) | 29 const ToRenderFrameHost& adapter) |
| 30 : WebContentsObserver( | 30 : WebContentsObserver( |
| 31 ToRenderFrameHostImpl(adapter)->delegate()->GetAsWebContents()), | 31 ToRenderFrameHostImpl(adapter)->delegate()->GetAsWebContents()), |
| 32 frame_tree_node_id_(ToRenderFrameHostImpl(adapter)->GetFrameTreeNodeId()), | 32 frame_tree_node_id_(ToRenderFrameHostImpl(adapter)->GetFrameTreeNodeId()), |
| 33 navigation_started_(false), | 33 navigation_started_(false), |
| 34 has_committed_(false), | 34 has_committed_(false), |
| 35 wait_for_commit_(false), | 35 wait_for_commit_(false), |
| 36 message_loop_runner_(new MessageLoopRunner) { | 36 message_loop_runner_( |
| 37 new MessageLoopRunner(MessageLoopRunner::QuitMode::IMMEDIATE)) { |
| 37 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 38 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 38 } | 39 } |
| 39 | 40 |
| 40 TestFrameNavigationObserver::~TestFrameNavigationObserver() {} | 41 TestFrameNavigationObserver::~TestFrameNavigationObserver() {} |
| 41 | 42 |
| 42 void TestFrameNavigationObserver::Wait() { | 43 void TestFrameNavigationObserver::Wait() { |
| 43 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 44 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 44 wait_for_commit_ = false; | 45 wait_for_commit_ = false; |
| 45 message_loop_runner_->Run(); | 46 message_loop_runner_->Run(); |
| 46 } | 47 } |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 | 88 |
| 88 void TestFrameNavigationObserver::DidStopLoading() { | 89 void TestFrameNavigationObserver::DidStopLoading() { |
| 89 if (!navigation_started_) | 90 if (!navigation_started_) |
| 90 return; | 91 return; |
| 91 | 92 |
| 92 navigation_started_ = false; | 93 navigation_started_ = false; |
| 93 message_loop_runner_->Quit(); | 94 message_loop_runner_->Quit(); |
| 94 } | 95 } |
| 95 | 96 |
| 96 } // namespace content | 97 } // namespace content |
| OLD | NEW |