From eaee69e124c61dfc3eace0a30a6fb0229a91c729 Mon Sep 17 00:00:00 2001 From: "gyuyoung.kim@samsung.com" Date: Tue, 3 Jul 2012 10:12:47 +0000 Subject: [PATCH] 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. 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 --- LayoutTests/ChangeLog | 28 ++++++++++++++++++++++ .../add-listener-from-callback-expected.txt | 12 +++++----- .../basic-all-types-of-events-expected.txt | 4 ++-- .../basic-operation-expected.txt | 4 ++-- .../multiple-frames-expected.txt | 8 +++---- .../script-tests/add-listener-from-callback.js | 4 ++-- .../script-tests/basic-all-types-of-events.js | 4 ++-- .../script-tests/basic-operation.js | 4 ++-- .../script-tests/multiple-frames.js | 8 +++---- .../networkinformation/script-tests/updates.js | 4 ++-- .../networkinformation/updates-expected.txt | 8 +++---- Source/WebCore/ChangeLog | 18 ++++++++++++++ .../Modules/networkinfo/NetworkInfoConnection.cpp | 6 ----- 13 files changed, 76 insertions(+), 36 deletions(-) diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog index b3eee91..6c59540 100644 --- a/LayoutTests/ChangeLog +++ b/LayoutTests/ChangeLog @@ -1,3 +1,31 @@ +2012-07-03 Gyuyoung Kim + + 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 Web Inspector: Save scroll selection and cursor position of SourceFrames in sources panel. diff --git a/LayoutTests/networkinformation/add-listener-from-callback-expected.txt b/LayoutTests/networkinformation/add-listener-from-callback-expected.txt index ad2fde7..9e181c2 100644 --- a/LayoutTests/networkinformation/add-listener-from-callback-expected.txt +++ b/LayoutTests/networkinformation/add-listener-from-callback-expected.txt @@ -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 diff --git a/LayoutTests/networkinformation/basic-all-types-of-events-expected.txt b/LayoutTests/networkinformation/basic-all-types-of-events-expected.txt index c823708..890c4c6 100644 --- a/LayoutTests/networkinformation/basic-all-types-of-events-expected.txt +++ b/LayoutTests/networkinformation/basic-all-types-of-events-expected.txt @@ -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 diff --git a/LayoutTests/networkinformation/basic-operation-expected.txt b/LayoutTests/networkinformation/basic-operation-expected.txt index e3a0790..b8d2d37 100644 --- a/LayoutTests/networkinformation/basic-operation-expected.txt +++ b/LayoutTests/networkinformation/basic-operation-expected.txt @@ -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 diff --git a/LayoutTests/networkinformation/multiple-frames-expected.txt b/LayoutTests/networkinformation/multiple-frames-expected.txt index 6a122f9..787a18a 100644 --- a/LayoutTests/networkinformation/multiple-frames-expected.txt +++ b/LayoutTests/networkinformation/multiple-frames-expected.txt @@ -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 diff --git a/LayoutTests/networkinformation/script-tests/add-listener-from-callback.js b/LayoutTests/networkinformation/script-tests/add-listener-from-callback.js index 365fc79..b1a4c76 100644 --- a/LayoutTests/networkinformation/script-tests/add-listener-from-callback.js +++ b/LayoutTests/networkinformation/script-tests/add-listener-from-callback.js @@ -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; diff --git a/LayoutTests/networkinformation/script-tests/basic-all-types-of-events.js b/LayoutTests/networkinformation/script-tests/basic-all-types-of-events.js index fe0e768..e7d5c6a 100644 --- a/LayoutTests/networkinformation/script-tests/basic-all-types-of-events.js +++ b/LayoutTests/networkinformation/script-tests/basic-all-types-of-events.js @@ -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() { diff --git a/LayoutTests/networkinformation/script-tests/basic-operation.js b/LayoutTests/networkinformation/script-tests/basic-operation.js index 44cfc61..0a8c8da 100644 --- a/LayoutTests/networkinformation/script-tests/basic-operation.js +++ b/LayoutTests/networkinformation/script-tests/basic-operation.js @@ -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(); }); diff --git a/LayoutTests/networkinformation/script-tests/multiple-frames.js b/LayoutTests/networkinformation/script-tests/multiple-frames.js index a437c2e..6453a0d 100644 --- a/LayoutTests/networkinformation/script-tests/multiple-frames.js +++ b/LayoutTests/networkinformation/script-tests/multiple-frames.js @@ -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; diff --git a/LayoutTests/networkinformation/script-tests/updates.js b/LayoutTests/networkinformation/script-tests/updates.js index e6cad6c..9fa8fa4 100644 --- a/LayoutTests/networkinformation/script-tests/updates.js +++ b/LayoutTests/networkinformation/script-tests/updates.js @@ -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() { diff --git a/LayoutTests/networkinformation/updates-expected.txt b/LayoutTests/networkinformation/updates-expected.txt index 993d75c..fdf7d92 100644 --- a/LayoutTests/networkinformation/updates-expected.txt +++ b/LayoutTests/networkinformation/updates-expected.txt @@ -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 diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index ee798d2..6aacf48 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,21 @@ +2012-07-03 Gyuyoung Kim + + 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 [EFL] [WK2] Don't call eina_iterator_free() if iterator is NULL diff --git a/Source/WebCore/Modules/networkinfo/NetworkInfoConnection.cpp b/Source/WebCore/Modules/networkinfo/NetworkInfoConnection.cpp index 159fecc..9a4231c 100644 --- a/Source/WebCore/Modules/networkinfo/NetworkInfoConnection.cpp +++ b/Source/WebCore/Modules/networkinfo/NetworkInfoConnection.cpp @@ -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(); } -- 2.7.4