Mac: Fix performance issues with remote CoreAnimation
[chromium-blink-merge.git] / components / copresence / test / stub_whispernet_client.h
blob836e443fab26ee306ad130f0d5cfd036c7b31ce0
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
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_COPRESENCE_TEST_STUB_WHISPERNET_CLIENT_H_
6 #define COMPONENTS_COPRESENCE_TEST_STUB_WHISPERNET_CLIENT_H_
8 #include <string>
9 #include <vector>
11 #include "base/callback_forward.h"
12 #include "base/macros.h"
13 #include "components/copresence/public/whispernet_client.h"
15 namespace copresence {
17 // A simple WhispernetClient for testing.
18 class StubWhispernetClient final : public WhispernetClient {
19 public:
20 // Constructor. The client can optionally be configured to respond
21 // as if Initialize() has completed. By default it does not.
22 explicit StubWhispernetClient(bool complete_initialization = false);
24 ~StubWhispernetClient() override;
26 void Initialize(const SuccessCallback& init_callback) override;
27 void Shutdown() override {}
29 void EncodeToken(const std::string& token, AudioType type) override;
30 void DecodeSamples(AudioType type, const std::string& samples) override;
31 void DetectBroadcast() override {}
33 void RegisterTokensCallback(const TokensCallback& tokens_cb) override;
34 void RegisterSamplesCallback(const SamplesCallback& samples_cb) override;
35 void RegisterDetectBroadcastCallback(
36 const SuccessCallback& /* db_cb */) override {}
38 TokensCallback GetTokensCallback() override;
39 SamplesCallback GetSamplesCallback() override;
40 SuccessCallback GetDetectBroadcastCallback() override;
41 SuccessCallback GetInitializedCallback() override;
43 private:
44 bool complete_initialization_;
45 TokensCallback tokens_cb_;
46 SamplesCallback samples_cb_;
47 std::vector<AudioToken> tokens_;
48 scoped_refptr<media::AudioBusRefCounted> samples_;
50 DISALLOW_COPY_AND_ASSIGN(StubWhispernetClient);
53 } // namespace copresence
55 #endif // COMPONENTS_COPRESENCE_TEST_STUB_WHISPERNET_CLIENT_H_