[NBS] code consistency improvement
authorPiotr Szydelko <p.szydelko@samsung.com>
Mon, 7 Oct 2013 13:49:28 +0000 (15:49 +0200)
committerGerrit Code Review <gerrit@gerrit.vlan144.tizendev.org>
Tue, 8 Oct 2013 07:42:13 +0000 (07:42 +0000)
Change-Id: Ieaa365241077c15e95bc3239f52c5c6f56b103f9

27 files changed:
tct-networkbearerselection-tizen-tests/networkbearerselection/NetworkBearerSelectionObject_notexist.html
tct-networkbearerselection-tizen-tests/networkbearerselection/NetworkBearerSelection_extend.html
tct-networkbearerselection-tizen-tests/networkbearerselection/NetworkBearerSelection_in_tizen.html
tct-networkbearerselection-tizen-tests/networkbearerselection/NetworkBearerSelection_notexist.html
tct-networkbearerselection-tizen-tests/networkbearerselection/NetworkBearerSelection_releaseRouteToHost.html
tct-networkbearerselection-tizen-tests/networkbearerselection/NetworkBearerSelection_releaseRouteToHost_errorCallback_TypeMismatch.html
tct-networkbearerselection-tizen-tests/networkbearerselection/NetworkBearerSelection_releaseRouteToHost_errorCallback_invalid_cb.html
tct-networkbearerselection-tizen-tests/networkbearerselection/NetworkBearerSelection_releaseRouteToHost_exist.html
tct-networkbearerselection-tizen-tests/networkbearerselection/NetworkBearerSelection_releaseRouteToHost_missarg.html
tct-networkbearerselection-tizen-tests/networkbearerselection/NetworkBearerSelection_releaseRouteToHost_networkType_TypeMismatch.html
tct-networkbearerselection-tizen-tests/networkbearerselection/NetworkBearerSelection_releaseRouteToHost_successCallback_TypeMismatch.html
tct-networkbearerselection-tizen-tests/networkbearerselection/NetworkBearerSelection_releaseRouteToHost_successCallback_invalid_cb.html
tct-networkbearerselection-tizen-tests/networkbearerselection/NetworkBearerSelection_releaseRouteToHost_with_errorCallback.html
tct-networkbearerselection-tizen-tests/networkbearerselection/NetworkBearerSelection_requestRouteToHost.html
tct-networkbearerselection-tizen-tests/networkbearerselection/NetworkBearerSelection_requestRouteToHost_errorCallback_TypeMismatch.html
tct-networkbearerselection-tizen-tests/networkbearerselection/NetworkBearerSelection_requestRouteToHost_errorCallback_invalid_cb.html
tct-networkbearerselection-tizen-tests/networkbearerselection/NetworkBearerSelection_requestRouteToHost_exist.html
tct-networkbearerselection-tizen-tests/networkbearerselection/NetworkBearerSelection_requestRouteToHost_missarg.html
tct-networkbearerselection-tizen-tests/networkbearerselection/NetworkBearerSelection_requestRouteToHost_networkType_TypeMismatch.html
tct-networkbearerselection-tizen-tests/networkbearerselection/NetworkBearerSelection_requestRouteToHost_successCallback_TypeMismatch.html
tct-networkbearerselection-tizen-tests/networkbearerselection/NetworkBearerSelection_requestRouteToHost_successCallback_invalid_cb.html
tct-networkbearerselection-tizen-tests/networkbearerselection/NetworkBearerSelection_requestRouteToHost_with_errorCallback.html
tct-networkbearerselection-tizen-tests/networkbearerselection/NetworkSuccessCallback_notexist.html
tct-networkbearerselection-tizen-tests/networkbearerselection/NetworkSuccessCallback_ondisconnected.html
tct-networkbearerselection-tizen-tests/networkbearerselection/NetworkSuccessCallback_onsuccess.html
tct-networkbearerselection-tizen-tests/networkbearerselection/support/unitcommon.js [new file with mode: 0644]
tct-networkbearerselection-tizen-tests/resources/unitcommon.js [deleted file]

index 8d8e795e741a70df1bd843bef13f5412babfc282..93c4714bff4b01c4c57414ad65261059a6701a0a 100644 (file)
@@ -23,7 +23,7 @@ Authors:
 <head>
 <title>NetworkBearerSelectionObject_notexist</title>
 <meta charset="utf-8"/>
-<script type="text/javascript" src="../resources/unitcommon.js"></script>
+<script type="text/javascript" src="support/unitcommon.js"></script>
 </head>
 
 <body>
@@ -38,8 +38,7 @@ Authors:
 
 test(function () {
     check_no_interface_object("NetworkBearerSelectionObject");
-}, "NetworkBearerSelectionObject_notexist");
-// Check if interface NetworkBearerSelectionObject exists, it should not.
+}, document.title);
 
 </script>
 </body>
index 2afd6153768b20cc74548dbb6d3cbf0165b9e6d2..c2a5bccd0e2d7ef1148743f364f033ffbc04cdb8 100644 (file)
@@ -22,7 +22,7 @@ Authors:
 <html>
 <head>
 <title>NetworkBearerSelection_extend</title>
-<script src="../resources/unitcommon.js"></script>
+<script src="support/unitcommon.js"></script>
 </head>
 
 <body>
@@ -36,7 +36,7 @@ Authors:
 //==== TEST_CRITERIA OBX
 test(function () {
     check_extensibility(tizen.networkbearerselection);
-}, "NetworkBearerSelection_extend");
+}, document.title);
 
 </script>
 </body>
index 6e187799a59a2b2440647f84e75cb21e5bd29d9f..8ac1f736a9e41235df1a38de435bde16e1c204c7 100644 (file)
@@ -23,7 +23,7 @@ Authors:
 <html>
 <head>
 <title>NetworkBearerSelection_in_tizen</title>
-<script src="../resources/unitcommon.js"></script>
+<script src="support/unitcommon.js"></script>
 </head>
 
 <body>
@@ -38,7 +38,7 @@ Authors:
 test(function () {
     assert_own_property(tizen, "networkbearerselection", "Tizen should implement NetworkBearerSelectionObject");
     assert_type(tizen.networkbearerselection, "object", "incorrect type");
-}, "NetworkBearerSelection_in_tizen");
+}, document.title);
 
 </script>
 </body>
index eab7b5dabce7fac991d90169ba04e5a01250caaa..d0ea06bf4d7d48066f0319ac03ba0fbdbf417535 100644 (file)
@@ -23,7 +23,7 @@ Authors:
 <head>
 <title>NetworkBearerSelection_notexist</title>
 <meta charset="utf-8"/>
-<script type="text/javascript" src="../resources/unitcommon.js"></script>
+<script type="text/javascript" src="support/unitcommon.js"></script>
 </head>
 
 <body>
@@ -38,8 +38,7 @@ Authors:
 
 test(function () {
     check_no_interface_object("NetworkBearerSelection");
-}, "NetworkBearerSelection_notexist");
-// Check if interface NetworkBearerSelection exists, it should not.
+}, document.title);
 
 </script>
 </body>
index 45880ccffd3d7c9a05a6dd254f0f836a5d609acc..309888bb955fea2838223f96d6432f5b48fe5cc4 100644 (file)
@@ -22,7 +22,7 @@ Authors:
 <html>
 <head>
 <title>NetworkBearerSelection_releaseRouteToHost</title>
-<script src="../resources/unitcommon.js"></script>
+<script src="support/unitcommon.js"></script>
 <script src="support/networkbearerselection_common.js"></script>
 </head>
 
@@ -35,9 +35,9 @@ Authors:
 //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/networkbearerselection.html
 //==== ONLOAD_DELAY 90
 //==== TEST_CRITERIA MMINA MR
-setup({ timeout: 90000 });
+setup({timeout: 90000});
 
