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 #include "content/shell/renderer/test_runner/mock_webrtc_data_channel_handler.h" | 5 #include "content/shell/renderer/test_runner/mock_webrtc_data_channel_handler.h" |
6 | 6 |
7 #include <assert.h> | 7 #include "base/logging.h" |
8 | |
9 #include "content/shell/renderer/test_runner/WebTestDelegate.h" | 8 #include "content/shell/renderer/test_runner/WebTestDelegate.h" |
10 #include "third_party/WebKit/public/platform/WebRTCDataChannelHandlerClient.h" | 9 #include "third_party/WebKit/public/platform/WebRTCDataChannelHandlerClient.h" |
11 | 10 |
12 using namespace blink; | 11 using namespace blink; |
13 | 12 |
14 namespace content { | 13 namespace content { |
15 | 14 |
16 class DataChannelReadyStateTask | 15 class DataChannelReadyStateTask |
17 : public WebMethodTask<MockWebRTCDataChannelHandler> { | 16 : public WebMethodTask<MockWebRTCDataChannelHandler> { |
18 public: | 17 public: |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 | 80 |
82 unsigned short MockWebRTCDataChannelHandler::id() const { | 81 unsigned short MockWebRTCDataChannelHandler::id() const { |
83 return init_.id; | 82 return init_.id; |
84 } | 83 } |
85 | 84 |
86 unsigned long MockWebRTCDataChannelHandler::bufferedAmount() { | 85 unsigned long MockWebRTCDataChannelHandler::bufferedAmount() { |
87 return 0; | 86 return 0; |
88 } | 87 } |
89 | 88 |
90 bool MockWebRTCDataChannelHandler::sendStringData(const WebString& data) { | 89 bool MockWebRTCDataChannelHandler::sendStringData(const WebString& data) { |
91 assert(client_); | 90 DCHECK(client_); |
92 client_->didReceiveStringData(data); | 91 client_->didReceiveStringData(data); |
93 return true; | 92 return true; |
94 } | 93 } |
95 | 94 |
96 bool MockWebRTCDataChannelHandler::sendRawData(const char* data, size_t size) { | 95 bool MockWebRTCDataChannelHandler::sendRawData(const char* data, size_t size) { |
97 assert(client_); | 96 DCHECK(client_); |
98 client_->didReceiveRawData(data, size); | 97 client_->didReceiveRawData(data, size); |
99 return true; | 98 return true; |
100 } | 99 } |
101 | 100 |
102 void MockWebRTCDataChannelHandler::close() { | 101 void MockWebRTCDataChannelHandler::close() { |
103 assert(client_); | 102 DCHECK(client_); |
104 delegate_->postTask(new DataChannelReadyStateTask( | 103 delegate_->postTask(new DataChannelReadyStateTask( |
105 this, client_, WebRTCDataChannelHandlerClient::ReadyStateClosed)); | 104 this, client_, WebRTCDataChannelHandlerClient::ReadyStateClosed)); |
106 } | 105 } |
107 | 106 |
108 } // namespace content | 107 } // namespace content |
OLD | NEW |