12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- // Copyright 2020 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 "ash/components/phonehub/fake_tether_controller.h"
- namespace ash {
- namespace phonehub {
- FakeTetherController::FakeTetherController()
- : status_(Status::kConnectionAvailable) {}
- FakeTetherController::~FakeTetherController() = default;
- void FakeTetherController::SetStatus(Status status) {
- if (status_ == status)
- return;
- status_ = status;
- NotifyStatusChanged();
- }
- TetherController::Status FakeTetherController::GetStatus() const {
- return status_;
- }
- void FakeTetherController::ScanForAvailableConnection() {
- num_scan_for_available_connection_calls_++;
- if (status_ == Status::kConnectionUnavailable)
- SetStatus(Status::kConnectionAvailable);
- }
- void FakeTetherController::AttemptConnection() {
- if (status_ == Status::kConnectionUnavailable ||
- status_ == Status::kConnectionAvailable) {
- SetStatus(Status::kConnecting);
- }
- }
- void FakeTetherController::Disconnect() {
- if (status_ == Status::kConnecting || status_ == Status::kConnected)
- SetStatus(Status::kConnecting);
- }
- } // namespace phonehub
- } // namespace ash
|