| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_navigation_observer.h" | 5 #include "content/public/test/test_navigation_observer.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 base::Bind( | 103 base::Bind( |
| 104 &TestNavigationObserver::OnWebContentsCreated, | 104 &TestNavigationObserver::OnWebContentsCreated, |
| 105 base::Unretained(this))) { | 105 base::Unretained(this))) { |
| 106 if (web_contents) | 106 if (web_contents) |
| 107 RegisterAsObserver(web_contents); | 107 RegisterAsObserver(web_contents); |
| 108 } | 108 } |
| 109 | 109 |
| 110 TestNavigationObserver::~TestNavigationObserver() { | 110 TestNavigationObserver::~TestNavigationObserver() { |
| 111 StopWatchingNewWebContents(); | 111 StopWatchingNewWebContents(); |
| 112 | 112 |
| 113 STLDeleteContainerPointers(web_contents_observers_.begin(), | 113 base::STLDeleteContainerPointers(web_contents_observers_.begin(), |
| 114 web_contents_observers_.end()); | 114 web_contents_observers_.end()); |
| 115 } | 115 } |
| 116 | 116 |
| 117 void TestNavigationObserver::Wait() { | 117 void TestNavigationObserver::Wait() { |
| 118 message_loop_runner_->Run(); | 118 message_loop_runner_->Run(); |
| 119 } | 119 } |
| 120 | 120 |
| 121 void TestNavigationObserver::StartWatchingNewWebContents() { | 121 void TestNavigationObserver::StartWatchingNewWebContents() { |
| 122 WebContentsImpl::FriendZone::AddCreatedCallbackForTesting( | 122 WebContentsImpl::FriendZone::AddCreatedCallbackForTesting( |
| 123 web_contents_created_callback_); | 123 web_contents_created_callback_); |
| 124 } | 124 } |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 | 192 |
| 193 void TestNavigationObserver::OnDidCommitProvisionalLoadForFrame( | 193 void TestNavigationObserver::OnDidCommitProvisionalLoadForFrame( |
| 194 RenderFrameHost* render_frame_host, | 194 RenderFrameHost* render_frame_host, |
| 195 const GURL& url, | 195 const GURL& url, |
| 196 ui::PageTransition transition_type) { | 196 ui::PageTransition transition_type) { |
| 197 last_navigation_url_ = url; | 197 last_navigation_url_ = url; |
| 198 last_navigation_succeeded_ = true; | 198 last_navigation_succeeded_ = true; |
| 199 } | 199 } |
| 200 | 200 |
| 201 } // namespace content | 201 } // namespace content |
| OLD | NEW |