Improve test cases for network information APIs
authorgyuyoung.kim@samsung.com <gyuyoung.kim@samsung.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 Jul 2012 10:12:47 +0000 (10:12 +0000)
committergyuyoung.kim@samsung.com <gyuyoung.kim@samsung.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 Jul 2012 10:12:47 +0000 (10:12 +0000)
https://bugs.webkit.org/show_bug.cgi?id=90162

Reviewed by Adam Barth.

Existing implementation doesn't test port implementation in network info APIs.
This patch lets test cases use bandwidth and metered functions implemented by port layer.

In addition, expected results need to check return type instead of property name.

Source/WebCore:

No new tests. Covered by existing tests.

* Modules/networkinfo/NetworkInfoConnection.cpp:
(WebCore::NetworkInfoConnection::bandwidth):
(WebCore::NetworkInfoConnection::metered):

LayoutTests:

* networkinformation/add-listener-from-callback-expected.txt:
* networkinformation/basic-all-types-of-events-expected.txt:
* networkinformation/basic-operation-expected.txt:
* networkinformation/multiple-frames-expected.txt:
* networkinformation/script-tests/add-listener-from-callback.js:
(checkNetworkInformation):
* networkinformation/script-tests/basic-all-types-of-events.js:
(checkNetworkInformation):
* networkinformation/script-tests/basic-operation.js:
* networkinformation/script-tests/multiple-frames.js:
(checkNetworkInformation):
(checkChildNetworkInformation):
* networkinformation/script-tests/updates.js:
(checkNetworkInformation):
* networkinformation/updates-expected.txt:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@121754 268f45cc-cd09-0410-ab3c-d52691b4dbfc

13 files changed:
LayoutTests/ChangeLog
LayoutTests/networkinformation/add-listener-from-callback-expected.txt
LayoutTests/networkinformation/basic-all-types-of-events-expected.txt
LayoutTests/networkinformation/basic-operation-expected.txt
LayoutTests/networkinformation/multiple-frames-expected.txt
LayoutTests/networkinformation/script-tests/add-listener-from-callback.js
LayoutTests/networkinformation/script-tests/basic-all-types-of-events.js
LayoutTests/networkinformation/script-tests/basic-operation.js
LayoutTests/networkinformation/script-tests/multiple-frames.js
LayoutTests/networkinformation/script-tests/updates.js
LayoutTests/networkinformation/updates-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/Modules/networkinfo/NetworkInfoConnection.cpp

index b3eee91..6c59540 100644 (file)
@@ -1,3 +1,31 @@
+2012-07-03  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
+
+        Improve test cases for network information APIs
+        https://bugs.webkit.org/show_bug.cgi?id=90162
+
+        Reviewed by Adam Barth.
+
+        Existing implementation doesn't test port implementation in network info APIs.
+        This patch lets test cases use bandwidth and metered functions implemented by port layer.
+
+        In addition, expected results need to check return type instead of property name.
+
+        * networkinformation/add-listener-from-callback-expected.txt:
+        * networkinformation/basic-all-types-of-events-expected.txt:
+        * networkinformation/basic-operation-expected.txt:
+        * networkinformation/multiple-frames-expected.txt:
+        * networkinformation/script-tests/add-listener-from-callback.js:
+        (checkNetworkInformation):
+        * networkinformation/script-tests/basic-all-types-of-events.js:
+        (checkNetworkInformation):
+        * networkinformation/script-tests/basic-operation.js:
+        * networkinformation/script-tests/multiple-frames.js:
+        (checkNetworkInformation):
+        (checkChildNetworkInformation):
+        * networkinformation/script-tests/updates.js:
+        (checkNetworkInformation):
+        * networkinformation/updates-expected.txt:
+
 2012-07-03  Vsevolod Vlasov  <vsevik@chromium.org>
 
         Web Inspector: Save scroll selection and cursor position of SourceFrames in sources panel.
index ad2fde7..9e181c2 100644 (file)
@@ -3,12 +3,12 @@ Tests that adding a new event listener from a callback works as expected.
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
-PASS connection.bandwidth is bandwidth
-PASS connection.metered is metered
-PASS connection.bandwidth is bandwidth
-PASS connection.metered is metered
-PASS connection.bandwidth is bandwidth
-PASS connection.metered is metered
+PASS typeof connection.bandwidth is "number"
+PASS typeof connection.metered is "boolean"
+PASS typeof connection.bandwidth is "number"
+PASS typeof connection.metered is "boolean"
+PASS typeof connection.bandwidth is "number"
+PASS typeof connection.metered is "boolean"
 PASS successfullyParsed is true
 
 TEST COMPLETE
index c823708..890c4c6 100644 (file)
@@ -4,8 +4,8 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
 
 
 webkitnetworkinfochange event is raised
-PASS connection.bandwidth is bandwidth
-PASS connection.metered is metered
+PASS typeof connection.bandwidth is "number"
+PASS typeof connection.metered is "boolean"
 PASS successfullyParsed is true
 
 TEST COMPLETE
index e3a0790..b8d2d37 100644 (file)
@@ -3,8 +3,8 @@ Tests the basic operation of NetworkInfo.
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
-PASS connection.bandwidth is bandwidth
-PASS connection.metered is metered
+PASS typeof connection.bandwidth is "number"
+PASS typeof connection.metered is "boolean"
 PASS successfullyParsed is true
 
 TEST COMPLETE
