| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_TEST_TEST_BLINK_WEB_UNIT_TEST_SUPPORT_H_ | 5 #ifndef CONTENT_TEST_TEST_BLINK_WEB_UNIT_TEST_SUPPORT_H_ |
| 6 #define CONTENT_TEST_TEST_BLINK_WEB_UNIT_TEST_SUPPORT_H_ | 6 #define CONTENT_TEST_TEST_BLINK_WEB_UNIT_TEST_SUPPORT_H_ |
| 7 | 7 |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
| 12 #include "cc/blink/web_compositor_support_impl.h" | 12 #include "cc/blink/web_compositor_support_impl.h" |
| 13 #include "content/child/blink_platform_impl.h" | 13 #include "content/child/blink_platform_impl.h" |
| 14 #include "content/child/simple_webmimeregistry_impl.h" | 14 #include "content/child/simple_webmimeregistry_impl.h" |
| 15 #include "content/child/webfileutilities_impl.h" | 15 #include "content/child/webfileutilities_impl.h" |
| 16 #include "content/test/mock_webblob_registry_impl.h" | 16 #include "content/test/mock_webblob_registry_impl.h" |
| 17 #include "content/test/mock_webclipboard_impl.h" | 17 #include "content/test/mock_webclipboard_impl.h" |
| 18 #include "third_party/WebKit/public/platform/WebURLLoaderMockFactory.h" | 18 #include "third_party/WebKit/public/platform/WebURLLoaderMockFactory.h" |
| 19 #include "third_party/WebKit/public/platform/WebUnitTestSupport.h" | |
| 20 | 19 |
| 21 namespace base { | 20 namespace base { |
| 22 class StatsTable; | 21 class StatsTable; |
| 23 } | 22 } |
| 24 | 23 |
| 25 namespace blink { | 24 namespace blink { |
| 26 class WebLayerTreeView; | 25 class WebLayerTreeView; |
| 27 } | 26 } |
| 28 | 27 |
| 29 namespace scheduler { | 28 namespace scheduler { |
| 30 class RendererScheduler; | 29 class RendererScheduler; |
| 31 } | 30 } |
| 32 | 31 |
| 33 namespace content { | 32 namespace content { |
| 34 | 33 |
| 35 // An implementation of blink::WebUnitTestSupport and BlinkPlatformImpl for | 34 // An implementation of BlinkPlatformImpl for tests. |
| 36 // tests. | 35 class TestBlinkWebUnitTestSupport : public BlinkPlatformImpl { |
| 37 class TestBlinkWebUnitTestSupport : public blink::WebUnitTestSupport, | |
| 38 public BlinkPlatformImpl { | |
| 39 public: | 36 public: |
| 40 TestBlinkWebUnitTestSupport(); | 37 TestBlinkWebUnitTestSupport(); |
| 41 ~TestBlinkWebUnitTestSupport() override; | 38 ~TestBlinkWebUnitTestSupport() override; |
| 42 | 39 |
| 43 blink::WebBlobRegistry* blobRegistry() override; | 40 blink::WebBlobRegistry* blobRegistry() override; |
| 44 blink::WebClipboard* clipboard() override; | 41 blink::WebClipboard* clipboard() override; |
| 45 blink::WebFileUtilities* fileUtilities() override; | 42 blink::WebFileUtilities* fileUtilities() override; |
| 46 blink::WebIDBFactory* idbFactory() override; | 43 blink::WebIDBFactory* idbFactory() override; |
| 47 blink::WebMimeRegistry* mimeRegistry() override; | 44 blink::WebMimeRegistry* mimeRegistry() override; |
| 48 | 45 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 64 blink::WebThemeEngine* themeEngine() override; | 61 blink::WebThemeEngine* themeEngine() override; |
| 65 #endif | 62 #endif |
| 66 | 63 |
| 67 blink::WebCompositorSupport* compositorSupport() override; | 64 blink::WebCompositorSupport* compositorSupport() override; |
| 68 | 65 |
| 69 blink::WebGestureCurve* createFlingAnimationCurve( | 66 blink::WebGestureCurve* createFlingAnimationCurve( |
| 70 blink::WebGestureDevice device_source, | 67 blink::WebGestureDevice device_source, |
| 71 const blink::WebFloatPoint& velocity, | 68 const blink::WebFloatPoint& velocity, |
| 72 const blink::WebSize& cumulative_scroll) override; | 69 const blink::WebSize& cumulative_scroll) override; |
| 73 | 70 |
| 74 blink::WebUnitTestSupport* unitTestSupport() override; | 71 blink::WebURLLoaderMockFactory* getURLLoaderMockFactory() override; |
| 75 | 72 |
| 76 // WebUnitTestSupport implementation | |
| 77 // TODO(kinuko): Remove these methods. | |
| 78 void registerMockedURL(const blink::WebURL& url, | |
| 79 const blink::WebURLResponse& response, | |
| 80 const blink::WebString& filePath) override; | |
| 81 void registerMockedErrorURL(const blink::WebURL& url, | |
| 82 const blink::WebURLResponse& response, | |
| 83 const blink::WebURLError& error) override; | |
| 84 void unregisterMockedURL(const blink::WebURL& url) override; | |
| 85 void unregisterAllMockedURLs() override; | |
| 86 void serveAsynchronousMockedRequests() override; | |
| 87 void setLoaderDelegate(blink::WebURLLoaderTestDelegate* delegate) override; | |
| 88 blink::WebThread* currentThread() override; | 73 blink::WebThread* currentThread() override; |
| 89 | 74 |
| 90 void getPluginList(bool refresh, | 75 void getPluginList(bool refresh, |
| 91 blink::WebPluginListBuilder* builder) override; | 76 blink::WebPluginListBuilder* builder) override; |
| 92 | 77 |
| 93 private: | 78 private: |
| 94 MockWebBlobRegistryImpl blob_registry_; | 79 MockWebBlobRegistryImpl blob_registry_; |
| 95 SimpleWebMimeRegistryImpl mime_registry_; | 80 SimpleWebMimeRegistryImpl mime_registry_; |
| 96 scoped_ptr<MockWebClipboardImpl> mock_clipboard_; | 81 scoped_ptr<MockWebClipboardImpl> mock_clipboard_; |
| 97 WebFileUtilitiesImpl file_utilities_; | 82 WebFileUtilitiesImpl file_utilities_; |
| 98 base::ScopedTempDir file_system_root_; | 83 base::ScopedTempDir file_system_root_; |
| 99 scoped_ptr<blink::WebURLLoaderMockFactory> url_loader_factory_; | 84 scoped_ptr<blink::WebURLLoaderMockFactory> url_loader_factory_; |
| 100 cc_blink::WebCompositorSupportImpl compositor_support_; | 85 cc_blink::WebCompositorSupportImpl compositor_support_; |
| 101 scoped_ptr<scheduler::RendererScheduler> renderer_scheduler_; | 86 scoped_ptr<scheduler::RendererScheduler> renderer_scheduler_; |
| 102 scoped_ptr<blink::WebThread> web_thread_; | 87 scoped_ptr<blink::WebThread> web_thread_; |
| 103 | 88 |
| 104 #if defined(OS_WIN) || defined(OS_MACOSX) | 89 #if defined(OS_WIN) || defined(OS_MACOSX) |
| 105 blink::WebThemeEngine* active_theme_engine_ = nullptr; | 90 blink::WebThemeEngine* active_theme_engine_ = nullptr; |
| 106 #endif | 91 #endif |
| 107 DISALLOW_COPY_AND_ASSIGN(TestBlinkWebUnitTestSupport); | 92 DISALLOW_COPY_AND_ASSIGN(TestBlinkWebUnitTestSupport); |
| 108 }; | 93 }; |
| 109 | 94 |
| 110 } // namespace content | 95 } // namespace content |
| 111 | 96 |
| 112 #endif // CONTENT_TEST_TEST_BLINK_WEB_UNIT_TEST_SUPPORT_H_ | 97 #endif // CONTENT_TEST_TEST_BLINK_WEB_UNIT_TEST_SUPPORT_H_ |
| OLD | NEW |