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

Side by Side Diff: components/copresence/rpc/rpc_handler_unittest.cc

Issue 637223011: Redesign the copresence audio handlers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git/+/master
Patch Set: Created 6 years, 2 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
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/rpc/rpc_handler.h" 5 #include "components/copresence/rpc/rpc_handler.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/bind_helpers.h" 12 #include "base/bind_helpers.h"
13 #include "base/message_loop/message_loop.h" 13 #include "base/message_loop/message_loop.h"
14 #include "components/copresence/handlers/directive_handler.h" 14 #include "components/copresence/handlers/directive_handler.h"
15 #include "components/copresence/mediums/audio/audio_manager.h"
15 #include "components/copresence/proto/data.pb.h" 16 #include "components/copresence/proto/data.pb.h"
16 #include "components/copresence/proto/enums.pb.h" 17 #include "components/copresence/proto/enums.pb.h"
17 #include "components/copresence/proto/rpcs.pb.h" 18 #include "components/copresence/proto/rpcs.pb.h"
18 #include "net/http/http_status_code.h" 19 #include "net/http/http_status_code.h"
19 #include "testing/gtest/include/gtest/gtest.h" 20 #include "testing/gtest/include/gtest/gtest.h"
20 21
21 using google::protobuf::MessageLite; 22 using google::protobuf::MessageLite;
22 using google::protobuf::RepeatedPtrField; 23 using google::protobuf::RepeatedPtrField;
23 24
24 namespace copresence { 25 namespace copresence {
(...skipping 15 matching lines...) Expand all
40 class FakeDirectiveHandler : public DirectiveHandler { 41 class FakeDirectiveHandler : public DirectiveHandler {
41 public: 42 public:
42 FakeDirectiveHandler() {} 43 FakeDirectiveHandler() {}
43 virtual ~FakeDirectiveHandler() {} 44 virtual ~FakeDirectiveHandler() {}
44 45
45 const std::vector<Directive>& added_directives() const { 46 const std::vector<Directive>& added_directives() const {
46 return added_directives_; 47 return added_directives_;
47 } 48 }
48 49
49 virtual void Initialize( 50 virtual void Initialize(
50 const AudioRecorder::DecodeSamplesCallback& decode_cb, 51 const AudioManager::DecodeSamplesCallback& decode_cb,
51 const AudioDirectiveHandler::EncodeTokenCallback& encode_cb) override {} 52 const AudioManager::EncodeTokenCallback& encode_cb) override {}
52 53
53 virtual void AddDirective(const Directive& directive) override { 54 virtual void AddDirective(const Directive& directive) override {
54 added_directives_.push_back(directive); 55 added_directives_.push_back(directive);
55 } 56 }
56 57
57 virtual void RemoveDirectives(const std::string& op_id) override { 58 virtual void RemoveDirectives(const std::string& op_id) override {
58 // TODO(ckehoe): Add a parallel implementation when prod has one. 59 // TODO(ckehoe): Add a parallel implementation when prod has one.
59 } 60 }
60 61
61 private: 62 private:
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 messages_by_subscription_["Subscription 2"][1].payload()); 274 messages_by_subscription_["Subscription 2"][1].payload());
274 275
275 ASSERT_EQ(2U, directive_handler->added_directives().size()); 276 ASSERT_EQ(2U, directive_handler->added_directives().size());
276 EXPECT_EQ("Subscription 1", 277 EXPECT_EQ("Subscription 1",
277 directive_handler->added_directives()[0].subscription_id()); 278 directive_handler->added_directives()[0].subscription_id());
278 EXPECT_EQ("Subscription 2", 279 EXPECT_EQ("Subscription 2",
279 directive_handler->added_directives()[1].subscription_id()); 280 directive_handler->added_directives()[1].subscription_id());
280 } 281 }
281 282
282 } // namespace copresence 283 } // namespace copresence
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698