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

Side by Side Diff: components/copresence/handlers/audio/audio_directive_list_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_list.h" 5 #include "components/copresence/handlers/audio/audio_directive_list.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "components/copresence/test/audio_test_support.h" 10 #include "components/copresence/test/audio_test_support.h"
11 #include "media/base/audio_bus.h" 11 #include "media/base/audio_bus.h"
12 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
13 13
14 namespace copresence { 14 namespace copresence {
15 15
16 class AudioDirectiveListTest : public testing::Test { 16 class AudioDirectiveListTest : public testing::Test {
17 public: 17 public:
18 AudioDirectiveListTest() 18 AudioDirectiveListTest()
19 : directive_list_(new AudioDirectiveList( 19 : directive_list_(new AudioDirectiveList(
20 base::Bind(&AudioDirectiveListTest::EncodeToken, 20 base::Bind(&AudioDirectiveListTest::EncodeToken,
21 base::Unretained(this)), 21 base::Unretained(this),
22 true),
22 base::Bind(&base::DoNothing))) {} 23 base::Bind(&base::DoNothing))) {}
23 24
24 virtual ~AudioDirectiveListTest() {} 25 virtual ~AudioDirectiveListTest() {}
25 26
26 protected: 27 protected:
27 void EncodeToken(const std::string& token, 28 void EncodeToken(const std::string& token,
29 bool /* audible */,
28 const AudioDirectiveList::SamplesCallback& callback) { 30 const AudioDirectiveList::SamplesCallback& callback) {
29 callback.Run(token, CreateRandomAudioRefCounted(0x1337, 1, 0x7331)); 31 callback.Run(token, CreateRandomAudioRefCounted(0x1337, 1, 0x7331));
30 } 32 }
31 33
32 base::MessageLoop message_loop_; 34 base::MessageLoop message_loop_;
33 scoped_ptr<AudioDirectiveList> directive_list_; 35 scoped_ptr<AudioDirectiveList> directive_list_;
34 }; 36 };
35 37
36 // TODO(rkc): Find and fix the memory leak here. 38 // TODO(rkc): Find and fix the memory leak here.
37 #define MAYBE_Basic DISABLED_Basic 39 #define MAYBE_Basic DISABLED_Basic
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 directive_list_->AddReceiveDirective("op_id3", kLargeTtl); 81 directive_list_->AddReceiveDirective("op_id3", kLargeTtl);
80 directive_list_->AddReceiveDirective("op_id7", kLargeTtl); 82 directive_list_->AddReceiveDirective("op_id7", kLargeTtl);
81 83
82 // Should keep getting the directive till it expires or we add a newer one. 84 // Should keep getting the directive till it expires or we add a newer one.
83 EXPECT_EQ("op_id7", directive_list_->GetNextReceive()->op_id); 85 EXPECT_EQ("op_id7", directive_list_->GetNextReceive()->op_id);
84 EXPECT_EQ("op_id7", directive_list_->GetNextReceive()->op_id); 86 EXPECT_EQ("op_id7", directive_list_->GetNextReceive()->op_id);
85 EXPECT_EQ("op_id7", directive_list_->GetNextReceive()->op_id); 87 EXPECT_EQ("op_id7", directive_list_->GetNextReceive()->op_id);
86 } 88 }
87 89
88 } // namespace copresence 90 } // namespace copresence
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698