OLD | NEW |
| (Empty) |
1 // Copyright (c) 2011 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. | |
4 | |
5 #ifndef WEBKIT_TOOLS_TEST_SHELL_TEST_WEB_WORKER_H_ | |
6 #define WEBKIT_TOOLS_TEST_SHELL_TEST_WEB_WORKER_H_ | |
7 | |
8 #include "base/basictypes.h" | |
9 #include "base/memory/ref_counted.h" | |
10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMessagePortChannel
.h" | |
11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebWorker.h" | |
12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebWorkerClient.h" | |
13 | |
14 namespace WebKit { | |
15 class WebApplicationCacheHost; | |
16 class WebApplicationCacheHostClient; | |
17 class WebFrame; | |
18 class WebNotificationPresenter; | |
19 class WebString; | |
20 class WebURL; | |
21 } | |
22 | |
23 // WebWorkers are not functional in test_shell. This class effectively | |
24 // stubs things out. | |
25 class TestWebWorker : public WebKit::WebWorker, | |
26 public WebKit::WebWorkerClient, | |
27 public base::RefCounted<TestWebWorker> { | |
28 public: | |
29 TestWebWorker(); | |
30 | |
31 // WebWorker methods: | |
32 virtual void startWorkerContext(const WebKit::WebURL& script_url, | |
33 const WebKit::WebString& user_agent, | |
34 const WebKit::WebString& source_code) { | |
35 } | |
36 virtual void terminateWorkerContext() { | |
37 } | |
38 virtual void postMessageToWorkerContext( | |
39 const WebKit::WebString& message, | |
40 const WebKit::WebMessagePortChannelArray& channel) { | |
41 } | |
42 virtual void workerObjectDestroyed(); | |
43 virtual void clientDestroyed() { | |
44 } | |
45 | |
46 // WebWorkerClient methods: | |
47 virtual void postMessageToWorkerObject( | |
48 const WebKit::WebString& message, | |
49 const WebKit::WebMessagePortChannelArray& channel) { | |
50 } | |
51 virtual void postExceptionToWorkerObject( | |
52 const WebKit::WebString& error_message, | |
53 int line_number, | |
54 const WebKit::WebString& source_url) { | |
55 } | |
56 virtual void postConsoleMessageToWorkerObject( | |
57 int destination_id, | |
58 int source_id, | |
59 int message_type, | |
60 int message_level, | |
61 const WebKit::WebString& message, | |
62 int line_number, | |
63 const WebKit::WebString& source_url) { | |
64 } | |
65 virtual void confirmMessageFromWorkerObject(bool has_pending_activity) { } | |
66 virtual void reportPendingActivity(bool has_pending_activity) { } | |
67 virtual void workerContextClosed() { } | |
68 virtual void workerContextDestroyed(); | |
69 virtual WebKit::WebWorker* createWorker(WebKit::WebWorkerClient* client); | |
70 virtual WebKit::WebNotificationPresenter* notificationPresenter(); | |
71 virtual WebKit::WebApplicationCacheHost* createApplicationCacheHost( | |
72 WebKit::WebApplicationCacheHostClient*); | |
73 virtual bool allowDatabase(WebKit::WebFrame* frame, | |
74 const WebKit::WebString& name, | |
75 const WebKit::WebString& display_name, | |
76 unsigned long estimated_size); | |
77 | |
78 private: | |
79 friend class base::RefCounted<TestWebWorker>; | |
80 | |
81 virtual ~TestWebWorker(); | |
82 | |
83 DISALLOW_COPY_AND_ASSIGN(TestWebWorker); | |
84 }; | |
85 | |
86 #endif // WEBKIT_TOOLS_TEST_SHELL_TEST_WEB_WORKER_H_ | |
OLD | NEW |