| 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 "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "content/shell/renderer/test_runner/WebTestDelegate.h" | 8 #include "content/shell/renderer/test_runner/WebTestDelegate.h" |
| 9 #include "third_party/WebKit/public/platform/WebRTCDataChannelHandlerClient.h" | 9 #include "third_party/WebKit/public/platform/WebRTCDataChannelHandlerClient.h" |
| 10 | 10 |
| 11 using namespace blink; | 11 using namespace blink; |
| 12 | 12 |
| 13 namespace content { | 13 namespace content { |
| 14 | 14 |
| 15 class DataChannelReadyStateTask | 15 class DataChannelReadyStateTask |
| 16 : public WebMethodTask<MockWebRTCDataChannelHandler> { | 16 : public WebMethodTask<MockWebRTCDataChannelHandler> { |
| 17 public: | 17 public: |
| 18 DataChannelReadyStateTask(MockWebRTCDataChannelHandler* object, | 18 DataChannelReadyStateTask(MockWebRTCDataChannelHandler* object, |
| 19 WebRTCDataChannelHandlerClient* data_channel_client, | 19 WebRTCDataChannelHandlerClient* data_channel_client, |
| 20 WebRTCDataChannelHandlerClient::ReadyState state) | 20 WebRTCDataChannelHandlerClient::ReadyState state) |
| 21 : WebMethodTask<MockWebRTCDataChannelHandler>(object), | 21 : WebMethodTask<MockWebRTCDataChannelHandler>(object), |
| 22 data_channel_client_(data_channel_client), | 22 data_channel_client_(data_channel_client), |
| 23 state_(state) {} | 23 state_(state) {} |
| 24 | 24 |
| 25 virtual void runIfValid() OVERRIDE { | 25 virtual void RunIfValid() OVERRIDE { |
| 26 data_channel_client_->didChangeReadyState(state_); | 26 data_channel_client_->didChangeReadyState(state_); |
| 27 } | 27 } |
| 28 | 28 |
| 29 private: | 29 private: |
| 30 WebRTCDataChannelHandlerClient* data_channel_client_; | 30 WebRTCDataChannelHandlerClient* data_channel_client_; |
| 31 WebRTCDataChannelHandlerClient::ReadyState state_; | 31 WebRTCDataChannelHandlerClient::ReadyState state_; |
| 32 }; | 32 }; |
| 33 | 33 |
| 34 ///////////////////// | 34 ///////////////////// |
| 35 | 35 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 return true; | 98 return true; |
| 99 } | 99 } |
| 100 | 100 |
| 101 void MockWebRTCDataChannelHandler::close() { | 101 void MockWebRTCDataChannelHandler::close() { |
| 102 DCHECK(client_); | 102 DCHECK(client_); |
| 103 delegate_->postTask(new DataChannelReadyStateTask( | 103 delegate_->postTask(new DataChannelReadyStateTask( |
| 104 this, client_, WebRTCDataChannelHandlerClient::ReadyStateClosed)); | 104 this, client_, WebRTCDataChannelHandlerClient::ReadyStateClosed)); |
| 105 } | 105 } |
| 106 | 106 |
| 107 } // namespace content | 107 } // namespace content |
| OLD | NEW |