Respond with QuotaExceededError when IndexedDB has no disk space on open.
[chromium-blink-merge.git] / content / test / test_webkit_platform_support.h
blob7c02705fb4adce978b4bd0289c50246637878ded
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_WEBKIT_PLATFORM_SUPPORT_H_
6 #define CONTENT_TEST_TEST_WEBKIT_PLATFORM_SUPPORT_H_
8 #include "base/compiler_specific.h"
9 #include "base/files/scoped_temp_dir.h"
10 #include "content/test/mock_webclipboard_impl.h"
11 #include "content/test/weburl_loader_mock_factory.h"
12 #include "third_party/WebKit/public/platform/WebUnitTestSupport.h"
13 #include "webkit/child/webkitplatformsupport_child_impl.h"
14 #include "webkit/glue/simple_webmimeregistry_impl.h"
15 #include "webkit/glue/webfileutilities_impl.h"
16 #include "webkit/renderer/compositor_bindings/web_compositor_support_impl.h"
18 namespace WebKit {
19 class WebLayerTreeView;
22 // An implementation of WebKitPlatformSupport for tests.
23 class TestWebKitPlatformSupport :
24 public WebKit::WebUnitTestSupport,
25 public webkit_glue::WebKitPlatformSupportChildImpl {
26 public:
27 TestWebKitPlatformSupport();
28 virtual ~TestWebKitPlatformSupport();
30 virtual WebKit::WebMimeRegistry* mimeRegistry();
31 virtual WebKit::WebClipboard* clipboard();
32 virtual WebKit::WebFileUtilities* fileUtilities();
33 virtual WebKit::WebIDBFactory* idbFactory();
35 virtual WebKit::WebURLLoader* createURLLoader();
36 virtual WebKit::WebData loadResource(const char* name);
37 virtual WebKit::WebString queryLocalizedString(
38 WebKit::WebLocalizedString::Name name);
39 virtual WebKit::WebString queryLocalizedString(
40 WebKit::WebLocalizedString::Name name,
41 const WebKit::WebString& value);
42 virtual WebKit::WebString queryLocalizedString(
43 WebKit::WebLocalizedString::Name name,
44 const WebKit::WebString& value1,
45 const WebKit::WebString& value2);
46 virtual WebKit::WebString defaultLocale();
48 #if defined(OS_WIN) || defined(OS_MACOSX)
49 void SetThemeEngine(WebKit::WebThemeEngine* engine);
50 virtual WebKit::WebThemeEngine *themeEngine();
51 #endif
53 virtual WebKit::WebCompositorSupport* compositorSupport();
55 WebURLLoaderMockFactory* url_loader_factory() {
56 return &url_loader_factory_;
59 const base::FilePath& file_system_root() const {
60 return file_system_root_.path();
63 virtual base::string16 GetLocalizedString(int message_id) OVERRIDE;
64 virtual base::StringPiece GetDataResource(
65 int resource_id,
66 ui::ScaleFactor scale_factor) OVERRIDE;
67 virtual webkit_glue::ResourceLoaderBridge* CreateResourceLoader(
68 const webkit_glue::ResourceLoaderBridge::RequestInfo& request_info)
69 OVERRIDE;
70 virtual webkit_glue::WebSocketStreamHandleBridge* CreateWebSocketBridge(
71 WebKit::WebSocketStreamHandle* handle,
72 webkit_glue::WebSocketStreamHandleDelegate* delegate) OVERRIDE;
74 virtual WebKit::WebGestureCurve* createFlingAnimationCurve(
75 int device_source,
76 const WebKit::WebFloatPoint& velocity,
77 const WebKit::WebSize& cumulative_scroll);
79 virtual WebKit::WebUnitTestSupport* unitTestSupport();
81 // WebUnitTestSupport implementation
82 virtual void registerMockedURL(const WebKit::WebURL& url,
83 const WebKit::WebURLResponse& response,
84 const WebKit::WebString& filePath);
85 virtual void registerMockedErrorURL(const WebKit::WebURL& url,
86 const WebKit::WebURLResponse& response,
87 const WebKit::WebURLError& error);
88 virtual void unregisterMockedURL(const WebKit::WebURL& url);
89 virtual void unregisterAllMockedURLs();
90 virtual void serveAsynchronousMockedRequests();
91 virtual WebKit::WebString webKitRootDir();
92 virtual WebKit::WebLayerTreeView* createLayerTreeViewForTesting();
93 virtual WebKit::WebLayerTreeView* createLayerTreeViewForTesting(
94 TestViewType type);
95 virtual WebKit::WebData readFromFile(const WebKit::WebString& path);
97 private:
98 webkit_glue::SimpleWebMimeRegistryImpl mime_registry_;
99 MockWebClipboardImpl mock_clipboard_;
100 webkit_glue::WebFileUtilitiesImpl file_utilities_;
101 base::ScopedTempDir file_system_root_;
102 WebURLLoaderMockFactory url_loader_factory_;
103 webkit::WebCompositorSupportImpl compositor_support_;
105 #if defined(OS_WIN) || defined(OS_MACOSX)
106 WebKit::WebThemeEngine* active_theme_engine_;
107 #endif
108 DISALLOW_COPY_AND_ASSIGN(TestWebKitPlatformSupport);
111 #endif // CONTENT_TEST_TEST_WEBKIT_PLATFORM_SUPPORT_H_