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 "components/copresence/handlers/audio/audio_directive_handler.h" | 5 #include "components/copresence/handlers/audio/audio_directive_handler.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "components/copresence/test/audio_test_support.h" | 9 #include "components/copresence/test/audio_test_support.h" |
10 #include "media/base/audio_bus.h" | 10 #include "media/base/audio_bus.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 : directive_handler_(new MockAudioDirectiveHandler( | 40 : directive_handler_(new MockAudioDirectiveHandler( |
41 base::Bind(&AudioDirectiveHandlerTest::EncodeToken, | 41 base::Bind(&AudioDirectiveHandlerTest::EncodeToken, |
42 base::Unretained(this)))) {} | 42 base::Unretained(this)))) {} |
43 | 43 |
44 virtual ~AudioDirectiveHandlerTest() {} | 44 virtual ~AudioDirectiveHandlerTest() {} |
45 | 45 |
46 void DirectiveAdded() {} | 46 void DirectiveAdded() {} |
47 | 47 |
48 protected: | 48 protected: |
49 void EncodeToken(const std::string& token, | 49 void EncodeToken(const std::string& token, |
50 bool /* audible */, | 50 bool audible, |
51 const AudioDirectiveList::SamplesCallback& callback) { | 51 const AudioDirectiveList::SamplesCallback& callback) { |
52 callback.Run(token, CreateRandomAudioRefCounted(0x1337, 1, 0x7331)); | 52 callback.Run( |
| 53 token, audible, CreateRandomAudioRefCounted(0x1337, 1, 0x7331)); |
53 } | 54 } |
54 | 55 |
55 copresence::TokenInstruction CreateTransmitInstruction( | 56 copresence::TokenInstruction CreateTransmitInstruction( |
56 const std::string& token) { | 57 const std::string& token) { |
57 copresence::TokenInstruction instruction; | 58 copresence::TokenInstruction instruction; |
58 instruction.set_token_instruction_type(copresence::TRANSMIT); | 59 instruction.set_token_instruction_type(copresence::TRANSMIT); |
59 instruction.set_token_id(token); | 60 instruction.set_token_id(token); |
60 return instruction; | 61 return instruction; |
61 } | 62 } |
62 | 63 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 directive_handler_->AddInstruction(CreateReceiveInstruction(), kLargeTtl); | 100 directive_handler_->AddInstruction(CreateReceiveInstruction(), kLargeTtl); |
100 directive_handler_->AddInstruction(CreateReceiveInstruction(), kSmallTtl); | 101 directive_handler_->AddInstruction(CreateReceiveInstruction(), kSmallTtl); |
101 directive_handler_->AddInstruction(CreateReceiveInstruction(), kLargeTtl); | 102 directive_handler_->AddInstruction(CreateReceiveInstruction(), kLargeTtl); |
102 } | 103 } |
103 | 104 |
104 // TODO(rkc): When we are keeping track of which token we're currently playing, | 105 // TODO(rkc): When we are keeping track of which token we're currently playing, |
105 // add tests to make sure we don't replay if we get a token with a lower ttl | 106 // add tests to make sure we don't replay if we get a token with a lower ttl |
106 // than the current active. | 107 // than the current active. |
107 | 108 |
108 } // namespace copresence | 109 } // namespace copresence |
OLD | NEW |