Bug 94133 - [EFL][WK2] Add unit tests for Web intent registration
Summary: [EFL][WK2] Add unit tests for Web intent registration
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL:
Keywords:
Depends on:
Blocks: 90451
  Show dependency treegraph
 
Reported: 2012-08-15 11:47 PDT by Chris Dumez
Modified: 2012-08-16 02:13 PDT (History)
6 users (show)

See Also:


Attachments
Patch (4.86 KB, patch)
2012-08-15 11:50 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (4.84 KB, patch)
2012-08-15 12:01 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (4.84 KB, patch)
2012-08-15 21:59 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2012-08-15 11:47:25 PDT
We need unit tests for Web intent registration. This would test the "intent,service,register" signalling on the Ewk_View as well as Ewk_Intent_Service.
Comment 1 Chris Dumez 2012-08-15 11:50:50 PDT
Created attachment 158609 [details]
Patch
Comment 2 Thiago Marcos P. Santos 2012-08-15 11:57:37 PDT
Comment on attachment 158609 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=158609&action=review

> Source/WebKit2/UIProcess/API/efl/tests/resources/intent-service.html:5
> +  <body onload="loaded()">

where is loaded()?
Comment 3 Chris Dumez 2012-08-15 12:01:36 PDT
Created attachment 158612 [details]
Patch

Remove "onload", Thanks Thiago.
Comment 4 Thiago Marcos P. Santos 2012-08-15 12:13:09 PDT
Comment on attachment 158612 [details]
Patch

LGTM. Thanks!
Comment 5 Kenneth Rohde Christiansen 2012-08-15 12:25:29 PDT
Comment on attachment 158612 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=158612&action=review

> Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_intents.cpp:45
> +    ASSERT_TRUE(service);
> +    ASSERT_STREQ(ewk_intent_service_action_get(service), "action");

Where do I find information about these macros an this test system?
Comment 6 Chris Dumez 2012-08-15 12:29:38 PDT
(In reply to comment #5)
> (From update of attachment 158612 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=158612&action=review
> 
> > Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_intents.cpp:45
> > +    ASSERT_TRUE(service);
> > +    ASSERT_STREQ(ewk_intent_service_action_get(service), "action");
> 
> Where do I find information about these macros an this test system?

http://trac.webkit.org/wiki/EFLWebKitTests
http://code.google.com/p/googletest/wiki/Primer
Comment 7 Thiago Marcos P. Santos 2012-08-15 12:32:52 PDT
Comment on attachment 158612 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=158612&action=review

>> Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_intents.cpp:45
>> +    ASSERT_STREQ(ewk_intent_service_action_get(service), "action");
> 
> Where do I find information about these macros an this test system?

These are the docs we have:
http://trac.webkit.org/wiki/EFLWebKitTests

On the wiki you will find links to gtest docs.
gtest is the foundation of our utest framework and where these macros are coming from.
Comment 8 Kenneth Rohde Christiansen 2012-08-15 12:37:05 PDT
Comment on attachment 158612 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=158612&action=review

> Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_intents.cpp:40
> +    ASSERT_FALSE(*intentRegistered);

So we are supposed to ASSERT and use EXPECTS_ macros when it is actually possible to continue?

> Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_intents.cpp:47
> +    ASSERT_STREQ(ewk_intent_service_type_get(service), "type");
> +    ASSERT_STREQ(ewk_intent_service_title_get(service), "Title");

Wouldn't EXPECT_STREQ be better here? to continue testing even if that one fails?
Comment 9 Thiago Marcos P. Santos 2012-08-15 13:20:58 PDT
Comment on attachment 158612 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=158612&action=review

>> Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_intents.cpp:47
>> +    ASSERT_STREQ(ewk_intent_service_title_get(service), "Title");
> 
> Wouldn't EXPECT_STREQ be better here? to continue testing even if that one fails?

This is not the first time this topic is brought up. I voted for using assertions only if a failure after that point breaks the test beyond repair. A counter argument was that too many failures messages can be misleading in case of a regression.
Comment 10 Kenneth Rohde Christiansen 2012-08-15 13:59:26 PDT
(In reply to comment #9)
> (From update of attachment 158612 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=158612&action=review
> 
> >> Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_intents.cpp:47
> >> +    ASSERT_STREQ(ewk_intent_service_title_get(service), "Title");
> > 
> > Wouldn't EXPECT_STREQ be better here? to continue testing even if that one fails?
> 
> This is not the first time this topic is brought up. I voted for using assertions only if a failure after that point breaks the test beyond repair. A counter argument was that too many failures messages can be misleading in case of a regression.

Sure, they might be, but they might also not be. At least I think it is good to know if it is the only thing failing or everything else also becomes unreliable. EXPECT_* exists for a purpose.
Comment 11 Chris Dumez 2012-08-15 21:58:38 PDT
(In reply to comment #10)
> (In reply to comment #9)
> > (From update of attachment 158612 [details] [details])
> > View in context: https://bugs.webkit.org/attachment.cgi?id=158612&action=review
> > 
> > >> Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_intents.cpp:47
> > >> +    ASSERT_STREQ(ewk_intent_service_title_get(service), "Title");
> > > 
> > > Wouldn't EXPECT_STREQ be better here? to continue testing even if that one fails?
> > 
> > This is not the first time this topic is brought up. I voted for using assertions only if a failure after that point breaks the test beyond repair. A counter argument was that too many failures messages can be misleading in case of a regression.
> 
> Sure, they might be, but they might also not be. At least I think it is good to know if it is the only thing failing or everything else also becomes unreliable. EXPECT_* exists for a purpose.

Agreed, I'll update the patch. Thanks.
Comment 12 Chris Dumez 2012-08-15 21:59:42 PDT
Created attachment 158707 [details]
Patch
Comment 13 WebKit Review Bot 2012-08-16 02:13:13 PDT
Comment on attachment 158707 [details]
Patch

Clearing flags on attachment: 158707

Committed r125762: <http://trac.webkit.org/changeset/125762>
Comment 14 WebKit Review Bot 2012-08-16 02:13:19 PDT
All reviewed patches have been landed.  Closing bug.