index 6a122f9..787a18a 100644 (file)
@@ -3,10 +3,10 @@ Tests using NetworkInfo from multiple frames.
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
-PASS connection.bandwidth is bandwidth
-PASS connection.metered is metered
-PASS connection.bandwidth is bandwidth
-PASS connection.metered is metered
+PASS typeof connection.bandwidth is "number"
+PASS typeof connection.metered is "boolean"
+PASS typeof connection.bandwidth is "number"
+PASS typeof connection.metered is "boolean"
 PASS successfullyParsed is true
 
 TEST COMPLETE
index 365fc79..b1a4c76 100644 (file)
@@ -6,8 +6,8 @@ var metered = false;
 var connection = navigator.webkitConnection;
 
 function checkNetworkInformation() {
-    shouldBe('connection.bandwidth', 'bandwidth');
-    shouldBe('connection.metered', 'metered');
+    shouldBe("typeof connection.bandwidth", '"number"');
+    shouldBe("typeof connection.metered", '"boolean"');
 }
 
 var firstListenerEvents = 0;
index fe0e768..e7d5c6a 100644 (file)
@@ -6,8 +6,8 @@ var metered = false;
 var connection = navigator.webkitConnection;
 
 function checkNetworkInformation() {
-    shouldBe('connection.bandwidth', 'bandwidth');
-    shouldBe('connection.metered', 'metered');
+    shouldBe("typeof connection.bandwidth", '"number"');
+    shouldBe("typeof connection.metered", '"boolean"');
 }
 
 connection.addEventListener('webkitnetworkinfochange', function() {
index 44cfc61..0a8c8da 100644 (file)
@@ -6,8 +6,8 @@ var metered = false;
 var connection = navigator.webkitConnection;
 
 connection.addEventListener('webkitnetworkinfochange', function() {
-    shouldBe('connection.bandwidth', 'bandwidth');
-    shouldBe('connection.metered', 'metered');
+    shouldBe("typeof connection.bandwidth", '"number"');
+    shouldBe("typeof connection.metered", '"boolean"');
     finishJSTest();
 });
 
index a437c2e..6453a0d 100644 (file)
@@ -6,13 +6,13 @@ var metered = false;
 var connection = navigator.webkitConnection;
 
 function checkNetworkInformation() {
-    shouldBe('connection.bandwidth', 'bandwidth');
-    shouldBe('connection.metered', 'metered');
+    shouldBe("typeof connection.bandwidth", '"number"');
+    shouldBe("typeof connection.metered", '"boolean"');
 }
 
 function checkChildNetworkInformation() {
-    shouldBe('connection.bandwidth', 'bandwidth');
-    shouldBe('connection.metered', 'metered');
+    shouldBe("typeof connection.bandwidth", '"number"');
+    shouldBe("typeof connection.metered", '"boolean"');
 }
 
 var hasMainFrameEventFired = false;
index e6cad6c..9fa8fa4 100644 (file)
@@ -6,8 +6,8 @@ var metered = false;
 var connection = navigator.webkitConnection;
 
 function checkNetworkInformation() {
-    shouldBe('connection.bandwidth', 'bandwidth');
-    shouldBe('connection.metered', 'metered');
+    shouldBe("typeof connection.bandwidth", '"number"');
+    shouldBe("typeof connection.metered", '"boolean"');
 }
 
 function setNetworkInformation() {
index 993d75c..fdf7d92 100644 (file)
@@ -3,10 +3,10 @@ Tests that updates to the connection event causes new events to fire.
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
-PASS connection.bandwidth is bandwidth
-PASS connection.metered is metered
-PASS connection.bandwidth is bandwidth
-PASS connection.metered is metered
+PASS typeof connection.bandwidth is "number"
+PASS typeof connection.metered is "boolean"
+PASS typeof connection.bandwidth is "number"
+PASS typeof connection.metered is "boolean"
 PASS successfullyParsed is true
 
 TEST COMPLETE
index ee798d2..6aacf48 100644 (file)
@@ -1,3 +1,21 @@
+2012-07-03  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
+
+        Improve test cases for network information APIs
+        https://bugs.webkit.org/show_bug.cgi?id=90162
+
+        Reviewed by Adam Barth.
+
+        Existing implementation doesn't test port implementation in network info APIs.
+        This patch lets test cases use bandwidth and metered functions implemented by port layer.
+
+        In addition, expected results need to check return type instead of property name.
+
+        No new tests. Covered by existing tests.
+
+        * Modules/networkinfo/NetworkInfoConnection.cpp:
+        (WebCore::NetworkInfoConnection::bandwidth):
+        (WebCore::NetworkInfoConnection::metered):
+
 2012-07-03  Sudarsana Nagineni  <sudarsana.nagineni@linux.intel.com>
 
         [EFL] [WK2] Don't call eina_iterator_free() if iterator is NULL
index 159fecc..9a4231c 100644 (file)
@@ -57,17 +57,11 @@ NetworkInfoConnection::~NetworkInfoConnection()
 
 double NetworkInfoConnection::bandwidth() const
 {
-    if (m_networkInfo)
-        return m_networkInfo->bandwidth();
-    
     return m_controller->client()->bandwidth();
 }
 
 bool NetworkInfoConnection::metered() const
 {
-    if (m_networkInfo)
-        return m_networkInfo->metered();
-    
     return m_controller->client()->metered();
 }