How to keep mock impl of mojo interface alive even after main frame navigation?

24 views
Skip to first unread message

Leon

unread,
Mar 13, 2017, 10:58:24 PM3/13/17
to chromium-mojo, blun...@chromium.org, timvo...@chromium.org, blin...@chromium.org
Hi,
I'm working on this CL to create some layout tests for VibrationManager mojo interface, and normal test cases are OK, 'navigator.vibrate()' can trigger running mock impl of VibrationManager well.

Now the question is how could we handle such a case:
  Step1: Call navigator.vibrate(1234) on main frame ==> Need to confirm the mock impl has actually started vibration.
  Step2: Navigate main frame to another arbitrary URL ==> Need to confirm the mock impl will cancel vibration started by step1.

We can do confirmation on step1, but have no idea how to do that for step2, 
because main frame navigation will destroy the javascript environment of current page then we can't monitor the result.. 
Are there any global places where we can put the result which we can still check even after page navigation? Thanks!

Joe Mason

unread,
Mar 14, 2017, 12:38:20 PM3/14/17
to Leon, blink-dev, Colin Blundell, chromium-mojo, timvo...@chromium.org
A shared worker?

Jeremy Roman

unread,
Mar 14, 2017, 1:57:53 PM3/14/17
to Joe Mason, Leon, blink-dev, Colin Blundell, chromium-mojo, timvo...@chromium.org
Does it have to be the main frame? Could you instead navigate a subframe?

--
You received this message because you are subscribed to the Google Groups "chromium-mojo" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-mojo+unsubscribe@chromium.org.
To post to this group, send email to chromi...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-mojo/CAH%3DT95SDvw0j-g1iikO_DKTMdTTQKpd1G_XvRLeUFJJc5B%3D62A%40mail.gmail.com.

Reilly Grant

unread,
Mar 14, 2017, 6:04:18 PM3/14/17
to Jeremy Roman, Joe Mason, Leon, blink-dev, Colin Blundell, chromium-mojo, timvo...@chromium.org
Right now I don't believe that you can run a Mojo mock service in a worker but this sounded intriguing so I filed an issue to track the idea: https://bugs.chromium.org/p/chromium/issues/detail?id=701559

On Tue, Mar 14, 2017 at 10:57 AM Jeremy Roman <jbr...@chromium.org> wrote:
Does it have to be the main frame? Could you instead navigate a subframe?

On Tue, Mar 14, 2017 at 12:38 PM, Joe Mason <joenot...@chromium.org> wrote:
A shared worker?

On Mar 13, 2017 10:58 PM, "Leon" <leon...@intel.com> wrote:
Hi,
I'm working on this CL to create some layout tests for VibrationManager mojo interface, and normal test cases are OK, 'navigator.vibrate()' can trigger running mock impl of VibrationManager well.

Now the question is how could we handle such a case:
  Step1: Call navigator.vibrate(1234) on main frame ==> Need to confirm the mock impl has actually started vibration.
  Step2: Navigate main frame to another arbitrary URL ==> Need to confirm the mock impl will cancel vibration started by step1.

We can do confirmation on step1, but have no idea how to do that for step2, 
because main frame navigation will destroy the javascript environment of current page then we can't monitor the result.. 
Are there any global places where we can put the result which we can still check even after page navigation? Thanks!

--
You received this message because you are subscribed to the Google Groups "chromium-mojo" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-moj...@chromium.org.

To post to this group, send email to chromi...@chromium.org.

Leon

unread,
Mar 14, 2017, 10:16:43 PM3/14/17
to chromium-mojo, joenot...@chromium.org, leon...@intel.com, blin...@chromium.org, blun...@chromium.org, timvo...@chromium.org
Yeah test cases for sub frame navigation are already OK in this CL, the problem now is for main frame navigation.


On Wednesday, March 15, 2017 at 1:57:53 AM UTC+8, Jeremy Roman wrote:
Does it have to be the main frame? Could you instead navigate a subframe?
On Tue, Mar 14, 2017 at 12:38 PM, Joe Mason <joenot...@chromium.org> wrote:
A shared worker?

On Mar 13, 2017 10:58 PM, "Leon" <leon...@intel.com> wrote:
Hi,
I'm working on this CL to create some layout tests for VibrationManager mojo interface, and normal test cases are OK, 'navigator.vibrate()' can trigger running mock impl of VibrationManager well.

Now the question is how could we handle such a case:
  Step1: Call navigator.vibrate(1234) on main frame ==> Need to confirm the mock impl has actually started vibration.
  Step2: Navigate main frame to another arbitrary URL ==> Need to confirm the mock impl will cancel vibration started by step1.

We can do confirmation on step1, but have no idea how to do that for step2, 
because main frame navigation will destroy the javascript environment of current page then we can't monitor the result.. 
Are there any global places where we can put the result which we can still check even after page navigation? Thanks!

--
You received this message because you are subscribed to the Google Groups "chromium-mojo" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-moj...@chromium.org.

To post to this group, send email to chromi...@chromium.org.

Daniel Cheng

unread,
Mar 15, 2017, 5:13:13 AM3/15/17
to Leon, chromium-mojo, joenot...@chromium.org, blin...@chromium.org, blun...@chromium.org, timvo...@chromium.org

Is the mock globally installed? If so, maybe the test could run in a pop-up window?

Daniel


Han, Leon

unread,
Mar 16, 2017, 4:24:02 AM3/16/17
to Daniel Cheng, chromium-mojo, joenot...@chromium.org, blin...@chromium.org, blun...@chromium.org, timvo...@chromium.org
Hi, Daniel, Thank you very much!
We're installing mock into sub frame just like here ,
but could we do the same thing on the window object of a pop-up window? I'm not sure..



From: Daniel Cheng [dch...@chromium.org]
Sent: Wednesday, March 15, 2017 5:13 PM
To: Han, Leon; chromium-mojo
Cc: joenot...@chromium.org; blin...@chromium.org; blun...@chromium.org; timvo...@chromium.org
Subject: Re: [blink-dev] How to keep mock impl of mojo interface alive even after main frame navigation?

Daniel Cheng

unread,
Mar 19, 2017, 11:41:42 PM3/19/17
to Han, Leon, chromium-mojo, joenot...@chromium.org, blin...@chromium.org, blun...@chromium.org, timvo...@chromium.org
I would say try it and see if it works. If it doesn't, we can probably change the Mojo testing integration to inject the mocks globally (since that's probably what we want anyway?)

Daniel
Reply all
Reply to author
Forward
0 new messages