Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(252)

Side by Side Diff: components/copresence/handlers/audio/audio_directive_handler_unittest.cc

Issue 460743004: Improve audible token detection. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « chrome/common/extensions/api/copresence_private.idl ('k') | components/copresence/handlers/audio/audio_directive_list.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698