| 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/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "content/browser/web_contents/web_contents_impl.h" | 9 #include "content/browser/web_contents/web_contents_impl.h" |
| 10 #include "content/public/browser/navigation_handle.h" | 10 #include "content/public/browser/navigation_handle.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 DISALLOW_COPY_AND_ASSIGN(TestWebContentsObserver); | 64 DISALLOW_COPY_AND_ASSIGN(TestWebContentsObserver); |
| 65 }; | 65 }; |
| 66 | 66 |
| 67 TestNavigationObserver::TestNavigationObserver( | 67 TestNavigationObserver::TestNavigationObserver( |
| 68 WebContents* web_contents, | 68 WebContents* web_contents, |
| 69 int number_of_navigations, | 69 int number_of_navigations, |
| 70 MessageLoopRunner::QuitMode quit_mode) | 70 MessageLoopRunner::QuitMode quit_mode) |
| 71 : navigation_started_(false), | 71 : navigation_started_(false), |
| 72 navigations_completed_(0), | 72 navigations_completed_(0), |
| 73 number_of_navigations_(number_of_navigations), | 73 number_of_navigations_(number_of_navigations), |
| 74 last_navigation_succeeded_(false), |
| 74 message_loop_runner_(new MessageLoopRunner(quit_mode)), | 75 message_loop_runner_(new MessageLoopRunner(quit_mode)), |
| 75 web_contents_created_callback_( | 76 web_contents_created_callback_( |
| 76 base::Bind(&TestNavigationObserver::OnWebContentsCreated, | 77 base::Bind(&TestNavigationObserver::OnWebContentsCreated, |
| 77 base::Unretained(this))) { | 78 base::Unretained(this))) { |
| 78 if (web_contents) | 79 if (web_contents) |
| 79 RegisterAsObserver(web_contents); | 80 RegisterAsObserver(web_contents); |
| 80 } | 81 } |
| 81 | 82 |
| 82 TestNavigationObserver::TestNavigationObserver( | 83 TestNavigationObserver::TestNavigationObserver( |
| 83 WebContents* web_contents, | 84 WebContents* web_contents, |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 last_navigation_succeeded_ = false; | 155 last_navigation_succeeded_ = false; |
| 155 } | 156 } |
| 156 | 157 |
| 157 void TestNavigationObserver::OnDidFinishNavigation(bool is_error_page, | 158 void TestNavigationObserver::OnDidFinishNavigation(bool is_error_page, |
| 158 const GURL& url) { | 159 const GURL& url) { |
| 159 last_navigation_url_ = url; | 160 last_navigation_url_ = url; |
| 160 last_navigation_succeeded_ = !is_error_page; | 161 last_navigation_succeeded_ = !is_error_page; |
| 161 } | 162 } |
| 162 | 163 |
| 163 } // namespace content | 164 } // namespace content |
| OLD | NEW |