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

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

Issue 453793002: Add audible support to the copresence API. (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 const AudioDirectiveList::SamplesCallback& callback) { 51 const AudioDirectiveList::SamplesCallback& callback) {
51 callback.Run(token, CreateRandomAudioRefCounted(0x1337, 1, 0x7331)); 52 callback.Run(token, CreateRandomAudioRefCounted(0x1337, 1, 0x7331));
52 } 53 }
53 54
54 copresence::TokenInstruction CreateTransmitInstruction( 55 copresence::TokenInstruction CreateTransmitInstruction(
55 const std::string& token) { 56 const std::string& token) {
56 copresence::TokenInstruction instruction; 57 copresence::TokenInstruction instruction;
57 instruction.set_token_instruction_type(copresence::TRANSMIT); 58 instruction.set_token_instruction_type(copresence::TRANSMIT);
58 instruction.set_token_id(token); 59 instruction.set_token_id(token);
59 return instruction; 60 return instruction;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 directive_handler_->AddInstruction(CreateReceiveInstruction(), kLargeTtl); 99 directive_handler_->AddInstruction(CreateReceiveInstruction(), kLargeTtl);
99 directive_handler_->AddInstruction(CreateReceiveInstruction(), kSmallTtl); 100 directive_handler_->AddInstruction(CreateReceiveInstruction(), kSmallTtl);
100 directive_handler_->AddInstruction(CreateReceiveInstruction(), kLargeTtl); 101 directive_handler_->AddInstruction(CreateReceiveInstruction(), kLargeTtl);
101 } 102 }
102 103
103 // TODO(rkc): When we are keeping track of which token we're currently playing, 104 // TODO(rkc): When we are keeping track of which token we're currently playing,
104 // add tests to make sure we don't replay if we get a token with a lower ttl 105 // add tests to make sure we don't replay if we get a token with a lower ttl
105 // than the current active. 106 // than the current active.
106 107
107 } // namespace copresence 108 } // namespace copresence
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698