-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement skeleton MediaRouterDebugger class.
Implements a skeleton MediaRouterDebugger interface. Eventually additional API's will be implemented for fetching debugging stats. Additionally a simple impl has been created that enables and disables Rtcp reporting. Bug: b/265820417 Change-Id: I4fb3e9e6008feb8feebd2575c9bb50a4c820e43b Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4196076 Commit-Queue: george benz <gbj@google.com> Reviewed-by: Mark Foltz <mfoltz@chromium.org> Cr-Commit-Position: refs/heads/main@{#1099004}
- Loading branch information
George Benz
authored and
Chromium LUCI CQ
committed
Jan 31, 2023
1 parent
9e3d792
commit 8635d52
Showing
8 changed files
with
120 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// 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 "components/media_router/browser/media_router_debugger.h" | ||
|
||
#include "media/base/media_switches.h" | ||
|
||
namespace media_router { | ||
|
||
MediaRouterDebugger::MediaRouterDebugger() = default; | ||
MediaRouterDebugger::~MediaRouterDebugger() = default; | ||
|
||
void MediaRouterDebugger::EnableRtcpReports() { | ||
is_rtcp_reports_enabled_ = true; | ||
} | ||
|
||
void MediaRouterDebugger::DisableRtcpReports() { | ||
is_rtcp_reports_enabled_ = false; | ||
} | ||
|
||
bool MediaRouterDebugger::IsRtcpReportsEnabled() const { | ||
return is_rtcp_reports_enabled_ && | ||
base::FeatureList::IsEnabled(media::kEnableRtcpReporting); | ||
} | ||
|
||
} // namespace media_router |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// 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. | ||
|
||
#ifndef COMPONENTS_MEDIA_ROUTER_BROWSER_MEDIA_ROUTER_DEBUGGER_H_ | ||
#define COMPONENTS_MEDIA_ROUTER_BROWSER_MEDIA_ROUTER_DEBUGGER_H_ | ||
|
||
namespace media_router { | ||
|
||
// An interface for media router debugging and feedback. | ||
class MediaRouterDebugger { | ||
public: | ||
MediaRouterDebugger(); | ||
|
||
MediaRouterDebugger(const MediaRouterDebugger&) = delete; | ||
MediaRouterDebugger& operator=(const MediaRouterDebugger&) = delete; | ||
|
||
virtual ~MediaRouterDebugger(); | ||
|
||
void EnableRtcpReports(); | ||
void DisableRtcpReports(); | ||
|
||
bool IsRtcpReportsEnabled() const; | ||
|
||
protected: | ||
bool is_rtcp_reports_enabled_ = false; | ||
}; | ||
|
||
} // namespace media_router | ||
|
||
#endif // COMPONENTS_MEDIA_ROUTER_BROWSER_MEDIA_ROUTER_DEBUGGER_H_ |
43 changes: 43 additions & 0 deletions
43
components/media_router/browser/media_router_debugger_unittest.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// 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 "components/media_router/browser/media_router_debugger.h" | ||
|
||
#include "base/test/scoped_feature_list.h" | ||
#include "content/public/test/browser_task_environment.h" | ||
#include "media/base/media_switches.h" | ||
#include "testing/gtest/include/gtest/gtest.h" | ||
|
||
namespace media_router { | ||
|
||
class MediaRouterDebuggerTest : public ::testing::Test { | ||
public: | ||
MediaRouterDebuggerTest() | ||
: debugger_(std::make_unique<MediaRouterDebugger>()) {} | ||
MediaRouterDebuggerTest(const MediaRouterDebuggerTest&) = delete; | ||
~MediaRouterDebuggerTest() override = default; | ||
MediaRouterDebuggerTest& operator=(const MediaRouterDebuggerTest&) = delete; | ||
|
||
protected: | ||
std::unique_ptr<MediaRouterDebugger> debugger_; | ||
content::BrowserTaskEnvironment test_environment_; | ||
}; | ||
|
||
TEST_F(MediaRouterDebuggerTest, TestIsRtcpReportsEnabled) { | ||
// Tests default condition. | ||
EXPECT_FALSE(debugger_->IsRtcpReportsEnabled()); | ||
|
||
// Reports should still be disabled since we the feature flag has not been | ||
// set. | ||
debugger_->EnableRtcpReports(); | ||
EXPECT_FALSE(debugger_->IsRtcpReportsEnabled()); | ||
|
||
// All conditions should be met and the function should return true now. | ||
base::test::ScopedFeatureList feature_list; | ||
feature_list.InitWithFeatures({media::kEnableRtcpReporting}, {}); | ||
|
||
EXPECT_TRUE(debugger_->IsRtcpReportsEnabled()); | ||
} | ||
|
||
} // namespace media_router |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters