Add Unittest of startProvider in Provider side.
authorjaesick.shin <jaesick.shin@samsung.com>
Thu, 28 Jul 2016 07:31:15 +0000 (16:31 +0900)
committerUze Choi <uzchoi@samsung.com>
Fri, 29 Jul 2016 06:23:09 +0000 (06:23 +0000)
our service is two case for startProvider.
Add startProvider with NSPolicy False Case.

Change-Id: I3aa763aaf264240ba4a9122fe3071a30edb40bcb
Signed-off-by: jaesick.shin <jaesick.shin@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/9821
Reviewed-by: Hun-je Yeon <hunje.yeon@samsung.com>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
Tested-by: Uze Choi <uzchoi@samsung.com>
service/notification/unittest/NSProviderTest.cpp

index adee768..2875507 100644 (file)
@@ -130,7 +130,7 @@ protected:
 
 };
 
-TEST_F(NotificationProviderTest, StartProviderPositive)
+TEST_F(NotificationProviderTest, StartProviderPositiveWithNSPolicyTrue)
 {
     NSResult ret = NSStartProvider(true,
             NSRequestedSubscribeCallbackEmpty,
@@ -152,6 +152,21 @@ TEST_F(NotificationProviderTest, StopProviderPositive)
     EXPECT_EQ(ret, NS_OK);
 }
 
+TEST_F(NotificationProviderTest, StartProviderPositiveWithNSPolicyFalse)
+{
+    NSResult ret = NSStartProvider(false,
+            NSRequestedSubscribeCallbackEmpty,
+            NSSyncCallbackEmpty);
+
+    std::unique_lock< std::mutex > lock{ mutexForCondition };
+    responseCon.wait_for(lock, std::chrono::milliseconds(3000));
+    g_consumerSimul.findProvider();
+
+    responseCon.wait_for(lock, std::chrono::milliseconds(3000));
+    NSStopProvider();
+    EXPECT_EQ(ret, NS_OK);
+}
+
 TEST_F(NotificationProviderTest, ExpectCallbackWhenReceiveSubscribeRequestWithAccepterProvider)
 {
     mocks.ExpectCallFunc(NSRequestedSubscribeCallbackEmpty).Do(