summaryrefslogtreecommitdiffstats
path: root/chromecast/net/fake_connectivity_checker.h
blob: 411b0489b876238705587e5374fa9bcf7fc3ab2c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "base/macros.h"
#include "chromecast/net/connectivity_checker.h"

namespace chromecast {

// A simple fake connectivity checker for testing. Will appeared to be
// connected by default.
class FakeConnectivityChecker : public ConnectivityChecker {
 public:
  FakeConnectivityChecker();

  // ConnectivityChecker implementation:
  bool Connected() const override;
  void Check() override;

  // Sets connectivity and notifies observers if it has changed.
  void SetConnectedForTest(bool connected);

 protected:
  ~FakeConnectivityChecker() override;

 private:
  friend class base::RefCountedThreadSafe<FakeConnectivityChecker>;
  bool connected_;

  DISALLOW_COPY_AND_ASSIGN(FakeConnectivityChecker);
};

}  // namespace chromecast