summaryrefslogtreecommitdiffstats
path: root/content/test/browser_side_navigation_test_utils.h
blob: a2daa6e1bd308b88c5f7ffe6d74de9d30d5eacd9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// 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_TEST_BROWSER_SIDE_NAVIGATION_TEST_UTILS_H_
#define CONTENT_TEST_BROWSER_SIDE_NAVIGATION_TEST_UTILS_H_

#include "base/macros.h"
#include "base/memory/scoped_ptr.h"

namespace content {

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.
scoped_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();

}  // namespace content

#endif  // CONTENT_TEST_BROWSER_SIDE_NAVIGATION_TEST_UTILS_H_