Skip to content

Commit

Permalink
Move mock_logger to components/media_router/common/test
Browse files Browse the repository at this point in the history
This CL moves mock_logger.* from chrome/browser/ to components/ so that
it can be reused by mirroring service tests in components/ directory.
Mirroring service tests will be changed in a later CL.

Bug: b/165366974, 1117673
Change-Id: I225de779b0caa476fd253b56e0ecc10f16e13688
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2482092
Reviewed-by: Takumi Fujimoto <takumif@chromium.org>
Reviewed-by: Scott Violet <sky@chromium.org>
Commit-Queue: Muyao Xu <muyaoxu@google.com>
Cr-Commit-Position: refs/heads/master@{#820315}
  • Loading branch information
muyao-xu authored and Commit Bot committed Oct 23, 2020
1 parent 353dcbf commit 59f231f
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 47 deletions.
2 changes: 0 additions & 2 deletions chrome/browser/media/router/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
43 changes: 0 additions & 43 deletions chrome/browser/media/router/test/mock_logger.h

This file was deleted.

3 changes: 3 additions & 0 deletions components/media_router/common/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -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",
]
Expand Down
1 change: 1 addition & 0 deletions components/media_router/common/DEPS
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
include_rules = [
"+url",
"+mojo",
]
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down
48 changes: 48 additions & 0 deletions components/media_router/common/test/mock_logger.h
Original file line number Diff line number Diff line change
@@ -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<media_router::mojom::Logger> receiver_{this};
};
} // namespace media_router

#endif

0 comments on commit 59f231f

Please sign in to comment.