| 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 #ifndef CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_ | 5 #ifndef CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_ |
| 6 #define CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_ | 6 #define CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_ |
| 7 | 7 |
| 8 #include <queue> | 8 #include <queue> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 607 public: | 607 public: |
| 608 // Monitors any frame in WebContents. | 608 // Monitors any frame in WebContents. |
| 609 TestNavigationManager(WebContents* web_contents, const GURL& url); | 609 TestNavigationManager(WebContents* web_contents, const GURL& url); |
| 610 | 610 |
| 611 ~TestNavigationManager() override; | 611 ~TestNavigationManager() override; |
| 612 | 612 |
| 613 // Waits until the navigation request is ready to be sent to the network | 613 // Waits until the navigation request is ready to be sent to the network |
| 614 // stack. Returns false if the request was aborted before starting. | 614 // stack. Returns false if the request was aborted before starting. |
| 615 WARN_UNUSED_RESULT bool WaitForWillStartRequest(); | 615 WARN_UNUSED_RESULT bool WaitForWillStartRequest(); |
| 616 | 616 |
| 617 // Waits until the navigation response has been sent received. Returns false | |
| 618 // if the request was aborted before getting a response. | |
| 619 WARN_UNUSED_RESULT bool WaitForWillProcessResponse(); | |
| 620 | |
| 621 // Waits until the navigation has been finished. Will automatically resume | 617 // Waits until the navigation has been finished. Will automatically resume |
| 622 // navigations paused before this point. | 618 // navigations paused before this point. |
| 623 void WaitForNavigationFinished(); | 619 void WaitForNavigationFinished(); |
| 624 | 620 |
| 625 protected: | 621 protected: |
| 626 // Derived classes can override if they want to filter out navigations. This | 622 // Derived classes can override if they want to filter out navigations. This |
| 627 // is called from DidStartNavigation. | 623 // is called from DidStartNavigation. |
| 628 virtual bool ShouldMonitorNavigation(NavigationHandle* handle); | 624 virtual bool ShouldMonitorNavigation(NavigationHandle* handle); |
| 629 | 625 |
| 630 private: | 626 private: |
| 631 // WebContentsObserver: | 627 // WebContentsObserver: |
| 632 void DidStartNavigation(NavigationHandle* handle) override; | 628 void DidStartNavigation(NavigationHandle* handle) override; |
| 633 void DidFinishNavigation(NavigationHandle* handle) override; | 629 void DidFinishNavigation(NavigationHandle* handle) override; |
| 634 | 630 |
| 635 // Called when the NavigationThrottle pauses the navigation in | 631 // Called when the NavigationThrottle pauses the navigation in |
| 636 // WillStartRequest. | 632 // WillStartRequest. |
| 637 void OnWillStartRequest(); | 633 void OnWillStartRequest(); |
| 638 | 634 |
| 639 // Called when the NavigationThrottle pauses the navigation in | |
| 640 // WillProcessResponse. | |
| 641 void OnWillProcessResponse(); | |
| 642 | |
| 643 // Resumes the navigation. | 635 // Resumes the navigation. |
| 644 void ResumeNavigation(); | 636 void ResumeNavigation(); |
| 645 | 637 |
| 646 const GURL url_; | 638 const GURL url_; |
| 647 bool navigation_paused_in_will_start_; | 639 bool navigation_paused_; |
| 648 bool navigation_paused_in_will_process_response_; | |
| 649 NavigationHandle* handle_; | 640 NavigationHandle* handle_; |
| 650 bool handled_navigation_; | 641 bool handled_navigation_; |
| 651 scoped_refptr<MessageLoopRunner> will_start_loop_runner_; | 642 scoped_refptr<MessageLoopRunner> will_start_loop_runner_; |
| 652 scoped_refptr<MessageLoopRunner> will_process_response_loop_runner_; | |
| 653 scoped_refptr<MessageLoopRunner> did_finish_loop_runner_; | 643 scoped_refptr<MessageLoopRunner> did_finish_loop_runner_; |
| 654 | 644 |
| 655 base::WeakPtrFactory<TestNavigationManager> weak_factory_; | 645 base::WeakPtrFactory<TestNavigationManager> weak_factory_; |
| 656 | 646 |
| 657 DISALLOW_COPY_AND_ASSIGN(TestNavigationManager); | 647 DISALLOW_COPY_AND_ASSIGN(TestNavigationManager); |
| 658 }; | 648 }; |
| 659 | 649 |
| 660 } // namespace content | 650 } // namespace content |
| 661 | 651 |
| 662 #endif // CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_ | 652 #endif // CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_ |
| OLD | NEW |