Don't use private access in FlipperRSocketResponder
Summary: Changing FlipperRSocketResponder to only use public parts of FlipperConnectionManagerImpl. This means we can test it by injecting a FCM mock, and it can use its public interface. Reviewed By: passy Differential Revision: D14000078 fbshipit-source-id: c0431a888b0ca041807631c81b99fb8b947274d6
This commit is contained in:
committed by
Facebook Github Bot
parent
c48c1a728a
commit
5da8f35ee3
@@ -1,11 +1,9 @@
|
||||
/*
|
||||
* Copyright (c) 2018-present, Facebook, Inc.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the LICENSE
|
||||
* file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Flipper/FlipperConnectionManager.h>
|
||||
@@ -40,6 +38,16 @@ class FlipperConnectionManagerMock : public FlipperConnectionManager {
|
||||
messages.push_back(message);
|
||||
}
|
||||
|
||||
void onMessageReceived(
|
||||
const folly::dynamic& message,
|
||||
std::unique_ptr<FlipperResponder> responder) override {
|
||||
if (responder) {
|
||||
respondersReceived++;
|
||||
}
|
||||
callbacks->onMessageReceived(message, std::move(responder));
|
||||
messagesReceived.push_back(message);
|
||||
}
|
||||
|
||||
void setCallbacks(Callbacks* aCallbacks) override {
|
||||
callbacks = aCallbacks;
|
||||
}
|
||||
@@ -48,6 +56,8 @@ class FlipperConnectionManagerMock : public FlipperConnectionManager {
|
||||
bool open = false;
|
||||
Callbacks* callbacks;
|
||||
std::vector<folly::dynamic> messages;
|
||||
std::vector<folly::dynamic> messagesReceived;
|
||||
int respondersReceived = 0;
|
||||
};
|
||||
|
||||
} // namespace test
|
||||
|
||||
Reference in New Issue
Block a user