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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: content/public/test/navigation_handle_tester.h
diff --git a/content/public/test/navigation_handle_tester.h b/content/public/test/navigation_handle_tester.h
new file mode 100644
index 0000000000000000000000000000000000000000..8abadae22142df2a7abf78eb3eda260278e33643
--- /dev/null
+++ b/content/public/test/navigation_handle_tester.h
@@ -0,0 +1,53 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_PUBLIC_TEST_NAVIGATION_HANDLE_TESTER_H_
+#define CONTENT_PUBLIC_TEST_NAVIGATION_HANDLE_TESTER_H_
+
+#include "content/public/browser/navigation_throttle.h"
+#include "content/public/common/referrer.h"
+#include "ui/base/page_transition_types.h"
+#include "url/gurl.h"
+
+namespace content {
+class NavigationHandle;
+class NavigationThrottle;
+class WebContents;
+
+// This interface allows embedders of content/ to write tests that depend on a
+// test version of NavigationHandle, in particular unit tests that require
+// registering NavigationThrottles. In order to create a
+// 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.
+class NavigationHandleTester {
+ public:
+ // Returns the NavigationHandleTester for |handle|.
+ static NavigationHandleTester* For(NavigationHandle* handle);
+
+ // Creates a NavigationHandle enabled for testing.
+ static NavigationHandle* CreateTestNavigationHandle(
+ const GURL& url,
+ const GURL& validated_url,
+ bool is_main_frame,
+ WebContents* web_contents);
+
+ // Simulates the network request starting.
+ virtual NavigationThrottle::ThrottleCheckResult SimulateWillStartRequest(
+ bool is_post,
+ const Referrer& sanitized_referrer,
+ bool has_user_gesture,
+ ui::PageTransition transition,
+ bool is_external_protocol) = 0;
+
+ // Simulates the network request being redirected.
+ virtual NavigationThrottle::ThrottleCheckResult SimulateWillRedirectRequest(
+ const GURL& new_url,
+ const GURL& new_validated_url,
+ bool new_method_is_post,
+ const GURL& new_referrer_url,
+ bool new_is_external_protocol) = 0;
+};
+
+} // namespace content
+
+#endif // CONTENT_PUBLIC_TEST_NAVIGATION_HANDLE_TESTER_H_

Powered by Google App Engine
This is Rietveld 408576698