-var t = async_test("NetworkBearerSelection_releaseRouteToHost", { timeout: 90000 }),
+var t = async_test(document.title, {timeout: 90000}),
     requestRouteToHostSuccess, releaseRouteToHostSuccess, requestRouteToHostError, retValue = null;
 
 t.step(function () {
index 085bd406ec1c693cb31d0c9b6ee3153f590c00ee..a94e48d06601d466feced47af92ac30a6475b2f2 100644 (file)
@@ -22,7 +22,7 @@ Authors:
 <html>
 <head>
 <title>NetworkBearerSelection_releaseRouteToHost_errorCallback_TypeMismatch</title>
-<script src="../resources/unitcommon.js"></script>
+<script src="support/unitcommon.js"></script>
 <script src="support/networkbearerselection_common.js"></script>
 </head>
 
@@ -38,7 +38,7 @@ Authors:
 //==== TEST_CRITERIA MC
 setup({timeout: 90000});
 
-var t = async_test("NetworkBearerSelection_releaseRouteToHost_errorCallback_TypeMismatch", {timeout: 90000}),
+var t = async_test(document.title, {timeout: 90000}),
     conversionTable, releaseRouteToHostSuccess, releaseRouteToHostError, exceptionName, i;
 
 t.step(function () {
index 80cba23b6c13458d2b86e389bb99788755a709e1..9a75c6bf5b5c78ef274d891b67a34bdf8db9e07c 100644 (file)
@@ -22,7 +22,7 @@ Authors:
 <html>
 <head>
 <title>NetworkBearerSelection_releaseRouteToHost_errorCallback_invalid_cb</title>
-<script src="../resources/unitcommon.js"></script>
+<script src="support/unitcommon.js"></script>
 <script src="support/networkbearerselection_common.js"></script>
 </head>
 
@@ -38,7 +38,7 @@ Authors:
 //==== TEST_CRITERIA MTCB
 setup({timeout: 90000});
 
-var t = async_test("NetworkBearerSelection_releaseRouteToHost_errorCallback_invalid_cb", {timeout: 90000}),
+var t = async_test(document.title, {timeout: 90000}),
     exceptionName = "TypeMismatchError", releaseRouteToHostSuccess, releaseRouteToHostError;
 
 t.step(function () {
@@ -52,7 +52,7 @@ t.step(function () {
         })
     };
 
-    assert_throws({name : exceptionName},
+    assert_throws({name: exceptionName},
         function () {
             tizen.networkbearerselection.releaseRouteToHost(NETWORK_TYPE, DOMAIN_NAME, releaseRouteToHostSuccess, releaseRouteToHostError);
         }, exceptionName + " should be thrown.");
index b9ae3373b04849ae0933cc0c6c9a2841955a67a8..0b5feeeec84e1d45508dfcbb6d6499bcba8a00a1 100644 (file)
@@ -22,7 +22,7 @@ Authors:
 <html>
 <head>
 <title>NetworkBearerSelection_releaseRouteToHost_exist</title>
-<script src="../resources/unitcommon.js"></script>
+<script src="support/unitcommon.js"></script>
 </head>
 
 <body>
@@ -36,7 +36,7 @@ Authors:
 test(function () {
     assert_true("releaseRouteToHost" in tizen.networkbearerselection, "releaseRouteToHost method sould be implemented");
     check_method_exists(tizen.networkbearerselection, "releaseRouteToHost");
-}, "NetworkBearerSelection_releaseRouteToHost_exist");
+}, document.title);
 
 </script>
 </body>
index 1d35ad6dd1673b9a260271ac11b9e96ca3f4d856..b46c78306166f0a7626bef29c13e0b93d819118f 100644 (file)
@@ -22,7 +22,7 @@ Authors:
 <html>
 <head>
 <title>NetworkBearerSelection_releaseRouteToHost_missarg</title>
-<script src="../resources/unitcommon.js"></script>
+<script src="support/unitcommon.js"></script>
 </head>
 
 <body>
@@ -34,10 +34,10 @@ Authors:
 //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/networkbearerselection.html
 //==== TEST_CRITERIA MMA
 test(function () {
-    assert_throws({ name: "TypeMismatchError" }, function () {
+    assert_throws(TYPE_MISMATCH_EXCEPTION, function () {
         tizen.networkbearerselection.releaseRouteToHost();
     }, "Method should throw an exception");
-}, "NetworkBearerSelection_releaseRouteToHost_missarg");
+}, document.title);
 
 </script>
 </body>
index 3591d57d8605508739d788618591024bdb006307..5083b9212bf258f7b8fb6b337f121109404b8531 100644 (file)
@@ -22,7 +22,7 @@ Authors:
 <html>
 <head>
 <title>NetworkBearerSelection_releaseRouteToHost_networkType_TypeMismatch</title>
-<script src="../resources/unitcommon.js"></script>
+<script src="support/unitcommon.js"></script>
 <script src="support/networkbearerselection_common.js"></script>
 </head>
 
@@ -30,7 +30,7 @@ Authors:
 <div id="log"></div>
 <script type="text/javascript">
 //==== TEST: NetworkBearerSelection_releaseRouteToHost_networkType_TypeMismatch
-//==== LABEL  Check if releaseRouteToHost throws exception when networkType is incorrect
+//==== LABEL Check if releaseRouteToHost throws exception when networkType is incorrect
 //==== PRIORITY: P2
 //==== ONLOAD_DELAY 90
 //==== SPEC Tizen Web API:Communication:NBS:NetworkBearerSelection:releaseRouteToHost M
@@ -38,7 +38,7 @@ Authors:
 //==== TEST_CRITERIA MC
 setup({timeout: 90000});
 
-var t = async_test("NetworkBearerSelection_releaseRouteToHost_networkType_TypeMismatch", {timeout: 90000}),
+var t = async_test(document.title, {timeout: 90000}),
     conversionTable, invalidNetworkType, releaseRouteToHostSuccess, exceptionName, i;
 
 t.step(function () {
index c4d3a610cd3ad4ce098b280ee60cf1fd4f15bee2..552711fe7072775637da93c6d4b4ab5a5c32f543 100644 (file)
@@ -22,7 +22,7 @@ Authors:
 <html>
 <head>
 <title>NetworkBearerSelection_releaseRouteToHost_successCallback_TypeMismatch</title>
-<script src="../resources/unitcommon.js"></script>
+<script src="support/unitcommon.js"></script>
 <script src="support/networkbearerselection_common.js"></script>
 </head>
 
@@ -50,7 +50,7 @@ test(function () {
                 tizen.networkbearerselection.releaseRouteToHost(NETWORK_TYPE, DOMAIN_NAME, releaseRouteToHostSuccess);
             }, exceptionName + " should be thrown.");
     }
-}, "NetworkBearerSelection_releaseRouteToHost_successCallback_TypeMismatch");
+}, document.title);
 
 </script>
 </body>
index 2d0e54dce001bd64d56d34ba7eb79182c9b3d7dc..b5e13227e39411c09717766314c74899b9473b7c 100644 (file)
@@ -22,7 +22,7 @@ Authors:
 <html>
 <head>
 <title>NetworkBearerSelection_releaseRouteToHost_successCallback_invalid_cb</title>
-<script src="../resources/unitcommon.js"></script>
+<script src="support/unitcommon.js"></script>
 <script src="support/networkbearerselection_common.js"></script>
 </head>
 
@@ -39,7 +39,7 @@ Authors:
 
 setup({timeout: 90000});
 
-var t = async_test("NetworkBearerSelection_releaseRouteToHost_successCallback_invalid_cb", {timeout: 90000}),
+var t = async_test(document.title, {timeout: 90000}),
     exceptionName = "TypeMismatchError", releaseRouteToHostSuccess;
 
 t.step(function () {
@@ -49,7 +49,7 @@ t.step(function () {
         })
     };
 
-    assert_throws({name : exceptionName},
+    assert_throws({name: exceptionName},
         function () {
             tizen.networkbearerselection.releaseRouteToHost(NETWORK_TYPE, DOMAIN_NAME, releaseRouteToHostSuccess);
         }, exceptionName + " should be thrown.");
index 8b9bad14b1ce08d2b984420a4f64ba172a7ca993..830128df6abd6639a937996a55d692aebd3cb6d0 100644 (file)
@@ -22,7 +22,7 @@ Authors:
 <html>
 <head>
 <title>NetworkBearerSelection_releaseRouteToHost_with_errorCallback</title>
-<script src="../resources/unitcommon.js"></script>
+<script src="support/unitcommon.js"></script>
 <script src="support/networkbearerselection_common.js"></script>
 </head>
 
@@ -36,9 +36,9 @@ Authors:
 //==== ONLOAD_DELAY 90
 //==== TEST_CRITERIA MOA
 
-setup({ timeout: 90000 });
+setup({timeout: 90000});
 
-var t = async_test("NetworkBearerSelection_releaseRouteToHost_with_errorCallback", { timeout: 90000 }),
+var t = async_test(document.title, {timeout: 90000}),
     requestRouteToHostSuccess, releaseRouteToHostSuccess, releaseRouteToHostError, requestRouteToHostError;
 
 t.step(function () {
index adc9afbb1eef5b711c4fec087fa0bda38d81e7c6..5a1bd7f10331e70f39ee63175e0358dffb094cd7 100644 (file)
@@ -22,7 +22,7 @@ Authors:
 <html>
 <head>
 <title>NetworkBearerSelection_requestRouteToHost</title>
-<script src="../resources/unitcommon.js"></script>
+<script src="support/unitcommon.js"></script>
 <script src="support/networkbearerselection_common.js"></script>
 </head>
 
@@ -36,9 +36,9 @@ Authors:
 //==== ONLOAD_DELAY 90
 //==== TEST_CRITERIA MMINA MR
 
-setup({ timeout: 90000 });
+setup({timeout: 90000});
 
-var t = async_test("NetworkBearerSelection_requestRouteToHost", { timeout: 90000 }),
+var t = async_test(document.title, {timeout: 90000}),
     requestRouteToHostSuccess, releaseRouteToHostError, releaseRouteToHostSuccess, retValue = null;
 
 t.step(function () {
index 9f4536ff6b502b02b0d15b42a0395dc8bc8b4fcf..82e47ff886ab4e48a41fea97a24fe44ccb58d24a 100644 (file)
@@ -22,7 +22,7 @@ Authors:
 <html>
 <head>
 <title>NetworkBearerSelection_requestRouteToHost_errorCallback_TypeMismatch</title>
-<script src="../resources/unitcommon.js"></script>
+<script src="support/unitcommon.js"></script>
 <script src="support/networkbearerselection_common.js"></script>
 </head>
 
@@ -38,7 +38,7 @@ Authors:
 //==== TEST_CRITERIA MC
 setup({timeout: 90000});
 
-var t = async_test("NetworkBearerSelection_requestRouteToHost_errorCallback_TypeMismatch", {timeout: 90000}),
+var t = async_test(document.title, {timeout: 90000}),
     conversionTable, requestRouteToHostSuccess, requestRouteToHostError, exceptionName, i;
 
 t.step(function () {
index cdfe88acfddff26ca6e4ecdf068342790787c27c..9a0865ad9f7511784e37ec018a5d4b4772c9dea5 100644 (file)
@@ -22,7 +22,7 @@ Authors:
 <html>
 <head>
 <title>NetworkBearerSelection_requestRouteToHost_errorCallback_invalid_cb</title>
-<script src="../resources/unitcommon.js"></script>
+<script src="support/unitcommon.js"></script>
 <script src="support/networkbearerselection_common.js"></script>
 </head>
 
@@ -38,7 +38,7 @@ Authors:
 //==== TEST_CRITERIA MTCB
 setup({timeout: 90000});
 
-var t = async_test("NetworkBearerSelection_requestRouteToHost_errorCallback_invalid_cb", {timeout: 90000}),
+var t = async_test(document.title, {timeout: 90000}),
     exceptionName = "TypeMismatchError", requestRouteToHostSuccess, requestRouteToHostError;
 
 t.step(function () {
@@ -58,7 +58,7 @@ t.step(function () {
         })
     };
 
-    assert_throws({name : exceptionName},
+    assert_throws({name: exceptionName},
         function () {
             tizen.networkbearerselection.requestRouteToHost(NETWORK_TYPE, DOMAIN_NAME, requestRouteToHostSuccess, requestRouteToHostError);
         }, exceptionName + " should be thrown.");
index d9c0383e8cfd2d5e39cd32b357521d72f5d9a30c..f3744fc73cb808b9b4d795856bf6ee94491a0a82 100644 (file)
@@ -22,7 +22,7 @@ Authors:
 <html>
 <head>
 <title>NetworkBearerSelection_requestRouteToHost_exist</title>
-<script src="../resources/unitcommon.js"></script>
+<script src="support/unitcommon.js"></script>
 </head>
 
 <body>
@@ -36,7 +36,7 @@ Authors:
 test(function () {
     assert_true("requestRouteToHost" in tizen.networkbearerselection, "requestRouteToHost method sould be implemented");
     check_method_exists(tizen.networkbearerselection, "requestRouteToHost");
-}, "NetworkBearerSelection_requestRouteToHost_exist");
+}, document.title);
 
 </script>
 </body>
index 9a83ddcfb5015e1b1c040573f57f54859f955bea..b086c652f786486e64b97a12e4f74687140648d3 100644 (file)
@@ -22,7 +22,7 @@ Authors:
 <html>
 <head>
 <title>NetworkBearerSelection_requestRouteToHost_missarg</title>
-<script src="../resources/unitcommon.js"></script>
+<script src="support/unitcommon.js"></script>
 </head>
 
 <body>
@@ -34,10 +34,10 @@ Authors:
 //==== SPEC_URL https://developer.tizen.org/help/topic/org.tizen.web.device.apireference/tizen/networkbearerselection.html
 //==== TEST_CRITERIA MMA
 test(function () {
-    assert_throws({ name: "TypeMismatchError" }, function () {
+    assert_throws(TYPE_MISMATCH_EXCEPTION, function () {
         tizen.networkbearerselection.requestRouteToHost();
     }, "Method should throw an exception");
-}, "NetworkBearerSelection_requestRouteToHost_missarg");
+}, document.title);
 
 </script>
 </body>
index c30bc4a5ed8d0dad9cedc33246ca43e9bdc4b15f..55d8599409b050610223f2347d05d20ab5b753b8 100644 (file)
@@ -22,7 +22,7 @@ Authors:
 <html>
 <head>
 <title>NetworkBearerSelection_requestRouteToHost_networkType_TypeMismatch</title>
-<script src="../resources/unitcommon.js"></script>
+<script src="support/unitcommon.js"></script>
 <script src="support/networkbearerselection_common.js"></script>
 </head>
 
@@ -30,7 +30,7 @@ Authors:
 <div id="log"></div>
 <script type="text/javascript">
 //==== TEST: NetworkBearerSelection_requestRouteToHost_networkType_TypeMismatch
-//==== LABEL  Check if requestRouteToHost throws exception when networkType is incorrect
+//==== LABEL Check if requestRouteToHost throws exception when networkType is incorrect
 //==== PRIORITY: P2
 //==== ONLOAD_DELAY 90
 //==== SPEC Tizen Web API:Communication:NBS:NetworkBearerSelection:requestRouteToHost M
@@ -38,7 +38,7 @@ Authors:
 //==== TEST_CRITERIA MC
 setup({timeout: 90000});
 
-var t = async_test("NetworkBearerSelection_requestRouteToHost_networkType_TypeMismatch", {timeout: 90000}),
+var t = async_test(document.title, {timeout: 90000}),
     conversionTable, invalidNetworkType, requestRouteToHostSuccess, exceptionName, i;
 
 t.step(function () {
index f1c9a21113ca2b6c7efef77a07b42d007025572b..e0c9bdfe1b1d0fef67aba0c9fab6dd3b6c1fe39f 100644 (file)
@@ -22,7 +22,7 @@ Authors:
 <html>
 <head>
 <title>NetworkBearerSelection_requestRouteToHost_successCallback_TypeMismatch</title>
-<script src="../resources/unitcommon.js"></script>
+<script src="support/unitcommon.js"></script>
 <script src="support/networkbearerselection_common.js"></script>
 </head>
 
@@ -49,7 +49,7 @@ test(function () {
                 tizen.networkbearerselection.requestRouteToHost(NETWORK_TYPE, DOMAIN_NAME, requestRouteToHostSuccess);
             }, exceptionName + " should be thrown.");
     }
-}, "NetworkBearerSelection_requestRouteToHost_successCallback_TypeMismatch");
+}, document.title);
 
 </script>
 </body>
index 894a06190d6a9cbf1dfb8d285dd0b71510bf7335..11546d81ab363d7891ff02b0423e8068bcd081de 100644 (file)
@@ -22,7 +22,7 @@ Authors:
 <html>
 <head>
 <title>NetworkBearerSelection_requestRouteToHost_successCallback_invalid_cb</title>
-<script src="../resources/unitcommon.js"></script>
+<script src="support/unitcommon.js"></script>
 <script src="support/networkbearerselection_common.js"></script>
 </head>
 
@@ -38,7 +38,7 @@ Authors:
 //==== TEST_CRITERIA MTL
 setup({timeout: 90000});
 
-var t = async_test("NetworkBearerSelection_requestRouteToHost_successCallback_invalid_cb", {timeout: 90000}),
+var t = async_test(document.title, {timeout: 90000}),
     exceptionName = "TypeMismatchError", requestRouteToHostSuccess;
 
 t.step(function () {
@@ -51,7 +51,7 @@ t.step(function () {
         ondisconnected: "dummy"
     };
 
-    assert_throws({name : exceptionName},
+    assert_throws({name: exceptionName},
         function () {
             tizen.networkbearerselection.requestRouteToHost(NETWORK_TYPE, DOMAIN_NAME, requestRouteToHostSuccess);
         }, exceptionName + " should be thrown.");
index 2888a23152bcd59b592c38b6b30fb25ed1aada2f..a4799f8a622413b529922036b415e83d7b8c534c 100644 (file)
@@ -22,7 +22,7 @@ Authors:
 <html>
 <head>
 <title>NetworkBearerSelection_requestRouteToHost_with_errorCallback</title>
-<script src="../resources/unitcommon.js"></script>
+<script src="support/unitcommon.js"></script>
 <script src="support/networkbearerselection_common.js"></script>
 </head>
 
@@ -36,9 +36,9 @@ Authors:
 //==== ONLOAD_DELAY 90
 //==== TEST_CRITERIA MOA
 
-setup({ timeout: 90000 });
+setup({timeout: 90000});
 
-var t = async_test("NetworkBearerSelection_requestRouteToHost_with_errorCallback", { timeout: 90000 }),
+var t = async_test(document.title, {timeout: 90000}),
     requestRouteToHostSuccess, requestRouteToHostError, releaseRouteToHostSuccess;
 
 t.step(function () {
index 56f86b5a199313f54ca2618039bad7ecfef77723..3c1278444998d0bb817aad0b06b6e1f47f23d7b7 100644 (file)
@@ -23,7 +23,7 @@ Authors:
 <head>
 <title>NetworkSuccessCallback_notexist</title>
 <meta charset="utf-8"/>
-<script type="text/javascript" src="../resources/unitcommon.js"></script>
+<script type="text/javascript" src="support/unitcommon.js"></script>
 </head>
 
 <body>
@@ -37,8 +37,7 @@ Authors:
 //==== TEST_CRITERIA CBNIO
 test(function () {
     check_no_interface_object("NetworkSuccessCallback");
-}, "NetworkSuccessCallback_notexist");
-// Check if interface NetworkSuccessCallback exists, it should not.
+}, document.title);
 
 </script>
 </body>
index 8f202fc747a387686c19146d6c5039aa4ef6fc25..320ac26f3a81abaf054f089a82537fe99bf47f8a 100644 (file)
@@ -22,7 +22,7 @@ Authors:
 <html>
 <head>
 <title>NetworkSuccessCallback_ondisconnected</title>
-<script src="../resources/unitcommon.js"></script>
+<script src="support/unitcommon.js"></script>
 <script src="support/networkbearerselection_common.js"></script>
 </head>
 
@@ -38,9 +38,9 @@ Authors:
 //==== POST Please re-enable cellular data service
 //==== TEST_CRITERIA CBOA
 
-setup({ timeout: 90000 });
+setup({timeout: 90000});
 
-var t = async_test("NetworkSuccessCallback_ondisconnected", { timeout: 90000 }),
+var t = async_test(document.title, {timeout: 90000}),
     requestRouteToHostSuccess, requestRouteToHostError;
 
 t.step(function () {
index 06c3b99c3956a82a9b879a33077b6e35adf4f76c..48bf9bdb343f531470b506b2fc0340193d69c556 100644 (file)
@@ -22,7 +22,7 @@ Authors:
 <html>
 <head>
 <title>NetworkSuccessCallback_onsuccess</title>
-<script src="../resources/unitcommon.js"></script>
+<script src="support/unitcommon.js"></script>
 <script src="support/networkbearerselection_common.js"></script>
 </head>
 
@@ -36,9 +36,9 @@ Authors:
 //==== ONLOAD_DELAY 90
 //==== TEST_CRITERIA CBOA
 
-setup({ timeout: 90000 });
+setup({timeout: 90000});
 
-var t = async_test("NetworkSuccessCallback_onsuccess", { timeout: 90000 }),
+var t = async_test(document.title, {timeout: 90000}),
     requestRouteToHostSuccess, releaseRouteToHostError, releaseRouteToHostSuccess, requestRouteToHostError;
 
 t.step(function () {
diff --git a/tct-networkbearerselection-tizen-tests/networkbearerselection/support/unitcommon.js b/tct-networkbearerselection-tizen-tests/networkbearerselection/support/unitcommon.js
new file mode 100644 (file)
index 0000000..9f972c1
--- /dev/null
@@ -0,0 +1,559 @@
+/*
+
+Copyright (c) 2013 Samsung Electronics Co., Ltd.
+
+Licensed under the Apache License, Version 2.0 (the License);
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+
+
+Authors:
+
+ */
+
+
+MIN_BYTE = -128;
+MAX_BYTE = 127;
+MIN_OCTET = 0;
+MAX_OCTET = 255;
+MIN_SHORT = -32768;
+MAX_SHORT = 32767;
+MIN_UNSIGNED_SHORT = 0;
+MAX_UNSIGNED_SHORT = 65535;
+MIN_LONG = -2147483648;
+MAX_LONG = 2147483647;
+MIN_UNSIGNED_LONG = 0;
+MAX_UNSIGNED_LONG = 4294967295;
+MIN_LONG_LONG = -9223372036854775808;
+MAX_LONG_LONG = 9223372036854775807;
+MIN_UNSIGNED_LONG_LONG = 0;
+MAX_UNSIGNED_LONG_LONG = 18446744073709551615;
+
+TYPE_MISMATCH_EXCEPTION = {name: 'TypeMismatchError'};
+NOT_FOUND_EXCEPTION = {name: 'NotFoundError'};
+INVALID_VALUES_EXCEPTION = {name: 'InvalidValuesError'};
+IO_EXCEPTION = {name: 'IOError'};
+SECURITY_EXCEPTION = {name: 'SecurityError'};
+
+
+(function () {
+   var head_src = document.head.innerHTML;
+   if (head_src.search(/\/testharness.js\W/) === -1) {
+       document.write('<script language="javascript" src="../resources/testharness.js"></script>\n');
+   }
+   if (head_src.search(/\/testharnessreport.js\W/) === -1) {
+       document.write('<script language="javascript" src="../resources/testharnessreport.js"></script>\n');
+   }
+})();
+
+var _registered_types = {};
+
+function _resolve_registered_type(type) {
+    while (type in _registered_types) {
+        type = _registered_types[type];
+    }
+    return type;
+}
+
+/**
+ * Method checks extra argument for none argument method.
+ * The only check is that method will not throw an exception.
+ * Example usage:
+ * checkExtraArgument(tizen.notification, "removeAll");
+ *
+ * @param object object
+ * @param methodName string - name of the method
+ */
+function checkExtraArgument(object, methodName) {
+    var extraArgument = [
+        null,
+        undefined,
+        "Tizen",
+        1,
+        false,
+        ["one", "two"],
+        {argument: 1},
+        function () {}
+    ], i;
+
+    for (i = 0; i < extraArgument.length; i++) {
+        object[methodName](extraArgument[i]);
+    }
+}
+
+/**
+ * Method to validate conversion.
+ * Example usage:
+ *   conversionTable = getTypeConversionExceptions("functionObject", true);
+ *   for(i = 0; i < conversionTable.length; i++) {
+ *       errorCallback = conversionTable[i][0];
+ *       exceptionName = conversionTable[i][1];
+ *
+ *       assert_throws({name : exceptionName},
+ *       function () {
+ *           tizen.systemsetting.setProperty("HOME_SCREEN",
+ *               propertyValue, successCallback, errorCallback);
+ *       }, exceptionName + " should be thrown - given incorrect errorCallback.");
+ *   }
+ *
+ * @param conversionType
+ * @param isOptional
+ * @returns table of tables which contain value (index 0) and exceptionName (index 1)
+ *
+ */
+function getTypeConversionExceptions(conversionType, isOptional) {
+    var exceptionName = "TypeMismatchError",
+        conversionTable;
+    switch (conversionType) {
+        case "enum":
+            conversionTable = [
+                [undefined, exceptionName],
+                [null, exceptionName],
+                [0, exceptionName],
+                [true, exceptionName],
+                ["dummyInvalidEnumValue", exceptionName],
+                [{ }, exceptionName]
+            ];
+            break;
+        case "double":
+            conversionTable = [
+                [undefined, exceptionName],
+                [NaN, exceptionName],
+                [Number.POSITIVE_INFINITY, exceptionName],
+                [Number.NEGATIVE_INFINITY, exceptionName],
+                ["TIZEN", exceptionName],
+                [{ name : "TIZEN" }, exceptionName],
+                [function () { }, exceptionName]
+            ];
+            break;
+        case "object":
+            conversionTable = [
+                [true, exceptionName],
+                [false, exceptionName],
+                [NaN, exceptionName],
+                [0, exceptionName],
+                ["", exceptionName],
+                ["TIZEN", exceptionName],
+                [undefined, exceptionName]
+            ];
+            if (!isOptional) {
+                conversionTable.push([null, exceptionName]);
+            }
+            break;
+        case "functionObject":
+            conversionTable = [
+                [true, exceptionName],
+                [false, exceptionName],
+                [NaN, exceptionName],
+                [0, exceptionName],
+                ["", exceptionName],
+                ["TIZEN", exceptionName],
+                [[], exceptionName],
+                [{ }, exceptionName],
+                [undefined, exceptionName]
+            ];
+            if (!isOptional) {
+                conversionTable.push([null, exceptionName]);
+            }
+            break;
+        case "array":
+            conversionTable = [
+                [true, exceptionName],
+                [false, exceptionName],
+                [NaN, exceptionName],
+                [0, exceptionName],
+                ["", exceptionName],
+                ["TIZEN", exceptionName],
+                [{ }, exceptionName],
+                [function () { }, exceptionName],
+                [undefined, exceptionName]
+            ];
+            if (!isOptional) {
+                conversionTable.push([null, exceptionName]);
+            }
+            break;
+        case "dictionary":
+            conversionTable = [
+                [true, exceptionName],
+                [false, exceptionName],
+                [NaN, exceptionName],
+                [0, exceptionName],
+                ["", exceptionName],
+                ["TIZEN", exceptionName],
+                [undefined, exceptionName]
+            ];
+            if (!isOptional) {
+                conversionTable.push([null, exceptionName]);
+            }
+            break;
+        default:
+            assert_unreached("Fix your test. Wrong conversionType '" + conversionType + "'.");
+    };
+
+    return conversionTable;
+}
+
+
+function assert_type(obj, type, description) {
+    var org_type = type, prop_name, prop_type, prop_value;
+
+    type = _resolve_registered_type(type);
+
+    if (typeof (type) === 'string') {
+        type = type.toLowerCase();
+        switch (type) {
+            case 'object':
+            case 'string':
+            case 'number':
+            case 'function':
+            case 'boolean':
+            case 'undefined':
+            case 'xml':
+                assert_equals(typeof (obj), type, description);
+                break;
+            case 'null':
+                assert_true(obj === null, description);
+                break;
+            case 'array':
+                assert_true(Array.isArray(obj), description);
+                break;
+            case 'date':
+                assert_true(obj instanceof Date, description);
+                break;
+            case 'byte':
+                assert_equals(typeof (obj), 'number', description);
+                assert_greater_than_equal(obj, MIN_BYTE, description + " - value too low.");
+                assert_less_than_equal(obj, MAX_BYTE, description + " - value too high.");
+                assert_equals(Math.abs(obj % 1), 0, description + " - value is not an integer.");
+                break;
+            case 'octet':
+                assert_equals(typeof (obj), 'number', description);
+                assert_greater_than_equal(obj, MIN_OCTET, description + " - value too low.");
+                assert_less_than_equal(obj, MAX_OCTET, description + " - value too high.");
+                assert_equals(obj % 1, 0, description + " - value is not an integer.");
+                break;
+            case 'short':
+                assert_equals(typeof (obj), 'number', description);
+                assert_greater_than_equal(obj, MIN_SHORT, description + " - value too low.");
+                assert_less_than_equal(obj, MAX_SHORT, description + " - value too high.");
+                assert_equals(Math.abs(obj % 1), 0, description + " - value is not an integer.");
+                break;
+            case 'unsigned short':
+                assert_equals(typeof (obj), 'number', description);
+                assert_greater_than_equal(obj, MIN_UNSIGNED_SHORT, description + " - value too low.");
+                assert_less_than_equal(obj, MAX_UNSIGNED_SHORT, description + " - value too high.");
+                assert_equals(obj % 1, 0, description + " - value is not an integer.");
+                break;
+            case 'long':
+                assert_equals(typeof (obj), 'number', description);
+                assert_greater_than_equal(obj, MIN_LONG, description + " - value too low.");
+                assert_less_than_equal(obj, MAX_LONG, description + " - value too high.");
+                assert_equals(Math.abs(obj % 1), 0, description + " - value is not an integer.");
+                break;
+            case 'unsigned long':
+                assert_equals(typeof (obj), 'number', description);
+                assert_greater_than_equal(obj, MIN_UNSIGNED_LONG, description + " - value too low.");
+                assert_less_than_equal(obj, MAX_UNSIGNED_LONG, description + " - value too high.");
+                assert_equals(obj % 1, 0, description + " - value is not an integer.");
+                break;
+            case 'long long':
+                assert_equals(typeof (obj), 'number', description);
+                assert_greater_than_equal(obj, MIN_LONG_LONG, description + " - value too low.");
+                assert_less_than_equal(obj, MAX_LONG_LONG, description + " - value too high.");
+                assert_equals(Math.abs(obj % 1), 0, description + " - value is not an integer.");
+                break;
+            case 'unsigned long long':
+                assert_equals(typeof (obj), 'number', description);
+                assert_greater_than_equal(obj, MIN_UNSIGNED_LONG_LONG, description + " - value too low.");
+                assert_less_than_equal(obj, MAX_UNSIGNED_LONG_LONG, description + " - value too high.");
+                assert_equals(obj % 1, 0, description + " - value is not an integer.");
+                break;
+            default:
+                assert_unreached('Fix your test. Wrong type \'' + org_type + '\'');
+        }
+    } else if (typeof (type) === 'function') {
+        assert_true(obj instanceof type, description);
+    } else if (typeof (type) === 'object') {
+        for (prop_name in type) {
+            prop_type = type[prop_name];
+            if (prop_type === 'function') {
+                assert_inherits(obj, prop_name);
+                assert_equals(typeof obj[prop_name], prop_type, 'Object should have method ' + prop_name);
+            } else {
+                assert_own_property(obj, prop_name);
+            }
+        }
+    } else {
+        assert_unreached('Fix your test. Wrong type ' + org_type);
+    }
+}
+
+function register_type(alias, type_spec) {
+    _registered_types[alias] = type_spec;
+}
+
+/**
+ * Method to check if attribute is const.
+ * Example usage:
+ * check_const(tizen.bluetooth.deviceMinor, 'TOY_DOLL', 0x03, 'number', 0x29B);
+ *
+ * @param obj  object to test which  has const attribute
+ * @param attributeName attribute name.
+ * @param expectedValue expected value of provided attribute name
+ * @param expectedType expected type of provided attribute name
+ * @param valueToAssign value to assign in order to check if attribute value can be modified
+ */
+function check_const(obj, attributeName, expectedValue, expectedType, valueToAssign) {
+    var tmp;
+    if (expectedValue === valueToAssign) {
+        assert_unreached("Fix your test. The same values given for "  + attributeName +
+            " in 'value' and 'valueToSet' arguments.");
+    }
+    if (typeof (attributeName) === "string") {
+        assert_true(attributeName in obj, "Name " + attributeName + " doesn't exist in provided object.");
+        assert_equals(obj[attributeName], expectedValue, "Value of " + attributeName + " is diffrent.");
+        if (typeof (expectedType) !== "undefined") {
+            if (expectedValue === null) {
+                assert_type(obj[attributeName], "object", "Type of " + attributeName + " is different.");
+            } else {
+                assert_type(obj[attributeName], expectedType, "Type of " + attributeName + " is different.");
+            }
+        } else {
+            assert_unreached("Fix your test. Wrong type " + expectedType);
+        }
+        tmp = obj[attributeName];
+        obj[attributeName] = valueToAssign;
+        assert_equals(obj[attributeName], tmp, attributeName + " can be modified.");
+    } else {
+        assert_unreached("Fix your test. Wrong type of name " + typeof (attributeName));
+    }
+}
+
+/**
+ * Method to check if attribute is readonly.
+ * Example usage:
+ * check_readonly(statusNotification, "postedTime", null, 'object', new Date());
+ *
+ * @param obj  object to test which  has readonly attribute
+ * @param attributeName attribute name.
+ * @param expectedValue expected value of provided attribute name
+ * @param expectedType expected type of provided attribute name
+ * @param valueToAssign value to assign in order to check if attribute value can be modified
+ */
+function check_readonly(obj, attributeName, expectedValue, expectedType, valueToAssign) {
+    check_const(obj, attributeName, expectedValue, expectedType, valueToAssign);
+}
+
+/**
+ * Method to check if attribute can be set to null.
+ * Example usage:
+ * check_not_nullable(syncInfo, "mode");
+ *
+ * @param obj object to test which has not nullable attribute
+ * @param attributeName attribute name.
+ */
+function check_not_nullable(obj, attributeName)
+{   var old_value = obj[attributeName];
+    obj[attributeName] = null;
+    assert_not_equals(obj[attributeName], null, "Attribute " + attributeName + " can be set to null.");
+    obj[attributeName] = old_value;
+}
+
+/**
+ * Method to check NoInterfaceObject
+ * Example usage:
+ * check_no_interface_object("BluetoothAdapter")
+ *
+ * @param interfaceName interface name
+ */
+function check_no_interface_object(interfaceName) {
+    assert_throws({name: "TypeError"}, function () {
+        tizen[interfaceName]();
+    },"Wrong call as a function");
+    assert_throws({name: "TypeError"}, function () {
+        new tizen[interfaceName]();
+    },"Wrong call as a new function");
+    assert_throws({name: "TypeError"}, function () {
+        ({}) instanceof tizen[interfaceName];
+    },"instanceof exception");
+    assert_equals(tizen[interfaceName], undefined, interfaceName + " is not undefined.");
+}
+
+
+/**
+ * Method to check Constructors
+ * Example usage:
+ * check_constructor("BluetoothAdapter")
+ *
+ * @param constructorName constructor name
+ */
+
+function check_constructor(constructorName) {
+    assert_true(constructorName in tizen, "No " + constructorName + " in tizen.");
+    assert_false({} instanceof tizen[constructorName],"Custom object is not instance of " + constructorName);
+    assert_throws({
+        name: "TypeError"
+    }, function () {
+        tizen[constructorName]();
+    }, "Constructor called as function.");
+}
+
+/**
+ * Method to check if given method can be overridden in a given object - (TEMPORARY REMOVED).
+ * That method also checks if given method exists in a given object.
+ * Example usage:
+ * check_method_exists(tizen.notification, "get");
+ *
+ * @param obj object with method
+ * @param methodName name of the method to check.
+ */
+function check_method_exists(obj, methodName) {
+    assert_type(obj[methodName], 'function', "Method does not exist.");
+}
+
+/**
+ * Method to check extensibility of given object.
+ * Method checks if new attribute and method can be added.
+ * Example usage:
+ * check_extensibility(tizen.notification);
+ *
+ * @param obj object to check
+ */
+function check_extensibility(obj) {
+    var dummyAttribute = "dummyAttributeValue", dummyMethodResult = "dummyMethodResultValue";
+    obj.newDummyMethod = function() {
+        return dummyMethodResult;
+    }
+    assert_equals(obj.newDummyMethod(), dummyMethodResult, "Incorrect result from added method.");
+
+    obj.newDummyAttribute = dummyAttribute;
+    assert_equals(obj.newDummyAttribute, dummyAttribute, "Incorrect result from added attribute.");
+}
+
+/**
+ * Method to check if attribute can be modify.
+ * Example usage:
+ * check_attr(downloadRequest, "fileName", default_val, "string", "file_name.html");
+ *
+ * @param obj  object to test which has not readonly attribute
+ * @param attributeName attribute name.
+ * @param expectedValue expected value of provided attribute name
+ * @param expectedType expected type of provided attribute name
+ * @param valueToAssign value to assign in order to check if attribute value can be modified
+ */
+function check_attribute(obj, attributeName, expectedValue, expectedType, valueToAssign) {
+    if (expectedValue === valueToAssign) {
+        assert_unreached("Fix your test. The same values given for "  + attributeName +
+            " in 'value' and 'valueToSet' arguments.");
+    }
+    if (typeof (attributeName) === "string") {
+        assert_true(attributeName in obj, "Name " + attributeName + " doesn't exist in provided object.");
+        assert_equals(obj[attributeName], expectedValue, "Value of " + attributeName + " is diffrent.");
+        if (typeof (expectedType) !== "undefined") {
+            if (expectedValue === null) {
+                assert_type(obj[attributeName], "object", "Type of " + attributeName + " is different.");
+            } else {
+                assert_type(obj[attributeName], expectedType, "Type of " + attributeName + " is different.");
+            }
+        } else {
+            assert_unreached("Fix your test. Wrong type " + expectedType);
+        }
+        obj[attributeName] = valueToAssign;
+        assert_equals(obj[attributeName], valueToAssign, attributeName + " can be modified.");
+    } else {
+        assert_unreached("Fix your test. Wrong type of name " + typeof (attributeName));
+    }
+}
+
+/**
+ * Method to check if whole array can be overwritten with an invalid value.
+ * Sample usage:
+ * check_invalid_array_assignments(message, "to", false);
+ *
+ * @param obj object which has the array as its property
+ * @param array name of the array to check
+ * @param isNullable indicates if the array can be null
+ */
+function check_invalid_array_assignments(obj, array, isNullable) {
+    var args = [undefined, true, false, NaN, 0, "TIZEN", {}, function () {}],
+        val = obj[array], i;
+
+    if (!isNullable) {
+        obj[array] = null;
+        assert_not_equals(obj[array], null, "Non-nullable array was set to null");
+        assert_type(obj[array], "array", "Non-nullable array type changed after assigning null");
+        assert_equals(obj[array].toString(), val.toString(), "Non-nullable array contents changed after assigning null");
+    }
+
+    for (i = 0 ; i < args.length ; i++) {
+        obj[array] = args[i];
+        assert_type(obj[array], "array", "Array type changed after assigning an invalid value");
+        assert_equals(obj[array].toString(), val.toString(), "Array contents changed after assigning an invalid value");
+    }
+}
+
+/**
+ * Method to check if an object can be overwritten with an invalid value.
+ * Sample usage:
+ * check_invalid_object_assignments(message, "body", false);
+ *
+ * @param parentObj object which has the 'obj' object as its property
+ * @param obj name of the object to check
+ * @param isNullable indicates if the object can be null
+ */
+function check_invalid_obj_assignments(parentObj, obj, isNullable) {
+    var args = [undefined, true, false, NaN, 0, "TIZEN", function () {}],
+        val = parentObj[obj], i;
+
+    if (!isNullable) {
+        parentObj[obj] = null;
+        assert_equals(parentObj[obj], val, "Non-nullable obj was modified after assigning null");
+    }
+
+    for (i = 0 ; i < args.length ; i++) {
+        parentObj[obj] = args[i];
+        assert_equals(parentObj[obj], val, "The object was set to " + args[i]);
+    }
+}
+
+/**
+ * Method to validate conversion for listeners.
+ * Example usage:
+ * incorrectListeners = getListenerConversionExceptions(["oninstalled", "onupdated", "onuninstalled"]);
+ * for(i = 0; i < incorrectListeners.length; i++) {
+ *     packageInformationEventCallback  = incorrectListeners[i][0];
+ *     exceptionName = incorrectListeners[i][1];
+ *     assert_throws({name : exceptionName},
+ *        function () {
+ *             tizen.package.setPackageInfoEventListener(packageInformationEventCallback);
+ *         }, exceptionName + " should be thrown - given incorrect successCallback.");
+ * }
+ *
+ *
+ * @param callbackNames Array with names
+ * @returns {Array} table of tables which contain incorrect listener (index 0) and exceptionName (index 1)
+ *
+ */
+function getListenerConversionExceptions(callbackNames) {
+    var result = [], conversionTable, i, j, listenerName;
+    conversionTable = getTypeConversionExceptions("functionObject", false);
+
+    for (i = 0; i < callbackNames.length; i++) {
+        for (j = 0; j < conversionTable.length; j++) {
+            listenerName = {};
+            listenerName[callbackNames[i]] = conversionTable[j][0];
+            result.push([listenerName, conversionTable[j][1]]);
+        }
+    }
+
+    return result;
+}
diff --git a/tct-networkbearerselection-tizen-tests/resources/unitcommon.js b/tct-networkbearerselection-tizen-tests/resources/unitcommon.js
deleted file mode 100644 (file)
index 9f972c1..0000000
+++ /dev/null
@@ -1,559 +0,0 @@
-/*
-
-Copyright (c) 2013 Samsung Electronics Co., Ltd.
-
-Licensed under the Apache License, Version 2.0 (the License);
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-    http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-
-
-
-Authors:
-
- */
-
-
-MIN_BYTE = -128;
-MAX_BYTE = 127;
-MIN_OCTET = 0;
-MAX_OCTET = 255;
-MIN_SHORT = -32768;
-MAX_SHORT = 32767;
-MIN_UNSIGNED_SHORT = 0;
-MAX_UNSIGNED_SHORT = 65535;
-MIN_LONG = -2147483648;
-MAX_LONG = 2147483647;
-MIN_UNSIGNED_LONG = 0;
-MAX_UNSIGNED_LONG = 4294967295;
-MIN_LONG_LONG = -9223372036854775808;
-MAX_LONG_LONG = 9223372036854775807;
-MIN_UNSIGNED_LONG_LONG = 0;
-MAX_UNSIGNED_LONG_LONG = 18446744073709551615;
-
-TYPE_MISMATCH_EXCEPTION = {name: 'TypeMismatchError'};
-NOT_FOUND_EXCEPTION = {name: 'NotFoundError'};
-INVALID_VALUES_EXCEPTION = {name: 'InvalidValuesError'};
-IO_EXCEPTION = {name: 'IOError'};
-SECURITY_EXCEPTION = {name: 'SecurityError'};
-
-
-(function () {
-   var head_src = document.head.innerHTML;
-   if (head_src.search(/\/testharness.js\W/) === -1) {
-       document.write('<script language="javascript" src="../resources/testharness.js"></script>\n');
-   }
-   if (head_src.search(/\/testharnessreport.js\W/) === -1) {
-       document.write('<script language="javascript" src="../resources/testharnessreport.js"></script>\n');
-   }
-})();
-
-var _registered_types = {};
-
-function _resolve_registered_type(type) {
-    while (type in _registered_types) {
-        type = _registered_types[type];
-    }
-    return type;
-}
-
-/**
- * Method checks extra argument for none argument method.
- * The only check is that method will not throw an exception.
- * Example usage:
- * checkExtraArgument(tizen.notification, "removeAll");
- *
- * @param object object
- * @param methodName string - name of the method
- */
-function checkExtraArgument(object, methodName) {
-    var extraArgument = [
-        null,
-        undefined,
-        "Tizen",
-        1,
-        false,
-        ["one", "two"],
-        {argument: 1},
-        function () {}
-    ], i;
-
-    for (i = 0; i < extraArgument.length; i++) {
-        object[methodName](extraArgument[i]);
-    }
-}
-
-/**
- * Method to validate conversion.
- * Example usage:
- *   conversionTable = getTypeConversionExceptions("functionObject", true);
- *   for(i = 0; i < conversionTable.length; i++) {
- *       errorCallback = conversionTable[i][0];
- *       exceptionName = conversionTable[i][1];
- *
- *       assert_throws({name : exceptionName},
- *       function () {
- *           tizen.systemsetting.setProperty("HOME_SCREEN",
- *               propertyValue, successCallback, errorCallback);
- *       }, exceptionName + " should be thrown - given incorrect errorCallback.");
- *   }
- *
- * @param conversionType
- * @param isOptional
- * @returns table of tables which contain value (index 0) and exceptionName (index 1)
- *
- */
-function getTypeConversionExceptions(conversionType, isOptional) {
-    var exceptionName = "TypeMismatchError",
-        conversionTable;
-    switch (conversionType) {
-        case "enum":
-            conversionTable = [
-                [undefined, exceptionName],
-                [null, exceptionName],
-                [0, exceptionName],
-                [true, exceptionName],
-                ["dummyInvalidEnumValue", exceptionName],
-                [{ }, exceptionName]
-            ];
-            break;
-        case "double":
-            conversionTable = [
-                [undefined, exceptionName],
-                [NaN, exceptionName],
-                [Number.POSITIVE_INFINITY, exceptionName],
-                [Number.NEGATIVE_INFINITY, exceptionName],
-                ["TIZEN", exceptionName],
-                [{ name : "TIZEN" }, exceptionName],
-                [function () { }, exceptionName]
-            ];
-            break;
-        case "object":
-            conversionTable = [
-                [true, exceptionName],
-                [false, exceptionName],
-                [NaN, exceptionName],
-                [0, exceptionName],
-                ["", exceptionName],
-                ["TIZEN", exceptionName],
-                [undefined, exceptionName]
-            ];
-            if (!isOptional) {
-                conversionTable.push([null, exceptionName]);
-            }
-            break;
-        case "functionObject":
-            conversionTable = [
-                [true, exceptionName],
-                [false, exceptionName],
-                [NaN, exceptionName],
-                [0, exceptionName],
-                ["", exceptionName],
-                ["TIZEN", exceptionName],
-                [[], exceptionName],
-                [{ }, exceptionName],
-                [undefined, exceptionName]
-            ];
-            if (!isOptional) {
-                conversionTable.push([null, exceptionName]);
-            }
-            break;
-        case "array":
-            conversionTable = [
-                [true, exceptionName],
-                [false, exceptionName],
-                [NaN, exceptionName],
-                [0, exceptionName],
-                ["", exceptionName],
-                ["TIZEN", exceptionName],
-                [{ }, exceptionName],
-                [function () { }, exceptionName],
-                [undefined, exceptionName]
-            ];
-            if (!isOptional) {
-                conversionTable.push([null, exceptionName]);
-            }
-            break;
-        case "dictionary":
-            conversionTable = [
-                [true, exceptionName],
-                [false, exceptionName],
-                [NaN, exceptionName],
-                [0, exceptionName],
-                ["", exceptionName],
-                ["TIZEN", exceptionName],
-                [undefined, exceptionName]
-            ];
-            if (!isOptional) {
-                conversionTable.push([null, exceptionName]);
-            }
-            break;
-        default:
-            assert_unreached("Fix your test. Wrong conversionType '" + conversionType + "'.");
-    };
-
-    return conversionTable;
-}
-
-
-function assert_type(obj, type, description) {
-    var org_type = type, prop_name, prop_type, prop_value;
-
-    type = _resolve_registered_type(type);
-
-    if (typeof (type) === 'string') {
-        type = type.toLowerCase();
-        switch (type) {
-            case 'object':
-            case 'string':
-            case 'number':
-            case 'function':
-            case 'boolean':
-            case 'undefined':
-            case 'xml':
-                assert_equals(typeof (obj), type, description);
-                break;
-            case 'null':
-                assert_true(obj === null, description);
-                break;
-            case 'array':
-                assert_true(Array.isArray(obj), description);
-                break;
-            case 'date':
-                assert_true(obj instanceof Date, description);
-                break;
-            case 'byte':
-                assert_equals(typeof (obj), 'number', description);
-                assert_greater_than_equal(obj, MIN_BYTE, description + " - value too low.");
-                assert_less_than_equal(obj, MAX_BYTE, description + " - value too high.");
-                assert_equals(Math.abs(obj % 1), 0, description + " - value is not an integer.");
-                break;
-            case 'octet':
-                assert_equals(typeof (obj), 'number', description);
-                assert_greater_than_equal(obj, MIN_OCTET, description + " - value too low.");
-                assert_less_than_equal(obj, MAX_OCTET, description + " - value too high.");
-                assert_equals(obj % 1, 0, description + " - value is not an integer.");
-                break;
-            case 'short':
-                assert_equals(typeof (obj), 'number', description);
-                assert_greater_than_equal(obj, MIN_SHORT, description + " - value too low.");
-                assert_less_than_equal(obj, MAX_SHORT, description + " - value too high.");
-                assert_equals(Math.abs(obj % 1), 0, description + " - value is not an integer.");
-                break;
-            case 'unsigned short':
-                assert_equals(typeof (obj), 'number', description);
-                assert_greater_than_equal(obj, MIN_UNSIGNED_SHORT, description + " - value too low.");
-                assert_less_than_equal(obj, MAX_UNSIGNED_SHORT, description + " - value too high.");
-                assert_equals(obj % 1, 0, description + " - value is not an integer.");
-                break;
-            case 'long':
-                assert_equals(typeof (obj), 'number', description);
-                assert_greater_than_equal(obj, MIN_LONG, description + " - value too low.");
-                assert_less_than_equal(obj, MAX_LONG, description + " - value too high.");
-                assert_equals(Math.abs(obj % 1), 0, description + " - value is not an integer.");
-                break;
-            case 'unsigned long':
-                assert_equals(typeof (obj), 'number', description);
-                assert_greater_than_equal(obj, MIN_UNSIGNED_LONG, description + " - value too low.");
-                assert_less_than_equal(obj, MAX_UNSIGNED_LONG, description + " - value too high.");
-                assert_equals(obj % 1, 0, description + " - value is not an integer.");
-                break;
-            case 'long long':
-                assert_equals(typeof (obj), 'number', description);
-                assert_greater_than_equal(obj, MIN_LONG_LONG, description + " - value too low.");
-                assert_less_than_equal(obj, MAX_LONG_LONG, description + " - value too high.");
-                assert_equals(Math.abs(obj % 1), 0, description + " - value is not an integer.");
-                break;
-            case 'unsigned long long':
-                assert_equals(typeof (obj), 'number', description);
-                assert_greater_than_equal(obj, MIN_UNSIGNED_LONG_LONG, description + " - value too low.");
-                assert_less_than_equal(obj, MAX_UNSIGNED_LONG_LONG, description + " - value too high.");
-                assert_equals(obj % 1, 0, description + " - value is not an integer.");
-                break;
-            default:
-                assert_unreached('Fix your test. Wrong type \'' + org_type + '\'');
-        }
-    } else if (typeof (type) === 'function') {
-        assert_true(obj instanceof type, description);
-    } else if (typeof (type) === 'object') {
-        for (prop_name in type) {
-            prop_type = type[prop_name];
-            if (prop_type === 'function') {
-                assert_inherits(obj, prop_name);
-                assert_equals(typeof obj[prop_name], prop_type, 'Object should have method ' + prop_name);
-            } else {
-                assert_own_property(obj, prop_name);
-            }
-        }
-    } else {
-        assert_unreached('Fix your test. Wrong type ' + org_type);
-    }
-}
-
-function register_type(alias, type_spec) {
-    _registered_types[alias] = type_spec;
-}
-
-/**
- * Method to check if attribute is const.
- * Example usage:
- * check_const(tizen.bluetooth.deviceMinor, 'TOY_DOLL', 0x03, 'number', 0x29B);
- *
- * @param obj  object to test which  has const attribute
- * @param attributeName attribute name.
- * @param expectedValue expected value of provided attribute name
- * @param expectedType expected type of provided attribute name
- * @param valueToAssign value to assign in order to check if attribute value can be modified
- */
-function check_const(obj, attributeName, expectedValue, expectedType, valueToAssign) {
-    var tmp;
-    if (expectedValue === valueToAssign) {
-        assert_unreached("Fix your test. The same values given for "  + attributeName +
-            " in 'value' and 'valueToSet' arguments.");
-    }
-    if (typeof (attributeName) === "string") {
-        assert_true(attributeName in obj, "Name " + attributeName + " doesn't exist in provided object.");
-        assert_equals(obj[attributeName], expectedValue, "Value of " + attributeName + " is diffrent.");
-        if (typeof (expectedType) !== "undefined") {
-            if (expectedValue === null) {
-                assert_type(obj[attributeName], "object", "Type of " + attributeName + " is different.");
-            } else {
-                assert_type(obj[attributeName], expectedType, "Type of " + attributeName + " is different.");
-            }
-        } else {
-            assert_unreached("Fix your test. Wrong type " + expectedType);
-        }
-        tmp = obj[attributeName];
-        obj[attributeName] = valueToAssign;
-        assert_equals(obj[attributeName], tmp, attributeName + " can be modified.");
-    } else {
-        assert_unreached("Fix your test. Wrong type of name " + typeof (attributeName));
-    }
-}
-
-/**
- * Method to check if attribute is readonly.
- * Example usage:
- * check_readonly(statusNotification, "postedTime", null, 'object', new Date());
- *
- * @param obj  object to test which  has readonly attribute
- * @param attributeName attribute name.
- * @param expectedValue expected value of provided attribute name
- * @param expectedType expected type of provided attribute name
- * @param valueToAssign value to assign in order to check if attribute value can be modified
- */
-function check_readonly(obj, attributeName, expectedValue, expectedType, valueToAssign) {
-    check_const(obj, attributeName, expectedValue, expectedType, valueToAssign);
-}
-
-/**
- * Method to check if attribute can be set to null.
- * Example usage:
- * check_not_nullable(syncInfo, "mode");
- *
- * @param obj object to test which has not nullable attribute
- * @param attributeName attribute name.
- */
-function check_not_nullable(obj, attributeName)
-{   var old_value = obj[attributeName];
-    obj[attributeName] = null;
-    assert_not_equals(obj[attributeName], null, "Attribute " + attributeName + " can be set to null.");
-    obj[attributeName] = old_value;
-}
-
-/**
- * Method to check NoInterfaceObject
- * Example usage:
- * check_no_interface_object("BluetoothAdapter")
- *
- * @param interfaceName interface name
- */
-function check_no_interface_object(interfaceName) {
-    assert_throws({name: "TypeError"}, function () {
-        tizen[interfaceName]();
-    },"Wrong call as a function");
-    assert_throws({name: "TypeError"}, function () {
-        new tizen[interfaceName]();
-    },"Wrong call as a new function");
-    assert_throws({name: "TypeError"}, function () {
-        ({}) instanceof tizen[interfaceName];
-    },"instanceof exception");
-    assert_equals(tizen[interfaceName], undefined, interfaceName + " is not undefined.");
-}
-
-
-/**
- * Method to check Constructors
- * Example usage:
- * check_constructor("BluetoothAdapter")
- *
- * @param constructorName constructor name
- */
-
-function check_constructor(constructorName) {
-    assert_true(constructorName in tizen, "No " + constructorName + " in tizen.");
-    assert_false({} instanceof tizen[constructorName],"Custom object is not instance of " + constructorName);
-    assert_throws({
-        name: "TypeError"
-    }, function () {
-        tizen[constructorName]();
-    }, "Constructor called as function.");
-}
-
-/**
- * Method to check if given method can be overridden in a given object - (TEMPORARY REMOVED).
- * That method also checks if given method exists in a given object.
- * Example usage:
- * check_method_exists(tizen.notification, "get");
- *
- * @param obj object with method
- * @param methodName name of the method to check.
- */
-function check_method_exists(obj, methodName) {
-    assert_type(obj[methodName], 'function', "Method does not exist.");
-}
-
-/**
- * Method to check extensibility of given object.
- * Method checks if new attribute and method can be added.
- * Example usage:
- * check_extensibility(tizen.notification);
- *
- * @param obj object to check
- */
-function check_extensibility(obj) {
-    var dummyAttribute = "dummyAttributeValue", dummyMethodResult = "dummyMethodResultValue";
-    obj.newDummyMethod = function() {
-        return dummyMethodResult;
-    }
-    assert_equals(obj.newDummyMethod(), dummyMethodResult, "Incorrect result from added method.");
-
-    obj.newDummyAttribute = dummyAttribute;
-    assert_equals(obj.newDummyAttribute, dummyAttribute, "Incorrect result from added attribute.");
-}
-
-/**
- * Method to check if attribute can be modify.
- * Example usage:
- * check_attr(downloadRequest, "fileName", default_val, "string", "file_name.html");
- *
- * @param obj  object to test which has not readonly attribute
- * @param attributeName attribute name.
- * @param expectedValue expected value of provided attribute name
- * @param expectedType expected type of provided attribute name
- * @param valueToAssign value to assign in order to check if attribute value can be modified
- */
-function check_attribute(obj, attributeName, expectedValue, expectedType, valueToAssign) {
-    if (expectedValue === valueToAssign) {
-        assert_unreached("Fix your test. The same values given for "  + attributeName +
-            " in 'value' and 'valueToSet' arguments.");
-    }
-    if (typeof (attributeName) === "string") {
-        assert_true(attributeName in obj, "Name " + attributeName + " doesn't exist in provided object.");
-        assert_equals(obj[attributeName], expectedValue, "Value of " + attributeName + " is diffrent.");
-        if (typeof (expectedType) !== "undefined") {
-            if (expectedValue === null) {
-                assert_type(obj[attributeName], "object", "Type of " + attributeName + " is different.");
-            } else {
-                assert_type(obj[attributeName], expectedType, "Type of " + attributeName + " is different.");
-            }
-        } else {
-            assert_unreached("Fix your test. Wrong type " + expectedType);
-        }
-        obj[attributeName] = valueToAssign;
-        assert_equals(obj[attributeName], valueToAssign, attributeName + " can be modified.");
-    } else {
-        assert_unreached("Fix your test. Wrong type of name " + typeof (attributeName));
-    }
-}
-
-/**
- * Method to check if whole array can be overwritten with an invalid value.
- * Sample usage:
- * check_invalid_array_assignments(message, "to", false);
- *
- * @param obj object which has the array as its property
- * @param array name of the array to check
- * @param isNullable indicates if the array can be null
- */
-function check_invalid_array_assignments(obj, array, isNullable) {
-    var args = [undefined, true, false, NaN, 0, "TIZEN", {}, function () {}],
-        val = obj[array], i;
-
-    if (!isNullable) {
-        obj[array] = null;
-        assert_not_equals(obj[array], null, "Non-nullable array was set to null");
-        assert_type(obj[array], "array", "Non-nullable array type changed after assigning null");
-        assert_equals(obj[array].toString(), val.toString(), "Non-nullable array contents changed after assigning null");
-    }
-
-    for (i = 0 ; i < args.length ; i++) {
-        obj[array] = args[i];
-        assert_type(obj[array], "array", "Array type changed after assigning an invalid value");
-        assert_equals(obj[array].toString(), val.toString(), "Array contents changed after assigning an invalid value");
-    }
-}
-
-/**
- * Method to check if an object can be overwritten with an invalid value.
- * Sample usage:
- * check_invalid_object_assignments(message, "body", false);
- *
- * @param parentObj object which has the 'obj' object as its property
- * @param obj name of the object to check
- * @param isNullable indicates if the object can be null
- */
-function check_invalid_obj_assignments(parentObj, obj, isNullable) {
-    var args = [undefined, true, false, NaN, 0, "TIZEN", function () {}],
-        val = parentObj[obj], i;
-
-    if (!isNullable) {
-        parentObj[obj] = null;
-        assert_equals(parentObj[obj], val, "Non-nullable obj was modified after assigning null");
-    }
-
-    for (i = 0 ; i < args.length ; i++) {
-        parentObj[obj] = args[i];
-        assert_equals(parentObj[obj], val, "The object was set to " + args[i]);
-    }
-}
-
-/**
- * Method to validate conversion for listeners.
- * Example usage:
- * incorrectListeners = getListenerConversionExceptions(["oninstalled", "onupdated", "onuninstalled"]);
- * for(i = 0; i < incorrectListeners.length; i++) {
- *     packageInformationEventCallback  = incorrectListeners[i][0];
- *     exceptionName = incorrectListeners[i][1];
- *     assert_throws({name : exceptionName},
- *        function () {
- *             tizen.package.setPackageInfoEventListener(packageInformationEventCallback);
- *         }, exceptionName + " should be thrown - given incorrect successCallback.");
- * }
- *
- *
- * @param callbackNames Array with names
- * @returns {Array} table of tables which contain incorrect listener (index 0) and exceptionName (index 1)
- *
- */
-function getListenerConversionExceptions(callbackNames) {
-    var result = [], conversionTable, i, j, listenerName;
-    conversionTable = getTypeConversionExceptions("functionObject", false);
-
-    for (i = 0; i < callbackNames.length; i++) {
-        for (j = 0; j < conversionTable.length; j++) {
-            listenerName = {};
-            listenerName[callbackNames[i]] = conversionTable[j][0];
-            result.push([listenerName, conversionTable[j][1]]);
-        }
-    }
-
-    return result;
-}