Skip to content

Commit

Permalink
test fix
Browse files Browse the repository at this point in the history
  • Loading branch information
cmuhammedrafi committed Dec 26, 2024
1 parent 4eb055e commit 348649b
Showing 1 changed file with 4 additions and 65 deletions.
69 changes: 4 additions & 65 deletions Tests/unit_test/test_NetworkManagerConnectivity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,76 +11,15 @@ class ConnectivityMonitorTest : public ::testing::Test {
WPEFramework::Plugin::ConnectivityMonitor cm;
};

TEST_F(ConnectivityMonitorTest, StartContinuousMonitor_Success) {
int timeout = 30;
bool result = cm.startContinuousConnectivityMonitor(timeout);
EXPECT_TRUE(result);
}

TEST_F(ConnectivityMonitorTest, StartContinuousMonitor_FailureNegativeTimeout) {
int timeout = -1;
bool result = cm.startContinuousConnectivityMonitor(timeout);
EXPECT_TRUE(result);
}

TEST_F(ConnectivityMonitorTest, StartMonitorWithTimeoutLessThanMinimum) {
int timeout = 3;
bool result = cm.startContinuousConnectivityMonitor(timeout);
EXPECT_TRUE(result);
}

TEST_F(ConnectivityMonitorTest, MonitorFailsToStart) {
int timeout = 0;
bool result = cm.startContinuousConnectivityMonitor(timeout);
EXPECT_TRUE(result);
}

TEST_F(ConnectivityMonitorTest, StopContinuousMonitor_WhenStarted) {
int timeout = 30;
cm.startContinuousConnectivityMonitor(timeout);
bool result = cm.stopContinuousConnectivityMonitor();
EXPECT_TRUE(result);
}

TEST_F(ConnectivityMonitorTest, StopContinuousMonitor_WhenNotStarted) {
bool result = cm.stopContinuousConnectivityMonitor();
EXPECT_TRUE(result);
}

TEST_F(ConnectivityMonitorTest, StopContinuousMonitor_AfterMultipleStartsAndStops) {
int timeout = 30;
cm.startContinuousConnectivityMonitor(timeout);
bool result = cm.stopContinuousConnectivityMonitor();
EXPECT_TRUE(result);

cm.startContinuousConnectivityMonitor(timeout);
result = cm.stopContinuousConnectivityMonitor();
EXPECT_TRUE(result);

cm.startContinuousConnectivityMonitor(timeout);
result = cm.stopContinuousConnectivityMonitor();
EXPECT_TRUE(result);
}

TEST_F(ConnectivityMonitorTest, StopContinuousMonitor_LongRunningMonitor) {
int timeout = 1000;
cm.startContinuousConnectivityMonitor(timeout);
std::this_thread::sleep_for(std::chrono::seconds(2));

bool result = cm.stopContinuousConnectivityMonitor();
TEST_F(ConnectivityMonitorTest, StartConnectivityMonitor_Success) {
bool result = cm.startConnectivityMonitor();
EXPECT_TRUE(result);
}

TEST_F(ConnectivityMonitorTest, StartMonitor_WithInterfaceStatus) {
bool result = cm.startConnectivityMonitor();
EXPECT_TRUE(result);
}

TEST_F(ConnectivityMonitorTest, StartMonitor_NotifyIfAlreadyMonitoring) {
bool result = false;
result = cm.startConnectivityMonitor();
EXPECT_TRUE(result);
result = cm.startConnectivityMonitor();
TEST_F(ConnectivityMonitorTest, StartConnectivityMonitor_Success) {
bool result = cm.stopConnectivityMonitor();
EXPECT_TRUE(result);
}

Expand Down

0 comments on commit 348649b

Please sign in to comment.