OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2014 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_TEST_BROWSER_SIDE_NAVIGATION_TEST_UTILS_H_ | |
6 #define CONTENT_TEST_BROWSER_SIDE_NAVIGATION_TEST_UTILS_H_ | |
7 | |
8 #include "base/macros.h" | |
9 #include "base/memory/scoped_ptr.h" | |
10 | |
11 namespace content { | |
12 | |
13 class StreamHandle; | |
14 class StreamRegistry; | |
15 class TestNavigationURLLoaderFactory; | |
16 | |
17 // PlzNavigate | |
18 // A UI thread singleton helper class for browser side navigations. When browser | |
19 // side navigations are enabled, initialize this class before doing any | |
20 // operation that may start a navigation request on the UI thread. Use TearDown | |
21 // at the end of the test. | |
22 class BrowserSideNavigationTestUtils { | |
23 public: | |
24 // Initializes the BrowserSideNavigationsTestUtils. Following this call, all | |
25 // NavigationURLLoader objects created will be TestNavigationURLLoaders | |
26 // instead of NavigationURLloaderImpls. This should be called before any call | |
27 // in the UI thread unit tests that will start a navigation (eg. | |
28 // TestWebContents::NavigateAndCommit). | |
29 static void SetUp(); | |
30 | |
31 // Destroys the BrowserSideNavigationTestUtils singleton. | |
32 static void TearDown(); | |
33 | |
34 // Returns an empty stream. Used when faking a navigation commit notification | |
35 // from the IO thread with a TestNavigationURLLoader. | |
36 static scoped_ptr<StreamHandle> MakeEmptyStream(); | |
nasko
2014/11/17 22:40:02
A class full of static methods is equivalent to a
clamy
2014/11/18 12:33:22
When writing the web_url_request_util, jam@ specif
| |
37 | |
38 static void EnableBrowserSideNavigation(); | |
39 | |
40 ~BrowserSideNavigationTestUtils(); | |
41 | |
42 private: | |
43 BrowserSideNavigationTestUtils(); | |
44 | |
45 scoped_ptr<StreamRegistry> stream_registry_; | |
46 scoped_ptr<TestNavigationURLLoaderFactory> loader_factory_; | |
47 | |
48 DISALLOW_COPY_AND_ASSIGN(BrowserSideNavigationTestUtils); | |
49 }; | |
50 | |
51 } // namespace content | |
52 | |
53 #endif // CONTENT_TEST_BROWSER_SIDE_NAVIGATION_TEST_UTILS_H_ | |
OLD | NEW |