Bug 90665 - Check returned value in BatteryStatus APIs test cases
Summary: Check returned value in BatteryStatus APIs test cases
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Gyuyoung Kim
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-07-06 01:33 PDT by Gyuyoung Kim
Modified: 2012-07-08 22:10 PDT (History)
3 users (show)

See Also:


Attachments
Patch (10.56 KB, patch)
2012-07-06 01:36 PDT, Gyuyoung Kim
no flags Details | Formatted Diff | Diff
Patch (12.77 KB, patch)
2012-07-07 06:24 PDT, Gyuyoung Kim
no flags Details | Formatted Diff | Diff
Patch (12.62 KB, patch)
2012-07-08 21:32 PDT, Gyuyoung Kim
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Gyuyoung Kim 2012-07-06 01:33:04 PDT
Test cases of battery status have checked if properties of battery status are existed. In my opinion, to check return type is better than to check properties.
Comment 1 Gyuyoung Kim 2012-07-06 01:36:32 PDT
Created attachment 151035 [details]
Patch
Comment 2 Gyuyoung Kim 2012-07-06 01:38:06 PDT
CC'ing Adam and Kihong.
Comment 3 Kihong Kwon 2012-07-06 01:55:15 PDT
If there is a problem what you said, how about checking both value and type.
IMHO, we need to check values which is returned. :)
Comment 4 Gyuyoung Kim 2012-07-06 05:09:10 PDT
(In reply to comment #3)
> If there is a problem what you said, how about checking both value and type.
> IMHO, we need to check values which is returned. :)

Can we estimate what is return values ? In network information APIs case, I just checked return type because returned value can be different on each port.
Comment 5 Kihong Kwon 2012-07-06 05:48:26 PDT
(In reply to comment #4)
> (In reply to comment #3)
> > If there is a problem what you said, how about checking both value and type.
> > IMHO, we need to check values which is returned. :)
> 
> Can we estimate what is return values ? In network information APIs case, I just checked return type because returned value can be different on each port.

That's why we use internals.setBatteryStatus.
Every test cases set values for checking return values by 
internals.setBatteryStatus.

-------------------------------------------------------------------------------
var charging = false;
var chargingTime = Number.POSITIVE_INFINITY;
var dischargingTime = 6000;
var level = 0.7;
...
internals.setBatteryStatus(document, 'chargingchange', charging, chargingTime, dischargingTime, level);
-------------------------------------------------------------------------------

When internals.setBatteryStatus called, DRT emulates event-dispatching with preset values.
Comment 6 Gyuyoung Kim 2012-07-07 06:24:16 PDT
Created attachment 151139 [details]
Patch
Comment 7 Gyuyoung Kim 2012-07-07 06:26:35 PDT
I'm not sure whether each port can support this test cases in future. If possible, I also think to compare returned value is more correct. Patch is updated.
Comment 8 Kihong Kwon 2012-07-08 19:42:18 PDT
(In reply to comment #7)
> I'm not sure whether each port can support this test cases in future. If possible, I also think to compare returned value is more correct. Patch is updated.

I think new patch is not different from original test cases.
It just changed from variables to values.
I looked into shouldBe function again, IMHO we don't need to fix these test cases.
How do you think about this?
Comment 9 Adam Barth 2012-07-08 20:46:59 PDT
IMHO, this approach is better because the expected.txt file lists the actual values we expect.  That means we don't need to refer to the test to understand what is different about failing values.
Comment 10 Gyuyoung Kim 2012-07-08 21:24:55 PDT
(In reply to comment #9)
> IMHO, this approach is better because the expected.txt file lists the actual values we expect.  That means we don't need to refer to the test to understand what is different about failing values.

I also agree with your thought. It is better to compare concrete values to recognize what is differences.
Comment 11 Gyuyoung Kim 2012-07-08 21:32:52 PDT
Created attachment 151180 [details]
Patch
Comment 12 WebKit Review Bot 2012-07-08 22:10:36 PDT
Comment on attachment 151180 [details]
Patch

Clearing flags on attachment: 151180

Committed r122088: <http://trac.webkit.org/changeset/122088>
Comment 13 WebKit Review Bot 2012-07-08 22:10:41 PDT
All reviewed patches have been landed.  Closing bug.