Delete chrome.mediaGalleriesPrivate because the functionality unique to it has since...
[chromium-blink-merge.git] / components / copresence / test / stub_whispernet_client.h
blob33d4fc1b0ddac303d65b97a9301a5284c211ad0f
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.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,
31 const std::string& samples,
32 const size_t token_length[2]) override;
33 void DetectBroadcast() override {}
35 void RegisterTokensCallback(const TokensCallback& tokens_cb) override;
36 void RegisterSamplesCallback(const SamplesCallback& samples_cb) override;
37 void RegisterDetectBroadcastCallback(
38 const SuccessCallback& /* db_cb */) override {}
40 TokensCallback GetTokensCallback() override;
41 SamplesCallback GetSamplesCallback() override;
42 SuccessCallback GetDetectBroadcastCallback() override;
43 SuccessCallback GetInitializedCallback() override;
45 private:
46 bool complete_initialization_;
47 TokensCallback tokens_cb_;
48 SamplesCallback samples_cb_;
49 std::vector<AudioToken> tokens_;
50 scoped_refptr<media::AudioBusRefCounted> samples_;
52 DISALLOW_COPY_AND_ASSIGN(StubWhispernetClient);
55 } // namespace copresence
57 #endif // COMPONENTS_COPRESENCE_TEST_STUB_WHISPERNET_CLIENT_H_