[refactor] More post-NSS WebCrypto cleanups (utility functions).
[chromium-blink-merge.git] / content / test / test_blink_web_unit_test_support.h
blob41419a39ff67a95d1c89e7e39154a0fcec07e20c
1 // Copyright 2013 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.
5 #ifndef CONTENT_TEST_TEST_BLINK_WEB_UNIT_TEST_SUPPORT_H_
6 #define CONTENT_TEST_TEST_BLINK_WEB_UNIT_TEST_SUPPORT_H_
8 #include "base/compiler_specific.h"
9 #include "base/files/scoped_temp_dir.h"
10 #include "cc/blink/web_compositor_support_impl.h"
11 #include "content/child/blink_platform_impl.h"
12 #include "content/child/simple_webmimeregistry_impl.h"
13 #include "content/child/webfileutilities_impl.h"
14 #include "content/test/mock_webblob_registry_impl.h"
15 #include "content/test/mock_webclipboard_impl.h"
16 #include "content/test/weburl_loader_mock_factory.h"
17 #include "third_party/WebKit/public/platform/WebUnitTestSupport.h"
19 namespace base {
20 class StatsTable;
23 namespace blink {
24 class WebLayerTreeView;
27 namespace scheduler {
28 class RendererScheduler;
31 namespace content {
33 // An implementation of blink::WebUnitTestSupport and BlinkPlatformImpl for
34 // tests.
35 class TestBlinkWebUnitTestSupport : public blink::WebUnitTestSupport,
36 public BlinkPlatformImpl {
37 public:
38 TestBlinkWebUnitTestSupport();
39 virtual ~TestBlinkWebUnitTestSupport();
41 virtual blink::WebBlobRegistry* blobRegistry();
42 virtual blink::WebClipboard* clipboard();
43 virtual blink::WebFileUtilities* fileUtilities();
44 virtual blink::WebIDBFactory* idbFactory();
45 virtual blink::WebMimeRegistry* mimeRegistry();
47 virtual blink::WebURLLoader* createURLLoader();
48 virtual blink::WebString userAgent() override;
49 virtual blink::WebData loadResource(const char* name);
50 virtual blink::WebString queryLocalizedString(
51 blink::WebLocalizedString::Name name);
52 virtual blink::WebString queryLocalizedString(
53 blink::WebLocalizedString::Name name,
54 const blink::WebString& value);
55 virtual blink::WebString queryLocalizedString(
56 blink::WebLocalizedString::Name name,
57 const blink::WebString& value1,
58 const blink::WebString& value2);
59 virtual blink::WebString defaultLocale();
61 #if defined(OS_WIN) || defined(OS_MACOSX)
62 void SetThemeEngine(blink::WebThemeEngine* engine);
63 virtual blink::WebThemeEngine* themeEngine();
64 #endif
66 virtual blink::WebCompositorSupport* compositorSupport();
68 virtual blink::WebGestureCurve* createFlingAnimationCurve(
69 blink::WebGestureDevice device_source,
70 const blink::WebFloatPoint& velocity,
71 const blink::WebSize& cumulative_scroll) override;
73 virtual blink::WebUnitTestSupport* unitTestSupport();
75 // WebUnitTestSupport implementation
76 virtual void registerMockedURL(const blink::WebURL& url,
77 const blink::WebURLResponse& response,
78 const blink::WebString& filePath);
79 virtual void registerMockedErrorURL(const blink::WebURL& url,
80 const blink::WebURLResponse& response,
81 const blink::WebURLError& error);
82 virtual void unregisterMockedURL(const blink::WebURL& url);
83 virtual void unregisterAllMockedURLs();
84 virtual void serveAsynchronousMockedRequests();
85 virtual void setLoaderDelegate(blink::WebURLLoaderTestDelegate* delegate);
86 virtual blink::WebString webKitRootDir();
87 virtual blink::WebLayerTreeView* createLayerTreeViewForTesting();
88 virtual blink::WebData readFromFile(const blink::WebString& path);
89 virtual bool getBlobItems(const blink::WebString& uuid,
90 blink::WebVector<blink::WebBlobData::Item*>* items);
91 virtual blink::WebThread* currentThread();
92 virtual void enterRunLoop();
93 virtual void exitRunLoop();
95 virtual void getPluginList(bool refresh,
96 blink::WebPluginListBuilder* builder);
98 private:
99 MockWebBlobRegistryImpl blob_registry_;
100 SimpleWebMimeRegistryImpl mime_registry_;
101 scoped_ptr<MockWebClipboardImpl> mock_clipboard_;
102 WebFileUtilitiesImpl file_utilities_;
103 base::ScopedTempDir file_system_root_;
104 scoped_ptr<WebURLLoaderMockFactory> url_loader_factory_;
105 cc_blink::WebCompositorSupportImpl compositor_support_;
106 scoped_ptr<scheduler::RendererScheduler> renderer_scheduler_;
107 scoped_ptr<blink::WebThread> web_thread_;
109 #if defined(OS_WIN) || defined(OS_MACOSX)
110 blink::WebThemeEngine* active_theme_engine_;
111 #endif
112 DISALLOW_COPY_AND_ASSIGN(TestBlinkWebUnitTestSupport);
115 } // namespace content
117 #endif // CONTENT_TEST_TEST_BLINK_WEB_UNIT_TEST_SUPPORT_H_