OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/audio_modem/public/modem.h" | 5 #include "components/audio_modem/public/modem.h" |
6 | 6 |
| 7 #include <memory> |
7 #include <vector> | 8 #include <vector> |
8 | 9 |
9 #include "base/bind.h" | 10 #include "base/bind.h" |
10 #include "base/macros.h" | 11 #include "base/macros.h" |
11 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
12 #include "components/audio_modem/audio_player.h" | 13 #include "components/audio_modem/audio_player.h" |
13 #include "components/audio_modem/audio_recorder.h" | 14 #include "components/audio_modem/audio_recorder.h" |
14 #include "components/audio_modem/modem_impl.h" | 15 #include "components/audio_modem/modem_impl.h" |
15 #include "components/audio_modem/test/random_samples.h" | 16 #include "components/audio_modem/test/random_samples.h" |
16 #include "components/audio_modem/test/stub_whispernet_client.h" | 17 #include "components/audio_modem/test/stub_whispernet_client.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 } else if (token.audible) { | 101 } else if (token.audible) { |
101 last_received_decode_type_ = AUDIBLE; | 102 last_received_decode_type_ = AUDIBLE; |
102 } else { | 103 } else { |
103 last_received_decode_type_ = INAUDIBLE; | 104 last_received_decode_type_ = INAUDIBLE; |
104 } | 105 } |
105 } | 106 } |
106 } | 107 } |
107 | 108 |
108 base::MessageLoop message_loop_; | 109 base::MessageLoop message_loop_; |
109 // This order is important. The WhispernetClient needs to outlive the Modem. | 110 // This order is important. The WhispernetClient needs to outlive the Modem. |
110 scoped_ptr<WhispernetClient> client_; | 111 std::unique_ptr<WhispernetClient> client_; |
111 scoped_ptr<ModemImpl> modem_; | 112 std::unique_ptr<ModemImpl> modem_; |
112 | 113 |
113 // These will be deleted by the Modem's destructor calling finalize on them. | 114 // These will be deleted by the Modem's destructor calling finalize on them. |
114 AudioPlayerStub* audible_player_; | 115 AudioPlayerStub* audible_player_; |
115 AudioPlayerStub* inaudible_player_; | 116 AudioPlayerStub* inaudible_player_; |
116 AudioRecorderStub* recorder_; | 117 AudioRecorderStub* recorder_; |
117 | 118 |
118 AudioType last_received_decode_type_; | 119 AudioType last_received_decode_type_; |
119 | 120 |
120 private: | 121 private: |
121 DISALLOW_COPY_AND_ASSIGN(ModemTest); | 122 DISALLOW_COPY_AND_ASSIGN(ModemTest); |
(...skipping 23 matching lines...) Expand all Loading... |
145 modem_->StartRecording(INAUDIBLE); | 146 modem_->StartRecording(INAUDIBLE); |
146 recorder_->TriggerDecodeRequest(); | 147 recorder_->TriggerDecodeRequest(); |
147 EXPECT_EQ(BOTH, last_received_decode_type_); | 148 EXPECT_EQ(BOTH, last_received_decode_type_); |
148 | 149 |
149 modem_->StopRecording(AUDIBLE); | 150 modem_->StopRecording(AUDIBLE); |
150 recorder_->TriggerDecodeRequest(); | 151 recorder_->TriggerDecodeRequest(); |
151 EXPECT_EQ(INAUDIBLE, last_received_decode_type_); | 152 EXPECT_EQ(INAUDIBLE, last_received_decode_type_); |
152 } | 153 } |
153 | 154 |
154 } // namespace audio_modem | 155 } // namespace audio_modem |
OLD | NEW |