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
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65
   66
   67
   68
   69
   70

ash / public / cpp / test / test_cast_config_controller.cc [blame]

// Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "ash/public/cpp/test/test_cast_config_controller.h"

#include <utility>

#include "base/functional/callback.h"

namespace ash {

TestCastConfigController::TestCastConfigController() = default;

TestCastConfigController::~TestCastConfigController() = default;

void TestCastConfigController::AddSinkAndRoute(
    const SinkAndRoute& sink_and_route) {
  sinks_and_routes_.push_back(sink_and_route);
}

void TestCastConfigController::ResetRouteIds() {
  stop_casting_route_id_.clear();
  freeze_route_route_id_.clear();
  unfreeze_route_route_id_.clear();
}

bool TestCastConfigController::HasMediaRouterForPrimaryProfile() const {
  return has_media_router_;
}

bool TestCastConfigController::HasSinksAndRoutes() const {
  return has_sinks_and_routes_;
}

bool TestCastConfigController::HasActiveRoute() const {
  return has_active_route_;
}

bool TestCastConfigController::AccessCodeCastingEnabled() const {
  return access_code_casting_enabled_;
}

const std::vector<SinkAndRoute>& TestCastConfigController::GetSinksAndRoutes() {
  return sinks_and_routes_;
}

void TestCastConfigController::CastToSink(const std::string& sink_id) {
  ++cast_to_sink_count_;
  if (cast_to_sink_closure_) {
    std::move(cast_to_sink_closure_).Run();
  }
}

void TestCastConfigController::StopCasting(const std::string& route_id) {
  ++stop_casting_count_;
  stop_casting_route_id_ = route_id;
}

void TestCastConfigController::FreezeRoute(const std::string& route_id) {
  ++freeze_route_count_;
  freeze_route_route_id_ = route_id;
}

void TestCastConfigController::UnfreezeRoute(const std::string& route_id) {
  ++unfreeze_route_count_;
  unfreeze_route_route_id_ = route_id;
}

}  // namespace ash