Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(167)

Side by Side Diff: content/public/test/navigation_simulator.h

Issue 2897613002: Revert of [subresource_filter] Remove Forwarding NavigationThrottles (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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_NAVIGATION_SIMULATOR_H_ 5 #ifndef CONTENT_PUBLIC_TEST_NAVIGATION_SIMULATOR_H_
6 #define CONTENT_PUBLIC_TEST_NAVIGATION_SIMULATOR_H_ 6 #define CONTENT_PUBLIC_TEST_NAVIGATION_SIMULATOR_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/optional.h" 11 #include "base/optional.h"
12 #include "content/public/browser/navigation_throttle.h" 12 #include "content/public/browser/navigation_throttle.h"
13 #include "content/public/browser/web_contents_observer.h" 13 #include "content/public/browser/web_contents_observer.h"
14 #include "content/public/common/referrer.h" 14 #include "content/public/common/referrer.h"
15 #include "content/public/test/navigation_simulator.h" 15 #include "content/public/test/navigation_simulator.h"
16 #include "ui/base/page_transition_types.h" 16 #include "ui/base/page_transition_types.h"
17 17
18 class GURL; 18 class GURL;
19 19
20 namespace content { 20 namespace content {
21 21
22 class NavigationHandle;
23 class NavigationHandleImpl; 22 class NavigationHandleImpl;
24 class RenderFrameHost; 23 class RenderFrameHost;
25 class TestRenderFrameHost; 24 class TestRenderFrameHost;
26 struct Referrer; 25 struct Referrer;
27 26
28 // An interface for simulating a navigation in unit tests. Currently this only 27 // An interface for simulating a navigation in unit tests. Currently this only
29 // supports renderer-initiated navigations. 28 // supports renderer-initiated navigations.
30 // Note: this should not be used in browser tests. 29 // Note: this should not be used in browser tests.
31 // TODO(clamy): support browser-initiated navigations. 30 // TODO(clamy): support browser-initiated navigations.
32 class NavigationSimulator : public WebContentsObserver { 31 class NavigationSimulator : public WebContentsObserver {
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 // The following parameters can change during redirects. They should be 138 // The following parameters can change during redirects. They should be
140 // specified before calling |Start| if they need to apply to the navigation to 139 // specified before calling |Start| if they need to apply to the navigation to
141 // the original url. Otherwise, they should be specified before calling 140 // the original url. Otherwise, they should be specified before calling
142 // |Redirect|. 141 // |Redirect|.
143 virtual void SetReferrer(const Referrer& referrer); 142 virtual void SetReferrer(const Referrer& referrer);
144 143
145 // Gets the last throttle check result computed by the navigation throttles. 144 // Gets the last throttle check result computed by the navigation throttles.
146 // It is an error to call this before Start() is called. 145 // It is an error to call this before Start() is called.
147 virtual NavigationThrottle::ThrottleCheckResult GetLastThrottleCheckResult(); 146 virtual NavigationThrottle::ThrottleCheckResult GetLastThrottleCheckResult();
148 147
149 // Returns the NavigationHandle associated with the navigation being
150 // simulated. It is an error to call this before Start() or after the
151 // navigation has finished (successfully or not).
152 virtual NavigationHandle* GetNavigationHandle() const;
153
154 private: 148 private:
155 // WebContentsObserver: 149 // WebContentsObserver:
156 void DidStartNavigation(NavigationHandle* navigation_handle) override; 150 void DidStartNavigation(NavigationHandle* navigation_handle) override;
157 void DidRedirectNavigation(NavigationHandle* navigation_handle) override; 151 void DidRedirectNavigation(NavigationHandle* navigation_handle) override;
158 void ReadyToCommitNavigation(NavigationHandle* navigation_handle) override; 152 void ReadyToCommitNavigation(NavigationHandle* navigation_handle) override;
159 void DidFinishNavigation(NavigationHandle* navigation_handle) override; 153 void DidFinishNavigation(NavigationHandle* navigation_handle) override;
160 154
161 void OnWillStartRequest(); 155 void OnWillStartRequest();
162 void OnWillRedirectRequest(); 156 void OnWillRedirectRequest();
163 void OnWillProcessResponse(); 157 void OnWillProcessResponse();
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 209
216 // Closure that is set when WaitForThrottleChecksComplete is called. 210 // Closure that is set when WaitForThrottleChecksComplete is called.
217 base::Closure throttle_checks_wait_closure_; 211 base::Closure throttle_checks_wait_closure_;
218 212
219 base::WeakPtrFactory<NavigationSimulator> weak_factory_; 213 base::WeakPtrFactory<NavigationSimulator> weak_factory_;
220 }; 214 };
221 215
222 } // namespace content 216 } // namespace content
223 217
224 #endif // CONTENT_PUBLIC_TEST_NAVIGATION_SIMULATOR_H_ 218 #endif // CONTENT_PUBLIC_TEST_NAVIGATION_SIMULATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698