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 #ifndef CONTENT_TEST_TEST_FRAME_NAVIGATION_OBSERVER_H_ | 5 #ifndef CONTENT_TEST_TEST_FRAME_NAVIGATION_OBSERVER_H_ |
6 #define CONTENT_TEST_TEST_FRAME_NAVIGATION_OBSERVER_H_ | 6 #define CONTENT_TEST_TEST_FRAME_NAVIGATION_OBSERVER_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 // MessageLoop and quit when the navigation in a specific frame completes | 25 // MessageLoop and quit when the navigation in a specific frame completes |
26 // loading. | 26 // loading. |
27 class TestFrameNavigationObserver : public WebContentsObserver { | 27 class TestFrameNavigationObserver : public WebContentsObserver { |
28 public: | 28 public: |
29 // Create and register a new TestFrameNavigationObserver which will track | 29 // Create and register a new TestFrameNavigationObserver which will track |
30 // navigations performed in the specified |node| of the frame tree. | 30 // navigations performed in the specified |node| of the frame tree. |
31 TestFrameNavigationObserver(FrameTreeNode* node, int number_of_navigations); | 31 TestFrameNavigationObserver(FrameTreeNode* node, int number_of_navigations); |
32 // As above but waits for one navigation. | 32 // As above but waits for one navigation. |
33 explicit TestFrameNavigationObserver(FrameTreeNode* node); | 33 explicit TestFrameNavigationObserver(FrameTreeNode* node); |
34 | 34 |
35 virtual ~TestFrameNavigationObserver(); | 35 ~TestFrameNavigationObserver() override; |
36 | 36 |
37 // Runs a nested message loop and blocks until the expected number of | 37 // Runs a nested message loop and blocks until the expected number of |
38 // navigations are complete. | 38 // navigations are complete. |
39 void Wait(); | 39 void Wait(); |
40 | 40 |
41 private: | 41 private: |
42 // WebContentsObserver | 42 // WebContentsObserver |
43 virtual void DidStartProvisionalLoadForFrame( | 43 void DidStartProvisionalLoadForFrame(RenderFrameHost* render_frame_host, |
44 RenderFrameHost* render_frame_host, | 44 const GURL& validated_url, |
45 const GURL& validated_url, | 45 bool is_error_page, |
46 bool is_error_page, | 46 bool is_iframe_srcdoc) override; |
47 bool is_iframe_srcdoc) override; | 47 void DidNavigateAnyFrame(RenderFrameHost* render_frame_host, |
48 virtual void DidNavigateAnyFrame( | 48 const LoadCommittedDetails& details, |
49 RenderFrameHost* render_frame_host, | 49 const FrameNavigateParams& params) override; |
50 const LoadCommittedDetails& details, | |
51 const FrameNavigateParams& params) override; | |
52 | 50 |
53 // The id of the FrameTreeNode in which navigations are peformed. | 51 // The id of the FrameTreeNode in which navigations are peformed. |
54 int frame_tree_node_id_; | 52 int frame_tree_node_id_; |
55 | 53 |
56 // If true the navigation has started. | 54 // If true the navigation has started. |
57 bool navigation_started_; | 55 bool navigation_started_; |
58 | 56 |
59 // The number of navigations that have been completed. | 57 // The number of navigations that have been completed. |
60 int navigations_completed_; | 58 int navigations_completed_; |
61 | 59 |
62 // The number of navigations to wait for. | 60 // The number of navigations to wait for. |
63 int number_of_navigations_; | 61 int number_of_navigations_; |
64 | 62 |
65 // The MessageLoopRunner used to spin the message loop. | 63 // The MessageLoopRunner used to spin the message loop. |
66 scoped_refptr<MessageLoopRunner> message_loop_runner_; | 64 scoped_refptr<MessageLoopRunner> message_loop_runner_; |
67 | 65 |
68 DISALLOW_COPY_AND_ASSIGN(TestFrameNavigationObserver); | 66 DISALLOW_COPY_AND_ASSIGN(TestFrameNavigationObserver); |
69 }; | 67 }; |
70 | 68 |
71 } // namespace content | 69 } // namespace content |
72 | 70 |
73 #endif // CONTENT_TEST_TEST_FRAME_NAVIGATION_OBSERVER_H_ | 71 #endif // CONTENT_TEST_TEST_FRAME_NAVIGATION_OBSERVER_H_ |
OLD | NEW |