diff --git a/chrome/browser/media/router/BUILD.gn b/chrome/browser/media/router/BUILD.gn index 1472a994594853..b93c296f06190a 100644 --- a/chrome/browser/media/router/BUILD.gn +++ b/chrome/browser/media/router/BUILD.gn @@ -169,8 +169,6 @@ if (!is_android) { "test/media_router_mojo_test.h", "test/mock_dns_sd_registry.cc", "test/mock_dns_sd_registry.h", - "test/mock_logger.cc", - "test/mock_logger.h", "test/mock_mojo_media_router.cc", "test/mock_mojo_media_router.h", "test/noop_dual_media_sink_service.cc", diff --git a/chrome/browser/media/router/providers/cast/cast_activity_manager_unittest.cc b/chrome/browser/media/router/providers/cast/cast_activity_manager_unittest.cc index 5df8f773278d45..e2e3245b467b96 100644 --- a/chrome/browser/media/router/providers/cast/cast_activity_manager_unittest.cc +++ b/chrome/browser/media/router/providers/cast/cast_activity_manager_unittest.cc @@ -25,12 +25,12 @@ #include "chrome/browser/media/router/providers/cast/mock_app_activity.h" #include "chrome/browser/media/router/providers/cast/test_util.h" #include "chrome/browser/media/router/providers/common/buffered_message_sender.h" -#include "chrome/browser/media/router/test/mock_logger.h" #include "chrome/browser/media/router/test/mock_mojo_media_router.h" #include "chrome/browser/media/router/test/provider_test_helpers.h" #include "components/cast_channel/cast_message_util.h" #include "components/cast_channel/cast_test_util.h" #include "components/media_router/common/media_source.h" +#include "components/media_router/common/test/mock_logger.h" #include "components/media_router/common/test/test_helper.h" #include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" diff --git a/chrome/browser/media/router/test/mock_logger.h b/chrome/browser/media/router/test/mock_logger.h deleted file mode 100644 index de7f48c1198903..00000000000000 --- a/chrome/browser/media/router/test/mock_logger.h +++ /dev/null @@ -1,43 +0,0 @@ -// 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. - -#ifndef CHROME_BROWSER_MEDIA_ROUTER_TEST_MOCK_LOGGER_H_ -#define CHROME_BROWSER_MEDIA_ROUTER_TEST_MOCK_LOGGER_H_ - -#include "components/media_router/common/mojom/logger.mojom.h" -#include "testing/gmock/include/gmock/gmock.h" - -namespace media_router { - -class MockLogger : public mojom::Logger { - public: - MockLogger(); - ~MockLogger() override; - - MOCK_METHOD6(LogInfo, - void(mojom::LogCategory category, - const std::string& component, - const std::string& message, - const std::string& sink_id, - const std::string& media_source, - const std::string& session_id)); - MOCK_METHOD6(LogWarning, - void(mojom::LogCategory category, - const std::string& component, - const std::string& message, - const std::string& sink_id, - const std::string& media_source, - const std::string& session_id)); - MOCK_METHOD6(LogError, - void(mojom::LogCategory category, - const std::string& component, - const std::string& message, - const std::string& sink_id, - const std::string& media_source, - const std::string& session_id)); -}; - -} // namespace media_router - -#endif // CHROME_BROWSER_MEDIA_ROUTER_TEST_MOCK_LOGGER_H_ diff --git a/components/media_router/common/BUILD.gn b/components/media_router/common/BUILD.gn index 17caf2f44222f8..d72b987056c184 100644 --- a/components/media_router/common/BUILD.gn +++ b/components/media_router/common/BUILD.gn @@ -54,9 +54,12 @@ static_library("test_support") { deps = [ "//base", "//base/test:test_support", + "//components/media_router/common/mojom:logger", ] public_deps = [ ":common" ] sources = [ + "test/mock_logger.cc", + "test/mock_logger.h", "test/test_helper.cc", "test/test_helper.h", ] diff --git a/components/media_router/common/DEPS b/components/media_router/common/DEPS index 674b34dfca852a..356dd7fdb63a74 100644 --- a/components/media_router/common/DEPS +++ b/components/media_router/common/DEPS @@ -1,3 +1,4 @@ include_rules = [ "+url", + "+mojo", ] diff --git a/chrome/browser/media/router/test/mock_logger.cc b/components/media_router/common/test/mock_logger.cc similarity index 82% rename from chrome/browser/media/router/test/mock_logger.cc rename to components/media_router/common/test/mock_logger.cc index f755f9ff2d315f..c5e3231bcfac20 100644 --- a/chrome/browser/media/router/test/mock_logger.cc +++ b/components/media_router/common/test/mock_logger.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/media/router/test/mock_logger.h" +#include "components/media_router/common/test/mock_logger.h" namespace media_router { diff --git a/components/media_router/common/test/mock_logger.h b/components/media_router/common/test/mock_logger.h new file mode 100644 index 00000000000000..4b84a1a6603710 --- /dev/null +++ b/components/media_router/common/test/mock_logger.h @@ -0,0 +1,48 @@ +// 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. + +#ifndef COMPONENTS_MEDIA_ROUTER_COMMON_TEST_MOCK_LOGGER_H_ +#define COMPONENTS_MEDIA_ROUTER_COMMON_TEST_MOCK_LOGGER_H_ + +#include "components/media_router/common/mojom/logger.mojom.h" +#include "mojo/public/cpp/bindings/pending_remote.h" +#include "mojo/public/cpp/bindings/receiver.h" +#include "testing/gmock/include/gmock/gmock.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace media_router { + +class MockLogger : public media_router::mojom::Logger { + public: + MockLogger(); + ~MockLogger() override; + + MOCK_METHOD6(LogInfo, + void(media_router::mojom::LogCategory, + const std::string&, + const std::string&, + const std::string&, + const std::string&, + const std::string&)); + MOCK_METHOD6(LogWarning, + void(media_router::mojom::LogCategory, + const std::string&, + const std::string&, + const std::string&, + const std::string&, + const std::string&)); + MOCK_METHOD6(LogError, + void(media_router::mojom::LogCategory, + const std::string&, + const std::string&, + const std::string&, + const std::string&, + const std::string&)); + + private: + mojo::Receiver receiver_{this}; +}; +} // namespace media_router + +#endif