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

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

Issue 2889913002: [subresource_filter] Remove Forwarding NavigationThrottles (Closed)
Patch Set: shivanisha review 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;
22 class NavigationHandleImpl; 23 class NavigationHandleImpl;
23 class RenderFrameHost; 24 class RenderFrameHost;
24 class TestRenderFrameHost; 25 class TestRenderFrameHost;
25 struct Referrer; 26 struct Referrer;
26 27
27 // An interface for simulating a navigation in unit tests. Currently this only 28 // An interface for simulating a navigation in unit tests. Currently this only
28 // supports renderer-initiated navigations. 29 // supports renderer-initiated navigations.
29 // Note: this should not be used in browser tests. 30 // Note: this should not be used in browser tests.
30 // TODO(clamy): support browser-initiated navigations. 31 // TODO(clamy): support browser-initiated navigations.
31 class NavigationSimulator : public WebContentsObserver { 32 class NavigationSimulator : public WebContentsObserver {
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 // The following parameters can change during redirects. They should be 139 // The following parameters can change during redirects. They should be
139 // specified before calling |Start| if they need to apply to the navigation to 140 // specified before calling |Start| if they need to apply to the navigation to
140 // the original url. Otherwise, they should be specified before calling 141 // the original url. Otherwise, they should be specified before calling
141 // |Redirect|. 142 // |Redirect|.
142 virtual void SetReferrer(const Referrer& referrer); 143 virtual void SetReferrer(const Referrer& referrer);
143 144
144 // Gets the last throttle check result computed by the navigation throttles. 145 // Gets the last throttle check result computed by the navigation throttles.
145 // It is an error to call this before Start() is called. 146 // It is an error to call this before Start() is called.
146 virtual NavigationThrottle::ThrottleCheckResult GetLastThrottleCheckResult(); 147 virtual NavigationThrottle::ThrottleCheckResult GetLastThrottleCheckResult();
147 148
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
148 private: 154 private:
149 // WebContentsObserver: 155 // WebContentsObserver:
150 void DidStartNavigation(NavigationHandle* navigation_handle) override; 156 void DidStartNavigation(NavigationHandle* navigation_handle) override;
151 void DidRedirectNavigation(NavigationHandle* navigation_handle) override; 157 void DidRedirectNavigation(NavigationHandle* navigation_handle) override;
152 void ReadyToCommitNavigation(NavigationHandle* navigation_handle) override; 158 void ReadyToCommitNavigation(NavigationHandle* navigation_handle) override;
153 void DidFinishNavigation(NavigationHandle* navigation_handle) override; 159 void DidFinishNavigation(NavigationHandle* navigation_handle) override;
154 160
155 void OnWillStartRequest(); 161 void OnWillStartRequest();
156 void OnWillRedirectRequest(); 162 void OnWillRedirectRequest();
157 void OnWillProcessResponse(); 163 void OnWillProcessResponse();
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 215
210 // Closure that is set when WaitForThrottleChecksComplete is called. 216 // Closure that is set when WaitForThrottleChecksComplete is called.
211 base::Closure throttle_checks_wait_closure_; 217 base::Closure throttle_checks_wait_closure_;
212 218
213 base::WeakPtrFactory<NavigationSimulator> weak_factory_; 219 base::WeakPtrFactory<NavigationSimulator> weak_factory_;
214 }; 220 };
215 221
216 } // namespace content 222 } // namespace content
217 223
218 #endif // CONTENT_PUBLIC_TEST_NAVIGATION_SIMULATOR_H_ 224 #endif // CONTENT_PUBLIC_TEST_NAVIGATION_SIMULATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698