Index: content/test/browser_side_navigation_test_utils.h |
diff --git a/content/test/browser_side_navigation_test_utils.h b/content/test/browser_side_navigation_test_utils.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..27b29a35785430dbf806200583dc7656ed2902bd |
--- /dev/null |
+++ b/content/test/browser_side_navigation_test_utils.h |
@@ -0,0 +1,53 @@ |
+// 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; |
+class StreamRegistry; |
+class TestNavigationURLLoaderFactory; |
+ |
+// PlzNavigate |
+// A UI thread singleton helper class for browser side navigations. When browser |
+// side navigations are enabled, initialize this class before doing any |
+// operation that may start a navigation request on the UI thread. Use TearDown |
+// at the end of the test. |
+class BrowserSideNavigationTestUtils { |
+ public: |
+ // Initializes the BrowserSideNavigationsTestUtils. 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). |
+ static void SetUp(); |
+ |
+ // Destroys the BrowserSideNavigationTestUtils singleton. |
+ static void TearDown(); |
+ |
+ // Returns an empty stream. Used when faking a navigation commit notification |
+ // from the IO thread with a TestNavigationURLLoader. |
+ 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
|
+ |
+ static void EnableBrowserSideNavigation(); |
+ |
+ ~BrowserSideNavigationTestUtils(); |
+ |
+ private: |
+ BrowserSideNavigationTestUtils(); |
+ |
+ scoped_ptr<StreamRegistry> stream_registry_; |
+ scoped_ptr<TestNavigationURLLoaderFactory> loader_factory_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(BrowserSideNavigationTestUtils); |
+}; |
+ |
+} // namespace content |
+ |
+#endif // CONTENT_TEST_BROWSER_SIDE_NAVIGATION_TEST_UTILS_H_ |