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

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

Issue 1269813002: Add a NavigationThrottle to the public content/ interface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@navigation-api
Patch Set: Addressed comments Created 5 years, 3 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
(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 method provided.
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 bool is_main_frame,
31 WebContents* web_contents);
32
33 // Simulates the network request starting.
34 virtual NavigationThrottle::ThrottleCheckResult SimulateWillStartRequest(
35 bool is_post,
36 const Referrer& sanitized_referrer,
37 bool has_user_gesture,
38 ui::PageTransition transition,
39 bool is_external_protocol) = 0;
40
41 // Simulates the network request being redirected.
42 virtual NavigationThrottle::ThrottleCheckResult SimulateWillRedirectRequest(
43 const GURL& new_url,
44 bool new_method_is_post,
45 const GURL& new_referrer_url,
46 bool new_is_external_protocol) = 0;
47 };
48
49 } // namespace content
50
51 #endif // CONTENT_PUBLIC_TEST_NAVIGATION_HANDLE_TESTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698