OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_SHELL_RENDERER_TEST_RUNNER_WEB_TEST_PROXY_H_ | 5 #ifndef CONTENT_SHELL_RENDERER_TEST_RUNNER_WEB_TEST_PROXY_H_ |
6 #define CONTENT_SHELL_RENDERER_TEST_RUNNER_WEB_TEST_PROXY_H_ | 6 #define CONTENT_SHELL_RENDERER_TEST_RUNNER_WEB_TEST_PROXY_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/callback.h" | 13 #include "base/callback.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "content/shell/renderer/test_runner/web_task.h" | 15 #include "content/shell/renderer/test_runner/web_task.h" |
16 #include "third_party/WebKit/public/platform/WebCompositeAndReadbackAsyncCallbac
k.h" | |
17 #include "third_party/WebKit/public/platform/WebRect.h" | 16 #include "third_party/WebKit/public/platform/WebRect.h" |
18 #include "third_party/WebKit/public/platform/WebScreenInfo.h" | 17 #include "third_party/WebKit/public/platform/WebScreenInfo.h" |
19 #include "third_party/WebKit/public/platform/WebURLError.h" | 18 #include "third_party/WebKit/public/platform/WebURLError.h" |
20 #include "third_party/WebKit/public/platform/WebURLRequest.h" | 19 #include "third_party/WebKit/public/platform/WebURLRequest.h" |
21 #include "third_party/WebKit/public/web/WebAXEnums.h" | 20 #include "third_party/WebKit/public/web/WebAXEnums.h" |
22 #include "third_party/WebKit/public/web/WebDOMMessageEvent.h" | 21 #include "third_party/WebKit/public/web/WebDOMMessageEvent.h" |
23 #include "third_party/WebKit/public/web/WebDataSource.h" | 22 #include "third_party/WebKit/public/web/WebDataSource.h" |
24 #include "third_party/WebKit/public/web/WebDragOperation.h" | 23 #include "third_party/WebKit/public/web/WebDragOperation.h" |
25 #include "third_party/WebKit/public/web/WebFrame.h" | 24 #include "third_party/WebKit/public/web/WebFrame.h" |
26 #include "third_party/WebKit/public/web/WebFrameClient.h" | 25 #include "third_party/WebKit/public/web/WebFrameClient.h" |
27 #include "third_party/WebKit/public/web/WebHistoryCommitType.h" | 26 #include "third_party/WebKit/public/web/WebHistoryCommitType.h" |
28 #include "third_party/WebKit/public/web/WebIconURL.h" | 27 #include "third_party/WebKit/public/web/WebIconURL.h" |
29 #include "third_party/WebKit/public/web/WebNavigationPolicy.h" | 28 #include "third_party/WebKit/public/web/WebNavigationPolicy.h" |
30 #include "third_party/WebKit/public/web/WebNavigationType.h" | 29 #include "third_party/WebKit/public/web/WebNavigationType.h" |
31 #include "third_party/WebKit/public/web/WebSecurityOrigin.h" | 30 #include "third_party/WebKit/public/web/WebSecurityOrigin.h" |
32 #include "third_party/WebKit/public/web/WebTextAffinity.h" | 31 #include "third_party/WebKit/public/web/WebTextAffinity.h" |
33 #include "third_party/WebKit/public/web/WebTextDirection.h" | 32 #include "third_party/WebKit/public/web/WebTextDirection.h" |
34 | 33 |
| 34 class SkBitmap; |
35 class SkCanvas; | 35 class SkCanvas; |
36 | 36 |
37 namespace blink { | 37 namespace blink { |
38 class WebAXObject; | 38 class WebAXObject; |
39 class WebAudioDevice; | 39 class WebAudioDevice; |
40 class WebCachedURLRequest; | 40 class WebCachedURLRequest; |
41 class WebColorChooser; | 41 class WebColorChooser; |
42 class WebColorChooserClient; | 42 class WebColorChooserClient; |
43 class WebDataSource; | 43 class WebDataSource; |
44 class WebDragData; | 44 class WebDragData; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 class SpellCheckClient; | 86 class SpellCheckClient; |
87 class TestInterfaces; | 87 class TestInterfaces; |
88 class WebTestDelegate; | 88 class WebTestDelegate; |
89 class WebTestInterfaces; | 89 class WebTestInterfaces; |
90 | 90 |
91 // WebTestProxyBase is the "brain" of WebTestProxy in the sense that | 91 // WebTestProxyBase is the "brain" of WebTestProxy in the sense that |
92 // WebTestProxy does the bridge between RenderViewImpl and WebTestProxyBase and | 92 // WebTestProxy does the bridge between RenderViewImpl and WebTestProxyBase and |
93 // when it requires a behavior to be different from the usual, it will call | 93 // when it requires a behavior to be different from the usual, it will call |
94 // WebTestProxyBase that implements the expected behavior. | 94 // WebTestProxyBase that implements the expected behavior. |
95 // See WebTestProxy class comments for more information. | 95 // See WebTestProxy class comments for more information. |
96 class WebTestProxyBase : public blink::WebCompositeAndReadbackAsyncCallback { | 96 class WebTestProxyBase { |
97 public: | 97 public: |
98 void SetInterfaces(WebTestInterfaces* interfaces); | 98 void SetInterfaces(WebTestInterfaces* interfaces); |
99 void SetDelegate(WebTestDelegate* delegate); | 99 void SetDelegate(WebTestDelegate* delegate); |
100 void set_widget(blink::WebWidget* widget) { web_widget_ = widget; } | 100 void set_widget(blink::WebWidget* widget) { web_widget_ = widget; } |
101 | 101 |
102 void Reset(); | 102 void Reset(); |
103 | 103 |
104 blink::WebSpellCheckClient* GetSpellCheckClient() const; | 104 blink::WebSpellCheckClient* GetSpellCheckClient() const; |
105 blink::WebColorChooser* CreateColorChooser( | 105 blink::WebColorChooser* CreateColorChooser( |
106 blink::WebColorChooserClient* client, | 106 blink::WebColorChooserClient* client, |
(...skipping 27 matching lines...) Expand all Loading... |
134 blink::WebMIDIClientMock* GetMIDIClientMock(); | 134 blink::WebMIDIClientMock* GetMIDIClientMock(); |
135 MockWebSpeechRecognizer* GetSpeechRecognizerMock(); | 135 MockWebSpeechRecognizer* GetSpeechRecognizerMock(); |
136 MockCredentialManagerClient* GetCredentialManagerClientMock(); | 136 MockCredentialManagerClient* GetCredentialManagerClientMock(); |
137 | 137 |
138 WebTaskList* mutable_task_list() { return &task_list_; } | 138 WebTaskList* mutable_task_list() { return &task_list_; } |
139 | 139 |
140 blink::WebView* GetWebView() const; | 140 blink::WebView* GetWebView() const; |
141 | 141 |
142 void PostSpellCheckEvent(const blink::WebString& event_name); | 142 void PostSpellCheckEvent(const blink::WebString& event_name); |
143 | 143 |
144 // WebCompositeAndReadbackAsyncCallback implementation. | |
145 virtual void didCompositeAndReadback(const SkBitmap& bitmap); | |
146 | |
147 void SetAcceptLanguages(const std::string& accept_languages); | 144 void SetAcceptLanguages(const std::string& accept_languages); |
148 | 145 |
149 MockWebPushClient* GetPushClientMock(); | 146 MockWebPushClient* GetPushClientMock(); |
150 | 147 |
151 protected: | 148 protected: |
152 WebTestProxyBase(); | 149 WebTestProxyBase(); |
153 ~WebTestProxyBase(); | 150 ~WebTestProxyBase(); |
154 | 151 |
155 void ScheduleAnimation(); | 152 void ScheduleAnimation(); |
156 void PostAccessibilityEvent(const blink::WebAXObject&, blink::WebAXEvent); | 153 void PostAccessibilityEvent(const blink::WebAXObject&, blink::WebAXEvent); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 friend class WebFrameTestProxy; | 243 friend class WebFrameTestProxy; |
247 | 244 |
248 enum CheckDoneReason { | 245 enum CheckDoneReason { |
249 LoadFinished, | 246 LoadFinished, |
250 MainResourceLoadFailed, | 247 MainResourceLoadFailed, |
251 ResourceLoadCompleted | 248 ResourceLoadCompleted |
252 }; | 249 }; |
253 void CheckDone(blink::WebLocalFrame* frame, CheckDoneReason reason); | 250 void CheckDone(blink::WebLocalFrame* frame, CheckDoneReason reason); |
254 void AnimateNow(); | 251 void AnimateNow(); |
255 void DrawSelectionRect(SkCanvas* canvas); | 252 void DrawSelectionRect(SkCanvas* canvas); |
| 253 void DidCapturePixelsAsync(const base::Callback<void(const SkBitmap&)>& callba
ck, const SkBitmap& bitmap); |
256 void DidDisplayAsync(const base::Closure& callback, const SkBitmap& bitmap); | 254 void DidDisplayAsync(const base::Closure& callback, const SkBitmap& bitmap); |
257 | 255 |
258 blink::WebWidget* web_widget() const { return web_widget_; } | 256 blink::WebWidget* web_widget() const { return web_widget_; } |
259 | 257 |
260 TestInterfaces* test_interfaces_; | 258 TestInterfaces* test_interfaces_; |
261 WebTestDelegate* delegate_; | 259 WebTestDelegate* delegate_; |
262 blink::WebWidget* web_widget_; | 260 blink::WebWidget* web_widget_; |
263 | 261 |
264 WebTaskList task_list_; | 262 WebTaskList task_list_; |
265 | 263 |
266 scoped_ptr<SpellCheckClient> spellcheck_; | 264 scoped_ptr<SpellCheckClient> spellcheck_; |
267 scoped_ptr<MockWebUserMediaClient> user_media_client_; | 265 scoped_ptr<MockWebUserMediaClient> user_media_client_; |
268 | 266 |
269 bool animate_scheduled_; | 267 bool animate_scheduled_; |
270 std::map<unsigned, std::string> resource_identifier_map_; | 268 std::map<unsigned, std::string> resource_identifier_map_; |
271 std::deque<base::Callback<void(const SkBitmap&)> > | |
272 composite_and_readback_callbacks_; | |
273 | 269 |
274 bool log_console_output_; | 270 bool log_console_output_; |
275 int chooser_count_; | 271 int chooser_count_; |
276 | 272 |
277 scoped_ptr<MockCredentialManagerClient> credential_manager_client_; | 273 scoped_ptr<MockCredentialManagerClient> credential_manager_client_; |
278 scoped_ptr<blink::WebMIDIClientMock> midi_client_; | 274 scoped_ptr<blink::WebMIDIClientMock> midi_client_; |
279 scoped_ptr<MockWebSpeechRecognizer> speech_recognizer_; | 275 scoped_ptr<MockWebSpeechRecognizer> speech_recognizer_; |
280 scoped_ptr<MockWebPushClient> push_client_; | 276 scoped_ptr<MockWebPushClient> push_client_; |
281 scoped_ptr<MockScreenOrientationClient> screen_orientation_client_; | 277 scoped_ptr<MockScreenOrientationClient> screen_orientation_client_; |
282 | 278 |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 return WebTestProxyBase::GetWebPushClient(); | 403 return WebTestProxyBase::GetWebPushClient(); |
408 } | 404 } |
409 | 405 |
410 private: | 406 private: |
411 DISALLOW_COPY_AND_ASSIGN(WebTestProxy); | 407 DISALLOW_COPY_AND_ASSIGN(WebTestProxy); |
412 }; | 408 }; |
413 | 409 |
414 } // namespace content | 410 } // namespace content |
415 | 411 |
416 #endif // CONTENT_SHELL_RENDERER_TEST_RUNNER_WEB_TEST_PROXY_H_ | 412 #endif // CONTENT_SHELL_RENDERER_TEST_RUNNER_WEB_TEST_PROXY_H_ |
OLD | NEW |