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_TEST_NAVIGATION_OBSERVER_H_ | 5 #ifndef CONTENT_PUBLIC_TEST_TEST_NAVIGATION_OBSERVER_H_ |
6 #define CONTENT_PUBLIC_TEST_TEST_NAVIGATION_OBSERVER_H_ | 6 #define CONTENT_PUBLIC_TEST_TEST_NAVIGATION_OBSERVER_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 // Run |wait_loop_callback| until complete, then run |done_callback|. | 40 // Run |wait_loop_callback| until complete, then run |done_callback|. |
41 void WaitForObservation(const base::Closure& wait_loop_callback, | 41 void WaitForObservation(const base::Closure& wait_loop_callback, |
42 const base::Closure& done_callback); | 42 const base::Closure& done_callback); |
43 // Convenient version of the above that runs a nested message loop and waits. | 43 // Convenient version of the above that runs a nested message loop and waits. |
44 void Wait(); | 44 void Wait(); |
45 | 45 |
46 protected: | 46 protected: |
47 // Note: |js_injection_ready_observer| is owned by the caller and should be | 47 // Note: |js_injection_ready_observer| is owned by the caller and should be |
48 // valid until this class is destroyed. Subclasses using this constructor MUST | 48 // valid until this class is destroyed. Subclasses using this constructor MUST |
49 // call RegisterAsObserver when a NavigationController becomes available. | 49 // call RegisterAsObserver when a NavigationController becomes available. |
50 explicit TestNavigationObserver( | 50 TestNavigationObserver(JsInjectionReadyObserver* js_injection_ready_observer, |
51 JsInjectionReadyObserver* js_injection_ready_observer, | 51 int number_of_navigations); |
52 int number_of_navigations); | |
53 | 52 |
54 // Register this TestNavigationObserver as an observer of the |source|. | 53 // Register this TestNavigationObserver as an observer of the |source|. |
55 void RegisterAsObserver(const NotificationSource& source); | 54 void RegisterAsObserver(const NotificationSource& source); |
56 | 55 |
57 private: | 56 private: |
58 // NotificationObserver: | 57 // NotificationObserver: |
59 virtual void Observe(int type, const NotificationSource& source, | 58 virtual void Observe(int type, const NotificationSource& source, |
60 const NotificationDetails& details) OVERRIDE; | 59 const NotificationDetails& details) OVERRIDE; |
61 | 60 |
62 NotificationRegistrar registrar_; | 61 NotificationRegistrar registrar_; |
(...skipping 24 matching lines...) Expand all Loading... |
87 // |rvho_send_js_| will hold a RenderViewHostObserver subclass to allow | 86 // |rvho_send_js_| will hold a RenderViewHostObserver subclass to allow |
88 // JavaScript injection at the appropriate time. | 87 // JavaScript injection at the appropriate time. |
89 scoped_ptr<RVHOSendJS> rvho_send_js_; | 88 scoped_ptr<RVHOSendJS> rvho_send_js_; |
90 | 89 |
91 DISALLOW_COPY_AND_ASSIGN(TestNavigationObserver); | 90 DISALLOW_COPY_AND_ASSIGN(TestNavigationObserver); |
92 }; | 91 }; |
93 | 92 |
94 } // namespace content | 93 } // namespace content |
95 | 94 |
96 #endif // CONTENT_PUBLIC_TEST_TEST_NAVIGATION_OBSERVER_H_ | 95 #endif // CONTENT_PUBLIC_TEST_TEST_NAVIGATION_OBSERVER_H_ |
OLD | NEW |