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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/files/file_util.h" | 6 #include "base/files/file_util.h" |
7 #include "base/files/scoped_temp_dir.h" | 7 #include "base/files/scoped_temp_dir.h" |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 max_dump_size, | 24 max_dump_size, |
25 base::Closure()), | 25 base::Closure()), |
26 max_dump_size_(max_dump_size), | 26 max_dump_size_(max_dump_size), |
27 current_dump_size_(0), | 27 current_dump_size_(0), |
28 max_size_reached_callback_(max_size_reached_callback), | 28 max_size_reached_callback_(max_size_reached_callback), |
29 end_dump_success_(end_dump_success) {} | 29 end_dump_success_(end_dump_success) {} |
30 | 30 |
31 virtual void WriteRtpPacket(const uint8* packet_header, | 31 virtual void WriteRtpPacket(const uint8* packet_header, |
32 size_t header_length, | 32 size_t header_length, |
33 size_t packet_length, | 33 size_t packet_length, |
34 bool incoming) OVERRIDE { | 34 bool incoming) override { |
35 current_dump_size_ += header_length; | 35 current_dump_size_ += header_length; |
36 if (current_dump_size_ > max_dump_size_) | 36 if (current_dump_size_ > max_dump_size_) |
37 max_size_reached_callback_.Run(); | 37 max_size_reached_callback_.Run(); |
38 } | 38 } |
39 | 39 |
40 virtual void EndDump(RtpDumpType type, | 40 virtual void EndDump(RtpDumpType type, |
41 const EndDumpCallback& finished_callback) OVERRIDE { | 41 const EndDumpCallback& finished_callback) override { |
42 bool incoming_sucess = end_dump_success_; | 42 bool incoming_sucess = end_dump_success_; |
43 bool outgoing_success = end_dump_success_; | 43 bool outgoing_success = end_dump_success_; |
44 | 44 |
45 if (type == RTP_DUMP_INCOMING) | 45 if (type == RTP_DUMP_INCOMING) |
46 outgoing_success = false; | 46 outgoing_success = false; |
47 else if (type == RTP_DUMP_OUTGOING) | 47 else if (type == RTP_DUMP_OUTGOING) |
48 incoming_sucess = false; | 48 incoming_sucess = false; |
49 | 49 |
50 base::MessageLoop::current()->PostTask( | 50 base::MessageLoop::current()->PostTask( |
51 FROM_HERE, | 51 FROM_HERE, |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 this, &WebRtcRtpDumpHandlerTest::DeleteDumpHandler)); | 402 this, &WebRtcRtpDumpHandlerTest::DeleteDumpHandler)); |
403 | 403 |
404 EXPECT_TRUE(handler_->StartDump(RTP_DUMP_BOTH, &error)); | 404 EXPECT_TRUE(handler_->StartDump(RTP_DUMP_BOTH, &error)); |
405 | 405 |
406 handler_->StopOngoingDumps( | 406 handler_->StopOngoingDumps( |
407 base::Bind(&WebRtcRtpDumpHandlerTest::OnStopOngoingDumpsFinished, | 407 base::Bind(&WebRtcRtpDumpHandlerTest::OnStopOngoingDumpsFinished, |
408 base::Unretained(this))); | 408 base::Unretained(this))); |
409 | 409 |
410 base::RunLoop().RunUntilIdle(); | 410 base::RunLoop().RunUntilIdle(); |
411 } | 411 } |
OLD | NEW |