Added background plugin tests in flipper client

Summary: Added tests for flipper client which makes sure that didconnect is called in the case of background plugin. It also checks the case of a non background plugin.

Reviewed By: jknoxville

Differential Revision: D13152686

fbshipit-source-id: 7850f66a42d669243f656a1e1c26584869ee919f
This commit is contained in:
Pritesh Nandgaonkar
2018-11-23 03:40:41 -08:00
committed by Facebook Github Bot
parent ca1f0202d7
commit 8327e1ff71
2 changed files with 57 additions and 4 deletions

View File

@@ -1,11 +1,10 @@
/*
* Copyright (c) 2018-present, Facebook, Inc.
* Copyright (c) Facebook, Inc.
*
* 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/FlipperPlugin.h>
@@ -35,6 +34,16 @@ class FlipperPluginMock : public FlipperPlugin {
connectionCallback_(connectionCallback),
disconnectionCallback_(disconnectionCallback) {}
FlipperPluginMock(
const std::string& identifier,
const ConnectionCallback& connectionCallback,
const DisconnectionCallback& disconnectionCallback,
bool runInBackground)
: identifier_(identifier),
runInBackground_(runInBackground),
connectionCallback_(connectionCallback),
disconnectionCallback_(disconnectionCallback) {}
std::string identifier() const override {
return identifier_;
}
@@ -51,8 +60,13 @@ class FlipperPluginMock : public FlipperPlugin {
}
}
bool runInBackground() override {
return runInBackground_;
}
private:
std::string identifier_;
bool runInBackground_ = false;
ConnectionCallback connectionCallback_;
DisconnectionCallback disconnectionCallback_;
};