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/location.h" |
8 #include "base/macros.h" | 9 #include "base/macros.h" |
9 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
10 #include "base/run_loop.h" | 11 #include "base/run_loop.h" |
| 12 #include "base/single_thread_task_runner.h" |
| 13 #include "base/thread_task_runner_handle.h" |
11 #include "chrome/browser/media/webrtc_rtp_dump_handler.h" | 14 #include "chrome/browser/media/webrtc_rtp_dump_handler.h" |
12 #include "chrome/browser/media/webrtc_rtp_dump_writer.h" | 15 #include "chrome/browser/media/webrtc_rtp_dump_writer.h" |
13 #include "content/public/test/test_browser_thread_bundle.h" | 16 #include "content/public/test/test_browser_thread_bundle.h" |
14 #include "testing/gmock/include/gmock/gmock.h" | 17 #include "testing/gmock/include/gmock/gmock.h" |
15 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
16 | 19 |
17 class FakeDumpWriter : public WebRtcRtpDumpWriter { | 20 class FakeDumpWriter : public WebRtcRtpDumpWriter { |
18 public: | 21 public: |
19 FakeDumpWriter(size_t max_dump_size, | 22 FakeDumpWriter(size_t max_dump_size, |
20 const base::Closure& max_size_reached_callback, | 23 const base::Closure& max_size_reached_callback, |
(...skipping 19 matching lines...) Expand all Loading... |
40 void EndDump(RtpDumpType type, | 43 void EndDump(RtpDumpType type, |
41 const EndDumpCallback& finished_callback) override { | 44 const EndDumpCallback& finished_callback) override { |
42 bool incoming_sucess = end_dump_success_; | 45 bool incoming_sucess = end_dump_success_; |
43 bool outgoing_success = end_dump_success_; | 46 bool outgoing_success = end_dump_success_; |
44 | 47 |
45 if (type == RTP_DUMP_INCOMING) | 48 if (type == RTP_DUMP_INCOMING) |
46 outgoing_success = false; | 49 outgoing_success = false; |
47 else if (type == RTP_DUMP_OUTGOING) | 50 else if (type == RTP_DUMP_OUTGOING) |
48 incoming_sucess = false; | 51 incoming_sucess = false; |
49 | 52 |
50 base::MessageLoop::current()->PostTask( | 53 base::ThreadTaskRunnerHandle::Get()->PostTask( |
51 FROM_HERE, | 54 FROM_HERE, |
52 base::Bind(finished_callback, incoming_sucess, outgoing_success)); | 55 base::Bind(finished_callback, incoming_sucess, outgoing_success)); |
53 } | 56 } |
54 | 57 |
55 private: | 58 private: |
56 size_t max_dump_size_; | 59 size_t max_dump_size_; |
57 size_t current_dump_size_; | 60 size_t current_dump_size_; |
58 base::Closure max_size_reached_callback_; | 61 base::Closure max_size_reached_callback_; |
59 bool end_dump_success_; | 62 bool end_dump_success_; |
60 }; | 63 }; |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 this, &WebRtcRtpDumpHandlerTest::DeleteDumpHandler)); | 405 this, &WebRtcRtpDumpHandlerTest::DeleteDumpHandler)); |
403 | 406 |
404 EXPECT_TRUE(handler_->StartDump(RTP_DUMP_BOTH, &error)); | 407 EXPECT_TRUE(handler_->StartDump(RTP_DUMP_BOTH, &error)); |
405 | 408 |
406 handler_->StopOngoingDumps( | 409 handler_->StopOngoingDumps( |
407 base::Bind(&WebRtcRtpDumpHandlerTest::OnStopOngoingDumpsFinished, | 410 base::Bind(&WebRtcRtpDumpHandlerTest::OnStopOngoingDumpsFinished, |
408 base::Unretained(this))); | 411 base::Unretained(this))); |
409 | 412 |
410 base::RunLoop().RunUntilIdle(); | 413 base::RunLoop().RunUntilIdle(); |
411 } | 414 } |
OLD | NEW |