| Index: content/public/test/browser_side_navigation_test_utils.h
|
| diff --git a/content/public/test/browser_side_navigation_test_utils.h b/content/public/test/browser_side_navigation_test_utils.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..7e4b50faa040a718d848b048ecddced57295aaa0
|
| --- /dev/null
|
| +++ b/content/public/test/browser_side_navigation_test_utils.h
|
| @@ -0,0 +1,56 @@
|
| +// Copyright 2014 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_BROWSER_SIDE_NAVIGATION_TEST_UTILS_H_
|
| +#define CONTENT_PUBLIC_TEST_BROWSER_SIDE_NAVIGATION_TEST_UTILS_H_
|
| +
|
| +#include <memory>
|
| +
|
| +#include "base/macros.h"
|
| +
|
| +namespace content {
|
| +
|
| +class RenderFrameHost;
|
| +class StreamHandle;
|
| +
|
| +// Initializes the browser side navigation test utils. Following this call, all
|
| +// NavigationURLLoader objects created will be TestNavigationURLLoaders instead
|
| +// of NavigationURLloaderImpls. This should be called before any call in the UI
|
| +// thread unit tests that will start a navigation (eg.
|
| +// TestWebContents::NavigateAndCommit).
|
| +void BrowserSideNavigationSetUp();
|
| +
|
| +// Tears down the browser side navigation test utils.
|
| +void BrowserSideNavigationTearDown();
|
| +
|
| +// Returns an empty stream. Used when faking a navigation commit notification
|
| +// from the IO thread with a TestNavigationURLLoader.
|
| +std::unique_ptr<StreamHandle> MakeEmptyStream();
|
| +
|
| +// If a test needs to run with browser side navigation enabled, call this
|
| +// function before doing any setup. In particular, for tests inheriting from
|
| +// RenderViewHostTestHarness, call this function before calling
|
| +// RenderViewHostTestHarness::SetUp.
|
| +void EnableBrowserSideNavigation();
|
| +
|
| +// If we are doing a cross-site navigation, this simulates the current RFH
|
| +// notifying that it has unloaded so the pending RFH is resumed and can
|
| +// navigate.
|
| +// PlzNavigate: the pending RFH is not created before the navigation commit,
|
| +// so it is necessary to simulate the IO thread response here to commit in the
|
| +// proper renderer. It is necessary to call PrepareForCommit before getting
|
| +// the main and the pending frame because when we are trying to navigate to a
|
| +// webui from a new tab, a RenderFrameHost is created to display it that is
|
| +// committed immediately (since it is a new tab). Therefore the main frame is
|
| +// replaced without a pending frame being created, and we don't get the right
|
| +// values for the RFH to navigate: we try to use the old one that has been
|
| +// deleted in the meantime.
|
| +// Note that for some synchronous navigations (about:blank, javascript
|
| +// urls, etc.) there will be no NavigationRequest, and no simulation of the
|
| +// network stack is required.
|
| +void SimulateCurrentRenderFrameHostUnloading(RenderFrameHost* rfh);
|
| +
|
| +} // namespace content
|
| +
|
| +#endif // CONTENT_PUBLIC_TEST_BROWSER_SIDE_NAVIGATION_TEST_UTILS_H_
|
|
|