EvalJs has the following improvements over ExecuteScript:
- One function that works for every return type
(no AndExtractBool etc variants) and every fancy
option (isolated worlds, user gestures).
- No out-params; no out-param variables.
- |script| doesn't need to call domAutomationController explicitly
to return a value. Instead, it has eval() semantics -- the statement
completion value becomes the result.
- The result of EvalJs can be used directly in EXPECT_EQ; e.g.::
EXPECT_EQ("about:blank", EvalJs(contents, "window.location.href"));
- JS exceptions are reliably captured and will appear as C++ assertion
failures.
- JS stack traces arising from exceptions are annotated with the
corresponding source code; this also appears in C++ assertion failures.
- When a script doesn't produce a result, tests are much less likely
to hang.
- Doesn't get confused by crosstalk with other callers
of domAutomationController.send().
- Lists, dicts, null values, etc. can be returned as base::Values.
Limitations/warts:
- The reliance on eval() currently means that a CSP script-src
directive can interfere with the script runner. There is
a workaround (use an isolated world), but this limitation
currently prevents ExecJs from being a drop-in replacement
for ExecuteScript. Fixing that will be a follow-on.
Change-Id: I260595094f71e7734d29a78e9ffd90b409d74f37
Reviewed-on: https://chromium-review.googlesource.com/1125121
Commit-Queue: Nick Carter <nick@chromium.org>
Reviewed-by: Ben Greenstein <bengr@chromium.org>
Reviewed-by: Łukasz Anforowicz <lukasza@chromium.org>
Cr-Commit-Position: refs/heads/master@{#580702}
RenderWidgetHostViewAura should use IsMouseLocked instead of
mouse_locked_ because the locked state is stored in RWHV_event_handler.
Remove mouse_locked_ from the base class to prevent misuse.
Bug: 812964
Change-Id: I5201c7b6d77d1e52f9da2344899b6ab293e44f86
Reviewed-on: https://chromium-review.googlesource.com/1102911
Reviewed-by: Antoine Labour <piman@chromium.org>
Reviewed-by: Navid Zolghadr <nzolghadr@chromium.org>
Reviewed-by: Sadrul Chowdhury <sadrul@chromium.org>
Commit-Queue: Ella Ge <eirage@chromium.org>
Cr-Commit-Position: refs/heads/master@{#570072}
1. Changed TransformPointToLocalCoordSpace to be non-virtual and use
HitTestQuery when we use Viz hit-test. If there are no viz::EventSource
specified, we match viz::EventSource::ALL (added) events. Added
TransformPointToLocalCoordSpaceLegacy (virtual) to do essentially what
TransformPointToLocalCoordSpace used to do on different platforms.
2. TransformPointToRootCoordSpaceF, TransformRootPointToViewCoordSpace and
TransformPointToCoordSpaceForView all use TransformPointToLocalCoordSpace
essentially, added necessary info to use the new version correctly.
3. Overridded GetRootFrameSinkId() in RenderWidgetHostViewChildFrame and
RenderWidgetHostViewGuest.
Bug: 811928
Test: covered by tests
Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel
Change-Id: I6d36e954d821ff5a9f6b68b545acd1ef4a3a2114
Reviewed-on: https://chromium-review.googlesource.com/940602
Reviewed-by: Nasko Oskov <nasko@chromium.org>
Reviewed-by: Sadrul Chowdhury <sadrul@chromium.org>
Reviewed-by: Ken Buchanan <kenrb@chromium.org>
Commit-Queue: Ria Jiang <riajiang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#556502}
Write a test of mouse_lock_widget_ cleanup. Fix WebContentsImpl so that it passes.
Bug: 820593, 821187
Change-Id: I99cd6b8c728f7e4501205574db8d17b206f2856e
Reviewed-on: https://chromium-review.googlesource.com/957479
Commit-Queue: Nick Carter <nick@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Lucas Gadani <lfg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#542865}
WebInputEvent's timestamp will change to a base::TimeTicks in a followup
CL, so the test timestamp's type will change as well. Normally, this
would be easy: the followup patch would simply change the type of
kTimeStampForTesting to base::TimeTicks.
However, changing the type means that kTimeStampForTesting is considered
ODR-used when passed as a direct argument to EXPECT_EQ, and thus
requires a definition. Pre-C++17, this definition must be out-of-line.
However, that means WebInputEvent is no longer a header-only class,
which means all consumers of this header must link against Blink itself.
This is undesirable, since WebInputEvent is also used from the browser
process, which should not link against Blink.
To workaround all of this, change it to a helper function which is inline
in the header and won't suffer from the ODR-use issues with googletest.
TBR=jam@chromium.org
Bug: 763980
Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2
Change-Id: Ic6f3b31f2abf747af70f7c96d9f44a5151265582
Reviewed-on: https://chromium-review.googlesource.com/917335
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
Reviewed-by: Jeremy Roman <jbroman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#536767}
This takes care of both the the standard frame eviction case and the
stale content source ID case where we want to evict the current frame.
Primary surfaces are activation dependencies whereas fallbacks are
are permanent surface references so frame eviction implies eviction
of a fallback not a primary surface ID.
Content source ID still does the right thing because of the current plumbing:
CompositorFrames go to RenderWidgetHostImpl::SubmitCompositorFrame first
before DelegatedFrameHost::SubmitCompositorFrame. Stale content source IDs
will never make their way to DelegatedFrameHost. Thus, if we evict a
a fallbacksurface then the next surface to arrive in DelegatedFrameHost
must have an appropriate content source ID.
Bug: 672962
Change-Id: Ib1480e6be908d227f4a517761614984e6f931515
Reviewed-on: https://chromium-review.googlesource.com/813055
Commit-Queue: Fady Samuel <fsamuel@chromium.org>
Reviewed-by: Antoine Labour <piman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#522928}
Originally landed here:
https://chromium-review.googlesource.com/c/chromium/src/+/719601
The change caused a racy test to flake on Mac and was reverted. This
patch restores the original CL and fixes the cause of the flakiness in
the problematic test.
Was earlier relanded with a fix to only one of the two tests that had
race conditions.
TBR=dcheng@chromium.org
Bug: 761478, 784236, 785080
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_site_isolation
Change-Id: I947a70b256b0783b2c687c1213c6e00fe06550a8
Reviewed-on: https://chromium-review.googlesource.com/771773
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Ken Buchanan <kenrb@chromium.org>
Commit-Queue: Ken Buchanan <kenrb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#516758}
This reverts commit 967badcc77.
Reason for revert: looks like content_browsertests failing on chromium.mac/Mac10.10 Tests in PointerLockBrowserTest.PointerLockEventRouting and this might be the culprit
Original change's description:
> Reland: Enable render throttling for OOPIFs
>
> Originally landed here:
> https://chromium-review.googlesource.com/c/chromium/src/+/719601
>
> The change caused a racy test to flake on Mac and was reverted. This
> patch restores the original CL and fixes the cause of the flakiness in
> the problematic test.
>
> TBR=dcheng@chromium.org
>
> Bug: 761478, 784236
> Cq-Include-Trybots: master.tryserver.chromium.linux:linux_site_isolation
> Change-Id: I0a4da143505b60ce21083413f741e4fe24b0db42
> Reviewed-on: https://chromium-review.googlesource.com/769489
> Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
> Reviewed-by: Ken Buchanan <kenrb@chromium.org>
> Commit-Queue: Ken Buchanan <kenrb@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#516454}
TBR=kenrb@chromium.org,alexmos@chromium.org
Change-Id: I6d35267d8b5eb361ccc56bd62148edc6acb7dd14
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 761478, 784236
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_site_isolation
Reviewed-on: https://chromium-review.googlesource.com/770270
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Commit-Queue: Dirk Pranke <dpranke@chromium.org>
Cr-Commit-Position: refs/heads/master@{#516520}
With mus we want the renderer doing the embedding to create the window
on the window server and embed the guest renderer in it. This is done
by having the browser obtain the guest WindowTreeClient, call
ScheduleEmbed(), pass the token to the renderer doing the embedding
which then calls embed using the token (done using MusEmbeddedFrame).
With this flow the guest WebContents doesn't need to create an aura::Window,
that is effectively done by the renderer.
My understanding is all this code will go away within the next
quarter, so I didn't try to isolate the USE_AURA ifdefs particularly
well.
BUG=755440
TEST=none
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_site_isolation
Change-Id: I3efb44c02e829b46c95e595c76216c9ef61b45a4
Reviewed-on: https://chromium-review.googlesource.com/731704
Commit-Queue: Scott Violet <sky@chromium.org>
Reviewed-by: Fady Samuel <fsamuel@chromium.org>
Reviewed-by: Istiaque Ahmed <lazyboy@chromium.org>
Reviewed-by: Ken Buchanan <kenrb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#513968}
Use float coordinates conversion and remove truncation in
render host.
This CL doesn't expose the fractions to the web
because of truncation in later stages in event pipeline.
Bug: 456625
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_site_isolation
Change-Id: I30803bf5eab3b0fbe71abef6eaaf16a468770f15
Reviewed-on: https://chromium-review.googlesource.com/692175
Commit-Queue: Ella Ge <eirage@chromium.org>
Reviewed-by: Ken Buchanan <kenrb@chromium.org>
Reviewed-by: Charlie Reis <creis@chromium.org>
Reviewed-by: Robert Flack <flackr@chromium.org>
Reviewed-by: Mustaq Ahmed <mustaq@chromium.org>
Reviewed-by: Dave Tapuska <dtapuska@chromium.org>
Cr-Commit-Position: refs/heads/master@{#510094}
This CL moves some code from DelegatedFrameHost::SubmitCompositorFrame
to DelegatedFrameHost::OnFirstSurfaceActivation.
If surface synchronization is off, then OnFirstSurfaceActivation gets called
on the same callstack as SubmitCompositorFrame so without surface
synchronization the behavior is roughly the same:
OnFirstSurfaceActivation is called whenever the LocalSurfaceId changes.
With this CL the ui::Layer's primary SurfaceInfo is updated as soon
as a resize is requested. Browser UI will block until a corresponding
CompositorFrame is received or a deadline hits.
Bug: 672962
Change-Id: Iba25288be24826435185460634f76e21e51ca76f
Reviewed-on: https://chromium-review.googlesource.com/654198
Commit-Queue: Fady Samuel <fsamuel@chromium.org>
Reviewed-by: Antoine Labour <piman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#504607}
This cl fixes failing content_browsertests and content_unittests when
the wheel scroll latching and async wheel events are enabled.
This also changes synthetic_smooth_move_gesture to prevent smoothScrollBy
from sending synthetic wheel events with zero deltas and
phase!=phaseEnded.
TBR: thakis@chromium.org
Bug: 526463
Change-Id: Ib28f9dcbe11520d7e8a46fe05cb2d2eb92d6ba80
Reviewed-on: https://chromium-review.googlesource.com/602477
Commit-Queue: Sahel Sharifymoghaddam <sahel@chromium.org>
Reviewed-by: Erik Chen <erikchen@chromium.org>
Reviewed-by: James MacLean <wjmaclean@chromium.org>
Reviewed-by: Nasko Oskov <nasko@chromium.org>
Reviewed-by: Timothy Dresser <tdresser@chromium.org>
Cr-Commit-Position: refs/heads/master@{#495173}
To test the change run the following browser test with --enable-features
= TouchpadAndWheelScrollLatching, AsyncWheelEvents runtime flags.
BUG=526463
TEST=PointerLockBrowserTest.PointerLockWheelEventRouting,
SitePerProcessMouseWheelBrowserTest.SubframeWheelEventsOnMainThread,
SitePerProcessMouseWheelBrowserTest.MainframeWheelEventsOnMainThread
Review-Url: https://codereview.chromium.org/2969233002
Cr-Commit-Position: refs/heads/master@{#484576}
Identifiers in Blink now largely follow the standard Chrome style
conventions, with several additional rules:
- web-exposed methods remain namedLikeThis() for consistency with
Javascript bindings.
- method names are never named_in_hacker_case()
- enumerator names are kNamedLikeThis.
This commit was generated by the following process.
1. Running //tools/clang/rewrite_to_chrome_style across the codebase.
2. Apply manual fixes.
3. git cl format
BUG=578344
R=lukasza@chromium.orgTBR=darin@chromium.org
Change-Id: Ide5d397d3c6a5d973fd0a6f81dccf82561d4bb71
Reviewed-on: https://chromium-review.googlesource.com/472192
Reviewed-by: Blink Reformat <blink-reformat@chromium.org>
Cr-Commit-Position: refs/heads/master@{#463139}
This CL moves WebMouseEvent coordinates (former (x,y) &
(globalX,globalY) into private members in the class, and
made them fractional in the /internal/ plumbing. There is
no change in behavior here since all coordinates
are truncated to integers on "input" to avoid regressions
(we will get rid of the truncation in a future CL).
BUG=456625
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_site_isolation
Review-Url: https://codereview.chromium.org/2782893002
Cr-Commit-Position: refs/heads/master@{#462082}
The RenderWidgetHostViewMac can outlive its RenderWidgetHost, so we need
to check if the RenderWidgetHost is alive before dereferencing it.
BUG=none
Review-Url: https://codereview.chromium.org/2768263005
Cr-Commit-Position: refs/heads/master@{#459428}
is the one holding the pointer lock.
This fixes a crash where the WebContents would stop tracking which
RenderWidgetHost was holding the pointer lock.
BUG=703284
Review-Url: https://codereview.chromium.org/2760343002
Cr-Commit-Position: refs/heads/master@{#458446}