OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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 WEBKIT_SUPPORT_TEST_WEBMESSAGEPORTCHANNEL_H_ | 5 #ifndef WEBKIT_SUPPORT_TEST_WEBMESSAGEPORTCHANNEL_H_ |
6 #define WEBKIT_SUPPORT_TEST_WEBMESSAGEPORTCHANNEL_H_ | 6 #define WEBKIT_SUPPORT_TEST_WEBMESSAGEPORTCHANNEL_H_ |
7 | 7 |
8 #include <queue> | 8 #include <queue> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMessagePortChannel
.h" | 12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebMessagePortChannel
.h" |
13 | 13 |
14 namespace WebKit { | 14 namespace WebKit { |
15 class WebString; | 15 class WebString; |
16 } | 16 } |
17 | 17 |
18 class TestWebMessagePortChannel | 18 class TestWebMessagePortChannel |
19 : public WebKit::WebMessagePortChannel, | 19 : public WebKit::WebMessagePortChannel, |
20 public base::RefCounted<TestWebMessagePortChannel> { | 20 public base::RefCounted<TestWebMessagePortChannel> { |
21 public: | 21 public: |
22 TestWebMessagePortChannel(); | 22 TestWebMessagePortChannel(); |
23 virtual ~TestWebMessagePortChannel(); | |
24 | 23 |
25 // WebMessagePortChannel implementation. | 24 // WebMessagePortChannel implementation. |
26 virtual void setClient(WebKit::WebMessagePortChannelClient*) OVERRIDE; | 25 virtual void setClient(WebKit::WebMessagePortChannelClient*) OVERRIDE; |
27 virtual void destroy() OVERRIDE; | 26 virtual void destroy() OVERRIDE; |
28 // WebKit versions of WebCore::MessagePortChannel. | 27 // WebKit versions of WebCore::MessagePortChannel. |
29 virtual void entangle(WebKit::WebMessagePortChannel*) OVERRIDE; | 28 virtual void entangle(WebKit::WebMessagePortChannel*) OVERRIDE; |
30 // Callee receives ownership of the passed vector. | 29 // Callee receives ownership of the passed vector. |
31 virtual void postMessage(const WebKit::WebString&, | 30 virtual void postMessage(const WebKit::WebString&, |
32 WebKit::WebMessagePortChannelArray*) OVERRIDE; | 31 WebKit::WebMessagePortChannelArray*) OVERRIDE; |
33 virtual bool tryGetMessage(WebKit::WebString*, | 32 virtual bool tryGetMessage(WebKit::WebString*, |
34 WebKit::WebMessagePortChannelArray&) OVERRIDE; | 33 WebKit::WebMessagePortChannelArray&) OVERRIDE; |
35 | 34 |
| 35 protected: |
| 36 virtual ~TestWebMessagePortChannel(); |
| 37 |
36 private: | 38 private: |
| 39 friend class base::RefCounted<TestWebMessagePortChannel>; |
| 40 |
37 class Message; | 41 class Message; |
| 42 |
38 void queueMessage(Message*); | 43 void queueMessage(Message*); |
39 | 44 |
40 WebKit::WebMessagePortChannelClient* client_; | 45 WebKit::WebMessagePortChannelClient* client_; |
41 scoped_refptr<TestWebMessagePortChannel> remote_; | 46 scoped_refptr<TestWebMessagePortChannel> remote_; |
42 std::queue<Message*> message_queue_; | 47 std::queue<Message*> message_queue_; |
43 | 48 |
44 DISALLOW_COPY_AND_ASSIGN(TestWebMessagePortChannel); | 49 DISALLOW_COPY_AND_ASSIGN(TestWebMessagePortChannel); |
45 }; | 50 }; |
46 | 51 |
47 #endif | 52 #endif |
OLD | NEW |