| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/test/webrtc_audio_device_test.h" | 5 #include "content/test/webrtc_audio_device_test.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 | 80 |
| 81 private: | 81 private: |
| 82 DISALLOW_COPY_AND_ASSIGN(WebRTCMockRenderProcess); | 82 DISALLOW_COPY_AND_ASSIGN(WebRTCMockRenderProcess); |
| 83 }; | 83 }; |
| 84 | 84 |
| 85 // Utility scoped class to replace the global content client's renderer for the | 85 // Utility scoped class to replace the global content client's renderer for the |
| 86 // duration of the test. | 86 // duration of the test. |
| 87 class ReplaceContentClientRenderer { | 87 class ReplaceContentClientRenderer { |
| 88 public: | 88 public: |
| 89 explicit ReplaceContentClientRenderer(ContentRendererClient* new_renderer) { | 89 explicit ReplaceContentClientRenderer(ContentRendererClient* new_renderer) { |
| 90 saved_renderer_ = GetContentClient()->renderer(); | 90 saved_renderer_ = SetRendererClientForTesting(new_renderer); |
| 91 GetContentClient()->set_renderer_for_testing(new_renderer); | |
| 92 } | 91 } |
| 93 ~ReplaceContentClientRenderer() { | 92 ~ReplaceContentClientRenderer() { |
| 94 // Restore the original renderer. | 93 // Restore the original renderer. |
| 95 GetContentClient()->set_renderer_for_testing(saved_renderer_); | 94 SetRendererClientForTesting(saved_renderer_); |
| 96 } | 95 } |
| 97 private: | 96 private: |
| 98 ContentRendererClient* saved_renderer_; | 97 ContentRendererClient* saved_renderer_; |
| 99 DISALLOW_COPY_AND_ASSIGN(ReplaceContentClientRenderer); | 98 DISALLOW_COPY_AND_ASSIGN(ReplaceContentClientRenderer); |
| 100 }; | 99 }; |
| 101 | 100 |
| 102 class MockRTCResourceContext : public ResourceContext { | 101 class MockRTCResourceContext : public ResourceContext { |
| 103 public: | 102 public: |
| 104 MockRTCResourceContext() : test_request_context_(NULL) {} | 103 MockRTCResourceContext() : test_request_context_(NULL) {} |
| 105 virtual ~MockRTCResourceContext() {} | 104 virtual ~MockRTCResourceContext() {} |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 int WebRTCTransportImpl::SendPacket(int channel, const void* data, int len) { | 367 int WebRTCTransportImpl::SendPacket(int channel, const void* data, int len) { |
| 369 return network_->ReceivedRTPPacket(channel, data, len); | 368 return network_->ReceivedRTPPacket(channel, data, len); |
| 370 } | 369 } |
| 371 | 370 |
| 372 int WebRTCTransportImpl::SendRTCPPacket(int channel, const void* data, | 371 int WebRTCTransportImpl::SendRTCPPacket(int channel, const void* data, |
| 373 int len) { | 372 int len) { |
| 374 return network_->ReceivedRTCPPacket(channel, data, len); | 373 return network_->ReceivedRTCPPacket(channel, data, len); |
| 375 } | 374 } |
| 376 | 375 |
| 377 } // namespace content | 376 } // namespace content |
| OLD | NEW |