Bug 41832

Summary: [DRT] DRT should be able to dump document markers.
Product: WebKit Reporter: Hajime Morrita <morrita>
Component: Tools / TestsAssignee: Hajime Morrita <morrita>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, darin, hbono, tkent, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: OS X 10.5   
Bug Depends on:    
Bug Blocks: 41423    
Attachments:
Description Flags
A possible fix
none
A possible fix 2
none
A possible fix 3
none
A possible fix 4
hamaji: review-
A possible fix 5
none
A possible fix 6 none

Description Hajime Morrita 2010-07-07 21:48:02 PDT
DRT should allow tests to dump document markers.
This is required for testing bugs like Bug 41423 without pixel test.
Comment 1 Hironori Bono 2010-07-15 21:26:13 PDT
Created attachment 61763 [details]
A possible fix

Greetings,

Even though this change is not exactly as you expected, it adds a new JavaScript function 'TextInputController.hasSpellingMarker()' so we can write text-based layout tests for spellchecking. I wish it helps.

Regards,
Comment 2 Hajime Morrita 2010-07-15 22:53:00 PDT
Comment on attachment 61763 [details]
A possible fix

Hi Bono-san, thank you for doing this!

> +
> +/*!
> +    @method hasSpellingMarker
> +    @discussion this function is only for layout tests.
> +    @param location the offset of the range to be checked.
> +    @param length the length of the range to be checked.
> +    @result whether there is a spelling marker in the specified range of the focused node.
> +*/
> +- (BOOL)hasSpellingMarker:(int)location length:(int)length;
If this is for testing purpose, how about to declare this in WebFrameInternal.h ?
Comment 3 Hironori Bono 2010-08-20 02:35:07 PDT
Created attachment 64938 [details]
A possible fix 2

Morita-san,

Thank you for your comment and sorry for my slow update.

> +- (BOOL)hasSpellingMarker:(int)location length:(int)length;
If this is for testing purpose, how about to declare this in WebFrameInternal.h ?

This function is used from TextInputController.m, i.e. outside of WebKit. So, I'm wondering if we can put this function in WebFrameInternal.h. (I need a comment from WebKit experts, though.)

By the way, I have updated my change to make it more compliant with the WebKit coding style. It is definitely helpful to give me your comments.

Regards,

Hironori Bono
Comment 4 WebKit Review Bot 2010-08-20 02:41:20 PDT
Attachment 64938 [details] did not pass style-queue:

Failed to run "['WebKitTools/Scripts/check-webkit-style']" exit_code: 1
LayoutTests/platform/chromium/test_expectations.txt:3256:  Path does not exist. editing/spelling/spelling-contenteditable.html  [test/expectations] [2]
Total errors found: 1 in 16 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 5 Hironori Bono 2010-08-23 22:20:01 PDT
Created attachment 65208 [details]
A possible fix 3

Greetings,

Even though the previous change has not been reviewed by nobody, I have updated this change because the previous change does not work any longer since r65787. I wish some one reviews this change before it becomes obsolete.

Regards,

Hironori Bono
Comment 6 WebKit Review Bot 2010-08-23 22:21:21 PDT
Attachment 65208 [details] did not pass style-queue:

