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 "cc/blink/web_compositor_support_impl.h" | 10 #include "cc/blink/web_compositor_support_impl.h" |
11 #include "content/child/blink_platform_impl.h" | 11 #include "content/child/blink_platform_impl.h" |
12 #include "content/child/simple_webmimeregistry_impl.h" | 12 #include "content/child/simple_webmimeregistry_impl.h" |
13 #include "content/child/webfileutilities_impl.h" | 13 #include "content/child/webfileutilities_impl.h" |
14 #include "content/test/mock_webblob_registry_impl.h" | 14 #include "content/test/mock_webblob_registry_impl.h" |
15 #include "content/test/mock_webclipboard_impl.h" | 15 #include "content/test/mock_webclipboard_impl.h" |
16 #include "content/test/weburl_loader_mock_factory.h" | 16 #include "content/test/weburl_loader_mock_factory.h" |
17 #include "third_party/WebKit/public/platform/WebUnitTestSupport.h" | 17 #include "third_party/WebKit/public/platform/WebUnitTestSupport.h" |
18 | 18 |
19 namespace base { | 19 namespace base { |
20 class StatsTable; | 20 class StatsTable; |
21 } | 21 } |
22 | 22 |
23 namespace blink { | 23 namespace blink { |
24 class WebLayerTreeView; | 24 class WebLayerTreeView; |
25 } | 25 } |
26 | 26 |
27 namespace content { | 27 namespace content { |
28 class RendererScheduler; | |
29 class WebSchedulerImpl; | |
28 | 30 |
29 // An implementation of blink::WebUnitTestSupport and BlinkPlatformImpl for | 31 // An implementation of blink::WebUnitTestSupport and BlinkPlatformImpl for |
30 // tests. | 32 // tests. |
31 class TestBlinkWebUnitTestSupport : public blink::WebUnitTestSupport, | 33 class TestBlinkWebUnitTestSupport : public blink::WebUnitTestSupport, |
32 public BlinkPlatformImpl { | 34 public BlinkPlatformImpl { |
33 public: | 35 public: |
34 TestBlinkWebUnitTestSupport(); | 36 // Takes ownership of |renderer_scheduler|. |
37 explicit TestBlinkWebUnitTestSupport(RendererScheduler* renderer_scheduler); | |
Sami
2015/01/28 12:16:27
Could you make this a scoped_ptr so the ownership
alex clarke (OOO till 29th)
2015/01/28 12:36:09
Done.
| |
35 virtual ~TestBlinkWebUnitTestSupport(); | 38 virtual ~TestBlinkWebUnitTestSupport(); |
36 | 39 |
37 virtual blink::WebBlobRegistry* blobRegistry(); | 40 virtual blink::WebBlobRegistry* blobRegistry(); |
38 virtual blink::WebClipboard* clipboard(); | 41 virtual blink::WebClipboard* clipboard(); |
39 virtual blink::WebFileUtilities* fileUtilities(); | 42 virtual blink::WebFileUtilities* fileUtilities(); |
40 virtual blink::WebIDBFactory* idbFactory(); | 43 virtual blink::WebIDBFactory* idbFactory(); |
41 virtual blink::WebMimeRegistry* mimeRegistry(); | 44 virtual blink::WebMimeRegistry* mimeRegistry(); |
42 | 45 |
43 virtual blink::WebURLLoader* createURLLoader(); | 46 virtual blink::WebURLLoader* createURLLoader(); |
44 virtual blink::WebString userAgent() override; | 47 virtual blink::WebString userAgent() override; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
76 const blink::WebURLResponse& response, | 79 const blink::WebURLResponse& response, |
77 const blink::WebURLError& error); | 80 const blink::WebURLError& error); |
78 virtual void unregisterMockedURL(const blink::WebURL& url); | 81 virtual void unregisterMockedURL(const blink::WebURL& url); |
79 virtual void unregisterAllMockedURLs(); | 82 virtual void unregisterAllMockedURLs(); |
80 virtual void serveAsynchronousMockedRequests(); | 83 virtual void serveAsynchronousMockedRequests(); |
81 virtual blink::WebString webKitRootDir(); | 84 virtual blink::WebString webKitRootDir(); |
82 virtual blink::WebLayerTreeView* createLayerTreeViewForTesting(); | 85 virtual blink::WebLayerTreeView* createLayerTreeViewForTesting(); |
83 virtual blink::WebData readFromFile(const blink::WebString& path); | 86 virtual blink::WebData readFromFile(const blink::WebString& path); |
84 virtual bool getBlobItems(const blink::WebString& uuid, | 87 virtual bool getBlobItems(const blink::WebString& uuid, |
85 blink::WebVector<blink::WebBlobData::Item*>* items); | 88 blink::WebVector<blink::WebBlobData::Item*>* items); |
89 virtual blink::WebScheduler* scheduler(); | |
86 | 90 |
87 private: | 91 private: |
88 MockWebBlobRegistryImpl blob_registry_; | 92 MockWebBlobRegistryImpl blob_registry_; |
89 SimpleWebMimeRegistryImpl mime_registry_; | 93 SimpleWebMimeRegistryImpl mime_registry_; |
90 scoped_ptr<MockWebClipboardImpl> mock_clipboard_; | 94 scoped_ptr<MockWebClipboardImpl> mock_clipboard_; |
91 WebFileUtilitiesImpl file_utilities_; | 95 WebFileUtilitiesImpl file_utilities_; |
92 base::ScopedTempDir file_system_root_; | 96 base::ScopedTempDir file_system_root_; |
93 scoped_ptr<WebURLLoaderMockFactory> url_loader_factory_; | 97 scoped_ptr<WebURLLoaderMockFactory> url_loader_factory_; |
94 cc_blink::WebCompositorSupportImpl compositor_support_; | 98 cc_blink::WebCompositorSupportImpl compositor_support_; |
95 scoped_ptr<base::StatsTable> stats_table_; | 99 scoped_ptr<base::StatsTable> stats_table_; |
100 scoped_ptr<RendererScheduler> renderer_scheduler_; | |
101 scoped_ptr<WebSchedulerImpl> web_scheduler_; | |
96 | 102 |
97 #if defined(OS_WIN) || defined(OS_MACOSX) | 103 #if defined(OS_WIN) || defined(OS_MACOSX) |
98 blink::WebThemeEngine* active_theme_engine_; | 104 blink::WebThemeEngine* active_theme_engine_; |
99 #endif | 105 #endif |
100 DISALLOW_COPY_AND_ASSIGN(TestBlinkWebUnitTestSupport); | 106 DISALLOW_COPY_AND_ASSIGN(TestBlinkWebUnitTestSupport); |
101 }; | 107 }; |
102 | 108 |
103 } // namespace content | 109 } // namespace content |
104 | 110 |
105 #endif // CONTENT_TEST_TEST_BLINK_WEB_UNIT_TEST_SUPPORT_H_ | 111 #endif // CONTENT_TEST_TEST_BLINK_WEB_UNIT_TEST_SUPPORT_H_ |
OLD | NEW |