OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CONTENT_PUBLIC_TEST_NAVIGATION_HANDLE_TESTER_H_ | |
6 #define CONTENT_PUBLIC_TEST_NAVIGATION_HANDLE_TESTER_H_ | |
7 | |
8 #include "content/public/browser/navigation_throttle.h" | |
9 #include "content/public/common/referrer.h" | |
10 #include "ui/base/page_transition_types.h" | |
11 #include "url/gurl.h" | |
12 | |
13 namespace content { | |
14 class NavigationHandle; | |
15 class NavigationThrottle; | |
16 class WebContents; | |
17 | |
18 // This interface allows embedders of content/ to write tests that depend on a | |
19 // test version of NavigationHandle, in particular unit tests that require | |
20 // registering NavigationThrottles. In order to create a | |
21 // NavigationHandleTester, use the static methods provided. | |
nasko
2015/09/04 23:36:49
nit: s/methods/method/ as there is only one.
clamy
2015/09/08 16:27:19
Done.
| |
22 class NavigationHandleTester { | |
23 public: | |
24 // Returns the NavigationHandleTester for |handle|. | |
25 static NavigationHandleTester* For(NavigationHandle* handle); | |
26 | |
27 // Creates a NavigationHandle enabled for testing. | |
28 static NavigationHandle* CreateTestNavigationHandle( | |
29 const GURL& url, | |
30 const GURL& validated_url, | |
31 bool is_main_frame, | |
32 WebContents* web_contents); | |
33 | |
34 // Simulates the network request starting. | |
35 virtual NavigationThrottle::ThrottleCheckResult SimulateWillStartRequest( | |
36 bool is_post, | |
37 const Referrer& sanitized_referrer, | |
38 bool has_user_gesture, | |
39 ui::PageTransition transition, | |
40 bool is_external_protocol) = 0; | |
41 | |
42 // Simulates the network request being redirected. | |
43 virtual NavigationThrottle::ThrottleCheckResult SimulateWillRedirectRequest( | |
44 const GURL& new_url, | |
45 const GURL& new_validated_url, | |
46 bool new_method_is_post, | |
47 const GURL& new_referrer_url, | |
48 bool new_is_external_protocol) = 0; | |
49 }; | |
50 | |
51 } // namespace content | |
52 | |
53 #endif // CONTENT_PUBLIC_TEST_NAVIGATION_HANDLE_TESTER_H_ | |
OLD | NEW |