Failed to run "['WebKitTools/Scripts/check-webkit-style']" exit_code: 1
LayoutTests/platform/chromium/test_expectations.txt:3237:  Path does not exist. editing/spelling/spelling-contenteditable.html  [test/expectations] [2]
Total errors found: 1 in 16 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 7 Hironori Bono 2010-08-23 22:27:17 PDT
(In reply to comment #6)
> Attachment 65208 [details] did not pass style-queue:
> 
> Failed to run "['WebKitTools/Scripts/check-webkit-style']" exit_code: 1
> LayoutTests/platform/chromium/test_expectations.txt:3237:  Path does not exist. editing/spelling/spelling-contenteditable.html  [test/expectations] [2]
> Total errors found: 1 in 16 files
> 
> If any of these errors are false positives, please file a bug against check-webkit-style.

This is a new test added by my change. I'm wondering why webkit-style complains the file does not exist?

Regards,

Hironori Bono
Comment 8 Hajime Morrita 2010-08-23 23:13:47 PDT
Hi bono-san, thank you for revising the patch and I'm really sorry for my lack of response.

> > +- (BOOL)hasSpellingMarker:(int)location length:(int)length;
> If this is for testing purpose, how about to declare this in WebFrameInternal.h ?
> 
> This function is used from TextInputController.m, i.e. outside of WebKit. So, I'm wondering if we can put this function in WebFrameInternal.h. (I need a comment from WebKit experts, though.)

I'm sorry that I was wrong.
What I meant is WebFramePrivate.h. WebXxxPrivate.h looks the location where
we put test-specific (or other Apple specific) APIs. 
There are WebViewPrivate.h, WebPrefrencesPrivate.h, etc.
WebFrame.h is a part of WebKit public API and will be shipped with WebKit framework.
So it would be safe to avoid something new there.

About a test, how about to adopt script-tests style?
This test is for DumpRenderTree itself and doesn't need to run on the browser.
So we can use script-tests safely and it would make the test more concise.
Comment 9 Hironori Bono 2010-08-25 23:16:04 PDT
Created attachment 65528 [details]
A possible fix 4

(In reply to comment #8)
> I'm sorry that I was wrong.
> What I meant is WebFramePrivate.h. WebXxxPrivate.h looks the location where
> we put test-specific (or other Apple specific) APIs. 
> There are WebViewPrivate.h, WebPrefrencesPrivate.h, etc.
> WebFrame.h is a part of WebKit public API and will be shipped with WebKit framework.
> So it would be safe to avoid something new there.

It makes sense to move this function to WebFramePrivate.h. I have updated my change.
 
> About a test, how about to adopt script-tests style?
> This test is for DumpRenderTree itself and doesn't need to run on the browser.
> So we can use script-tests safely and it would make the test more concise.

These tests depends on "LayoutTests/editing/editing.js" to send editor commands. To move my tests to "LayoutTests/dom/script-tests", I need to copy some functions in the "editing.js" to my tests. I'm wondering if it is good to copy such editor functions to script-tests.

Regards,
Comment 10 WebKit Review Bot 2010-08-25 23:20:45 PDT
Attachment 65528 [details] did not pass style-queue:

Failed to run "['WebKitTools/Scripts/check-webkit-style']" exit_code: 1
LayoutTests/platform/chromium/test_expectations.txt:3180:  Path does not exist. editing/spelling/spelling-contenteditable.html  [test/expectations] [2]
Total errors found: 1 in 16 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 11 Kent Tamura 2010-08-25 23:29:02 PDT
> > About a test, how about to adopt script-tests style?
> > This test is for DumpRenderTree itself and doesn't need to run on the browser.
> > So we can use script-tests safely and it would make the test more concise.
> 
> These tests depends on "LayoutTests/editing/editing.js" to send editor commands. To move my tests to "LayoutTests/dom/script-tests", I need to copy some functions in the "editing.js" to my tests. I'm wondering if it is good to copy such editor functions to script-tests.

You can provide TEMPLATE.html which includes both of editing.js and js/resources/js-test-pre.js.
I don't think we have to apply script-tests style in this case.  But I recommend to use js-test-pre.js even if you don't apply scripte-tests style.  It would make the test code simpler.


(In reply to comment #7)
> > LayoutTests/platform/chromium/test_expectations.txt:3237:  Path does not exist. editing/spelling/spelling-contenteditable.html  [test/expectations] [2]
> > Total errors found: 1 in 16 files
> This is a new test added by my change. I'm wondering why webkit-style complains the file does not exist?

Our style checker looks at just diff.  So it doesn't know newly added tests. You can ignore this error.
Comment 12 Darin Adler 2010-08-26 11:21:09 PDT
(In reply to comment #9)
> These tests depends on "LayoutTests/editing/editing.js" to send editor commands. To move my tests to "LayoutTests/dom/script-tests", I need to copy some functions in the "editing.js" to my tests. I'm wondering if it is good to copy such editor functions to script-tests.

Every .js file in script-tests has to be a test; the wrapper-creation process will create a .html for each one of the .js files in that directory. Other .js files should be in other directories and kept out of the script-tests directory.
Comment 13 Shinichiro Hamaji 2010-08-26 21:24:24 PDT
Comment on attachment 65528 [details]
A possible fix 4

WebCore/ChangeLog:9
 +          Tests: editing/spelling/spelling-contentediable.html
contentediable => contentedi*t*able

This might be the reason why the style bot complained. As style bot applies the patch before it checks the patch, a newly added files should be seen from the style checker.
Comment 14 Hironori Bono 2010-09-01 03:17:11 PDT
Created attachment 66187 [details]
A possible fix 5

(In reply to comment #13)
> (From update of attachment 65528 [details])
> WebCore/ChangeLog:9
>  +          Tests: editing/spelling/spelling-contentediable.html
> contentediable => contentedi*t*able
> 
> This might be the reason why the style bot complained. As style bot applies the patch before it checks the patch, a newly added files should be seen from the style checker.

Thank you for noticing this bonehead mistake of mine. I have renamed the test.

Regards,

Hironori Bono
Comment 15 Kent Tamura 2010-09-03 00:02:19 PDT
Comment on attachment 66187 [details]
A possible fix 5

Don't you update the test code?
I meant
 - add <script src="../../fast/js/resource/js-test-pre.js"></script>
 - Use debug(), testPassed(), and testFailed().
Comment 16 Kent Tamura 2010-09-03 00:02:56 PDT
(In reply to comment #15)
>  - add <script src="../../fast/js/resource/js-test-pre.js"></script>

/resource/ -> /resources/
Comment 17 Hironori Bono 2010-09-03 02:25:44 PDT
Created attachment 66478 [details]
A possible fix 6

(In reply to comment #15)
> (From update of attachment 66187 [details])
> Don't you update the test code?
> I meant
>  - add <script src="../../fast/js/resource/js-test-pre.js"></script>
>  - Use debug(), testPassed(), and testFailed().

Sorry, I missed this comment. I have updated my tests to used them.

Regards,
Comment 18 Kent Tamura 2010-09-03 02:28:02 PDT
Comment on attachment 66478 [details]
A possible fix 6

ok, great!
Comment 19 WebKit Commit Bot 2010-09-03 03:36:29 PDT
Comment on attachment 66478 [details]
A possible fix 6

Clearing flags on attachment: 66478

Committed r66721: <http://trac.webkit.org/changeset/66721>
Comment 20 WebKit Commit Bot 2010-09-03 03:36:35 PDT
All reviewed patches have been landed.  Closing bug.
Comment 21 Hironori Bono 2010-09-07 20:08:28 PDT
Greetings,

Thank you all for your review and comments.
By the way, should I file another bug for platform-specific implementation of textInputController.hasSpellingMarker(), such as Chromium?

Regards,

Hironori Bono
Comment 22 Kent Tamura 2010-09-07 20:17:58 PDT
(In reply to comment #21)
> By the way, should I file another bug for platform-specific implementation of textInputController.hasSpellingMarker(), such as Chromium?

I recommend to file another bug.
Discussing multiple patch in one bug is messy.
Comment 23 Hironori Bono 2010-09-08 23:31:13 PDT
(In reply to comment #22)

> I recommend to file another bug.
> Discussing multiple patch in one bug is messy.

Thank you for your advice. I have filed Bug 45441 so I can upload the Chromium implementation of the function.

Regards,

Hironori Bono
Comment 24 Alexey Proskuryakov 2012-03-20 10:26:15 PDT
I think that this should have been in WebFrameInternal indeed, not WebFramePrivate. We didn't want to expose this to code other than our own testing tools.

This has been moved to Internals today, and removing the method from WebFramePrivate.h was a little risky already.