Commit 99d41498 authored by Daniel Bratell's avatar Daniel Bratell Committed by Commit Bot

Renamed MockEventListener in presentation and remoteplayback unit tests

Both PresentationReceiverTest and RemotePlaybackTest use a local test
class named MockEventListener. That is normally no big deal
but in jumbo builds they can be compiled in the same translation unit
and then the classes will collide. This patch gives the classes
unique prefixes so that no tests have to be excluded from jumbo.

Bug: 745732

Change-Id: Ic9a5e4e896b226d5ef7f99f2549cd3d4bb66fc42
Reviewed-on: https://chromium-review.googlesource.com/575141
Commit-Queue: Daniel Bratell <bratell@opera.com>
Reviewed-by: default avatarMounir Lamouri <mlamouri@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#487479}
parent ebf960b2
...@@ -23,9 +23,10 @@ ...@@ -23,9 +23,10 @@
namespace blink { namespace blink {
class MockEventListener : public EventListener { class MockEventListenerForPresentationReceiver : public EventListener {
public: public:
MockEventListener() : EventListener(kCPPEventListenerType) {} MockEventListenerForPresentationReceiver()
: EventListener(kCPPEventListenerType) {}
bool operator==(const EventListener& other) const final { bool operator==(const EventListener& other) const final {
return this == &other; return this == &other;
...@@ -69,7 +70,8 @@ TEST_F(PresentationReceiverTest, NoConnectionUnresolvedConnectionList) { ...@@ -69,7 +70,8 @@ TEST_F(PresentationReceiverTest, NoConnectionUnresolvedConnectionList) {
V8TestingScope scope; V8TestingScope scope;
auto receiver = new PresentationReceiver(&scope.GetFrame(), nullptr); auto receiver = new PresentationReceiver(&scope.GetFrame(), nullptr);
auto event_handler = new StrictMock<MockEventListener>(); auto event_handler =
new StrictMock<MockEventListenerForPresentationReceiver>();
AddConnectionavailableEventListener(event_handler, receiver); AddConnectionavailableEventListener(event_handler, receiver);
EXPECT_CALL(*event_handler, handleEvent(::testing::_, ::testing::_)).Times(0); EXPECT_CALL(*event_handler, handleEvent(::testing::_, ::testing::_)).Times(0);
...@@ -84,7 +86,8 @@ TEST_F(PresentationReceiverTest, OneConnectionResolvedConnectionListNoEvent) { ...@@ -84,7 +86,8 @@ TEST_F(PresentationReceiverTest, OneConnectionResolvedConnectionListNoEvent) {
V8TestingScope scope; V8TestingScope scope;
auto receiver = new PresentationReceiver(&scope.GetFrame(), nullptr); auto receiver = new PresentationReceiver(&scope.GetFrame(), nullptr);
auto event_handler = new StrictMock<MockEventListener>(); auto event_handler =
new StrictMock<MockEventListenerForPresentationReceiver>();
AddConnectionavailableEventListener(event_handler, receiver); AddConnectionavailableEventListener(event_handler, receiver);
EXPECT_CALL(*event_handler, handleEvent(::testing::_, ::testing::_)).Times(0); EXPECT_CALL(*event_handler, handleEvent(::testing::_, ::testing::_)).Times(0);
...@@ -103,8 +106,8 @@ TEST_F(PresentationReceiverTest, TwoConnectionsFireOnconnectionavailableEvent) { ...@@ -103,8 +106,8 @@ TEST_F(PresentationReceiverTest, TwoConnectionsFireOnconnectionavailableEvent) {
V8TestingScope scope; V8TestingScope scope;
auto receiver = new PresentationReceiver(&scope.GetFrame(), nullptr); auto receiver = new PresentationReceiver(&scope.GetFrame(), nullptr);
StrictMock<MockEventListener>* event_handler = StrictMock<MockEventListenerForPresentationReceiver>* event_handler =
new StrictMock<MockEventListener>(); new StrictMock<MockEventListenerForPresentationReceiver>();
AddConnectionavailableEventListener(event_handler, receiver); AddConnectionavailableEventListener(event_handler, receiver);
EXPECT_CALL(*event_handler, handleEvent(::testing::_, ::testing::_)).Times(1); EXPECT_CALL(*event_handler, handleEvent(::testing::_, ::testing::_)).Times(1);
...@@ -124,8 +127,8 @@ TEST_F(PresentationReceiverTest, TwoConnectionsNoEvent) { ...@@ -124,8 +127,8 @@ TEST_F(PresentationReceiverTest, TwoConnectionsNoEvent) {
V8TestingScope scope; V8TestingScope scope;
auto receiver = new PresentationReceiver(&scope.GetFrame(), nullptr); auto receiver = new PresentationReceiver(&scope.GetFrame(), nullptr);
StrictMock<MockEventListener>* event_handler = StrictMock<MockEventListenerForPresentationReceiver>* event_handler =
new StrictMock<MockEventListener>(); new StrictMock<MockEventListenerForPresentationReceiver>();
AddConnectionavailableEventListener(event_handler, receiver); AddConnectionavailableEventListener(event_handler, receiver);
EXPECT_CALL(*event_handler, handleEvent(::testing::_, ::testing::_)).Times(0); EXPECT_CALL(*event_handler, handleEvent(::testing::_, ::testing::_)).Times(0);
......
...@@ -39,9 +39,9 @@ class MockFunction : public ScriptFunction { ...@@ -39,9 +39,9 @@ class MockFunction : public ScriptFunction {
: ScriptFunction(script_state) {} : ScriptFunction(script_state) {}
}; };
class MockEventListener : public EventListener { class MockEventListenerForRemotePlayback : public EventListener {
public: public:
MockEventListener() : EventListener(kCPPEventListenerType) {} MockEventListenerForRemotePlayback() : EventListener(kCPPEventListenerType) {}
bool operator==(const EventListener& other) const final { bool operator==(const EventListener& other) const final {
return this == &other; return this == &other;
...@@ -199,9 +199,12 @@ TEST_F(RemotePlaybackTest, StateChangeEvents) { ...@@ -199,9 +199,12 @@ TEST_F(RemotePlaybackTest, StateChangeEvents) {
RemotePlayback* remote_playback = RemotePlayback* remote_playback =
HTMLMediaElementRemotePlayback::remote(*element); HTMLMediaElementRemotePlayback::remote(*element);
auto connecting_handler = new ::testing::StrictMock<MockEventListener>(); auto connecting_handler =
auto connect_handler = new ::testing::StrictMock<MockEventListener>(); new ::testing::StrictMock<MockEventListenerForRemotePlayback>();
auto disconnect_handler = new ::testing::StrictMock<MockEventListener>(); auto connect_handler =
new ::testing::StrictMock<MockEventListenerForRemotePlayback>();
auto disconnect_handler =
new ::testing::StrictMock<MockEventListenerForRemotePlayback>();
remote_playback->addEventListener(EventTypeNames::connecting, remote_playback->addEventListener(EventTypeNames::connecting,
connecting_handler); connecting_handler);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment