| Index: content/test/mock_navigation_handle.h
|
| diff --git a/content/test/mock_navigation_handle.h b/content/test/mock_navigation_handle.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..bfd1de7032ae17998d413d0ac30bcd9aeb34bb33
|
| --- /dev/null
|
| +++ b/content/test/mock_navigation_handle.h
|
| @@ -0,0 +1,88 @@
|
| +// Copyright 2017 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_TEST_MOCK_NAVIGATION_HANDLE_H_
|
| +#define CONTENT_TEST_MOCK_NAVIGATION_HANDLE_H_
|
| +
|
| +#include "content/public/browser/global_request_id.h"
|
| +#include "content/public/browser/navigation_handle.h"
|
| +#include "testing/gmock/include/gmock/gmock.h"
|
| +
|
| +namespace content {
|
| +
|
| +// Mock of the navigation handle for unit tests.
|
| +class MockNavigationHandle : public NavigationHandle {
|
| + public:
|
| + MockNavigationHandle();
|
| +
|
| + ~MockNavigationHandle() override;
|
| +
|
| + // NavigationHandle overrides:
|
| + MOCK_METHOD0(GetURL, const GURL&());
|
| + MOCK_METHOD0(GetStartingSiteInstance, SiteInstance*());
|
| + MOCK_METHOD0(IsInMainFrame, bool());
|
| + MOCK_METHOD0(IsParentMainFrame, bool());
|
| + MOCK_METHOD0(IsRendererInitiated, bool());
|
| + MOCK_METHOD0(WasServerRedirect, bool());
|
| + MOCK_METHOD0(GetRedirectChain, const std::vector<GURL>&());
|
| + MOCK_METHOD0(GetFrameTreeNodeId, int());
|
| + MOCK_METHOD0(GetParentFrame, RenderFrameHost*());
|
| + MOCK_METHOD0(NavigationStart, const base::TimeTicks&());
|
| + MOCK_METHOD0(IsPost, bool());
|
| + MOCK_METHOD0(GetReferrer, const Referrer&());
|
| + MOCK_METHOD0(HasUserGesture, bool());
|
| + MOCK_METHOD0(GetPageTransition, ui::PageTransition());
|
| + MOCK_METHOD0(IsExternalProtocol, bool());
|
| + MOCK_METHOD0(GetNetErrorCode, net::Error());
|
| + MOCK_METHOD0(GetRenderFrameHost, RenderFrameHost*());
|
| + MOCK_METHOD0(IsSameDocument, bool());
|
| + MOCK_METHOD0(HasCommitted, bool());
|
| + MOCK_METHOD0(IsErrorPage, bool());
|
| + MOCK_METHOD0(HasSubframeNavigationEntryCommitted, bool());
|
| + MOCK_METHOD0(DidReplaceEntry, bool());
|
| + MOCK_METHOD0(ShouldUpdateHistory, bool());
|
| + MOCK_METHOD0(GetPreviousURL, const GURL&());
|
| + MOCK_METHOD0(GetSocketAddress, net::HostPortPair());
|
| + MOCK_METHOD0(GetResponseHeaders, const net::HttpResponseHeaders*());
|
| + MOCK_METHOD0(GetConnectionInfo, net::HttpResponseInfo::ConnectionInfo());
|
| + MOCK_METHOD0(Resume, void());
|
| + MOCK_METHOD1(CancelDeferredNavigation,
|
| + void(NavigationThrottle::ThrottleCheckResult result));
|
| + void RegisterThrottleForTesting(
|
| + std::unique_ptr<NavigationThrottle> navigation_throttle) override {}
|
| + MOCK_METHOD5(CallWillStartRequestForTesting,
|
| + NavigationThrottle::ThrottleCheckResult(
|
| + bool is_post,
|
| + const Referrer& sanitized_referrer,
|
| + bool has_user_gesture,
|
| + ui::PageTransition transition,
|
| + bool is_external_protocol));
|
| + MOCK_METHOD4(
|
| + CallWillRedirectRequestForTesting,
|
| + NavigationThrottle::ThrottleCheckResult(const GURL& new_url,
|
| + bool new_method_is_post,
|
| + const GURL& new_referrer_url,
|
| + bool new_is_external_protocol));
|
| + MOCK_METHOD2(CallWillProcessResponseForTesting,
|
| + NavigationThrottle::ThrottleCheckResult(
|
| + RenderFrameHost* render_frame_host,
|
| + const std::string& raw_response_header));
|
| + MOCK_METHOD1(CallDidCommitNavigationForTesting, void(const GURL& url));
|
| + MOCK_METHOD0(CallResumeForTesting, void());
|
| + MOCK_CONST_METHOD0(WasStartedFromContextMenu, bool());
|
| + MOCK_METHOD0(GetSearchableFormURL, const GURL&());
|
| + MOCK_METHOD0(GetSearchableFormEncoding, const std::string&());
|
| + MOCK_METHOD0(GetReloadType, ReloadType());
|
| + MOCK_METHOD0(GetRestoreType, RestoreType());
|
| + MOCK_METHOD0(GetBaseURLForDataURL, const GURL&());
|
| + MOCK_METHOD0(GetGlobalRequestID, const GlobalRequestID&());
|
| + MOCK_METHOD0(GetNavigationData, NavigationData*());
|
| +
|
| + private:
|
| + DISALLOW_COPY_AND_ASSIGN(MockNavigationHandle);
|
| +};
|
| +
|
| +} // namespace content
|
| +
|
| +#endif // CONTENT_TEST_MOCK_NAVIGATION_HANDLE_H_
|
|
|