| 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/test/content_browser_test_utils_internal.h" | 5 #include "content/test/content_browser_test_utils_internal.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 loop_runner_ = new MessageLoopRunner(); | 390 loop_runner_ = new MessageLoopRunner(); |
| 391 loop_runner_->Run(); | 391 loop_runner_->Run(); |
| 392 loop_runner_ = nullptr; | 392 loop_runner_ = nullptr; |
| 393 } | 393 } |
| 394 | 394 |
| 395 void TestNavigationManager::DidStartNavigation(NavigationHandle* handle) { | 395 void TestNavigationManager::DidStartNavigation(NavigationHandle* handle) { |
| 396 if (handle_ || handle->GetURL() != url_) | 396 if (handle_ || handle->GetURL() != url_) |
| 397 return; | 397 return; |
| 398 | 398 |
| 399 handle_ = handle; | 399 handle_ = handle; |
| 400 scoped_ptr<NavigationThrottle> throttle(new TestNavigationManagerThrottle( | 400 std::unique_ptr<NavigationThrottle> throttle( |
| 401 handle_, base::Bind(&TestNavigationManager::OnWillStartRequest, | 401 new TestNavigationManagerThrottle( |
| 402 weak_factory_.GetWeakPtr()))); | 402 handle_, base::Bind(&TestNavigationManager::OnWillStartRequest, |
| 403 weak_factory_.GetWeakPtr()))); |
| 403 handle_->RegisterThrottleForTesting(std::move(throttle)); | 404 handle_->RegisterThrottleForTesting(std::move(throttle)); |
| 404 } | 405 } |
| 405 | 406 |
| 406 void TestNavigationManager::DidFinishNavigation(NavigationHandle* handle) { | 407 void TestNavigationManager::DidFinishNavigation(NavigationHandle* handle) { |
| 407 if (handle != handle_) | 408 if (handle != handle_) |
| 408 return; | 409 return; |
| 409 handle_ = nullptr; | 410 handle_ = nullptr; |
| 410 navigation_paused_ = false; | 411 navigation_paused_ = false; |
| 411 if (loop_runner_) | 412 if (loop_runner_) |
| 412 loop_runner_->Quit(); | 413 loop_runner_->Quit(); |
| 413 } | 414 } |
| 414 | 415 |
| 415 void TestNavigationManager::OnWillStartRequest() { | 416 void TestNavigationManager::OnWillStartRequest() { |
| 416 navigation_paused_ = true; | 417 navigation_paused_ = true; |
| 417 if (loop_runner_) | 418 if (loop_runner_) |
| 418 loop_runner_->Quit(); | 419 loop_runner_->Quit(); |
| 419 } | 420 } |
| 420 | 421 |
| 421 } // namespace content | 422 } // namespace content |
| OLD | NEW |