0
Commit Graph

42 Commits

Author SHA1 Message Date
Lei Zhang
05c13df891 Remove unnecessary ContentBrowserTest::SetUpCommandLine() calls
ContentBrowserTest::SetUpCommandLine() is actually not defined. Calls to
this method ends up running BrowserTestBase::SetUpCommandLine(), which
is always going to be empty. Since there is no point in calling this
method, delete all the callers from SetUpCommandLine() overrides. When
the override becomes empty, delete the override altogether.

Make a note of this in the comments in content_browser_test.h. Also fix
some lint errors along the way.

Change-Id: I81f263286d72ebdab68dfd9575ad4cf2b6378a3c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5691227
Reviewed-by: Avi Drissman <avi@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1325736}
2024-07-10 20:59:12 +00:00
Takumi Fujimoto
22094c0269 Have KeyboardLockController resolve/reject the keyboard lock promise
The call stack for keyboard lock is as follows (called from bottom to
top):

KeyboardLockController::RequestKeyboardLock()
Browser::RequestKeyboardLock()
WebContentsImpl::RequestKeyboardLock()
RenderWidgetHostImpl::RequestKeyboardLock()
KeyboardLockServiceImpl::RequestKeyboardLock()
blink::KeyboardLock::lock() (navigator.keyboard.lock())

Before this CL, whether to resolve/reject the lock() promise was
determined by WebContentsImpl and below in a synchronous manner,
without the input from KeyboardLockController. This CL allows
KeyboardLockController to resolve/reject the promise asynchronously,
which will allow it to show a permission prompt for keyboard lock.
A permission prompt will be added in a future CL.

Bug: 324147495
Change-Id: I544d77bc1361162705f6a7b0709e4ab35cccc9c5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5399458
Reviewed-by: Avi Drissman <avi@chromium.org>
Commit-Queue: Takumi Fujimoto <takumif@chromium.org>
Reviewed-by: Mike Wasserman <msw@chromium.org>
Reviewed-by: Joe Downing <joedow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1281659}
2024-04-03 04:56:11 +00:00
Muyao Xu
db226be5ba Revert "Remove will_cause_resize from WebContents::ExitFullscreen()"
This reverts commit 1abc874e14.

Reason for revert: Causing resize janks crbug.com/1506034

Original change's description:
> Remove `will_cause_resize` from WebContents::ExitFullscreen()
>
> This CL fixes a regression on Mac that if a web page enters the tab
> fullscreen mode and then exits fullscreen by system controls (keyboard
> shortcuts or window control buttons), the page becomes
> fullscreen-in-tab. This issue was caused by the browser not sending
> a resize message to the renderer after browser has exited fullscreen.
> Specifically, the resize message isn't sent because the browser
> is told that there will by another resize event and skips this message
> when `will_cause_resize` is True.
>
> This issue can be solved by removing the `will_cause_resize` parameter
> from WebContents::ExitFullscreen() so that a resize message is sent
> every time this function is called to exit fullscreen.
>
> The `will_cause_resize` flag was initially added to restore the
> scroll position when toggling fullscreen mode crrev.com/1488653002
> However, the scroll restoration was later removed because of its
> complexity by crrev.com/c/1195714 and this flag wasn't cleaned up
> at that time.
>
> There are several places where a True value is passed to
> `will_cause_resize` i.e. exit fullscreen when showing a printer pop
> up dialog. These use cases shouldn't be affected by having another
> page resize.
>
> Bug: 1469462
> Change-Id: I5c522121ea6eae847c2816f0239ff8f0fa97f8ae
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5031312
> Reviewed-by: Alexander Cooper <alcooper@chromium.org>
> Commit-Queue: Muyao Xu <muyaoxu@google.com>
> Reviewed-by: Avi Drissman <avi@chromium.org>
> Reviewed-by: Kevin McNee <mcnee@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1224651}

Bug: 1469462
Change-Id: Id5ed791ea63ff9e9c0fb07eaec07d1a999f4cfcf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5074445
Reviewed-by: Kevin McNee <mcnee@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Commit-Queue: Muyao Xu <muyaoxu@google.com>
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1231733}
2023-12-01 04:23:09 +00:00
Muyao Xu
1abc874e14 Remove will_cause_resize from WebContents::ExitFullscreen()
This CL fixes a regression on Mac that if a web page enters the tab
fullscreen mode and then exits fullscreen by system controls (keyboard
shortcuts or window control buttons), the page becomes
fullscreen-in-tab. This issue was caused by the browser not sending
a resize message to the renderer after browser has exited fullscreen.
Specifically, the resize message isn't sent because the browser
is told that there will by another resize event and skips this message
when `will_cause_resize` is True.

This issue can be solved by removing the `will_cause_resize` parameter
from WebContents::ExitFullscreen() so that a resize message is sent
every time this function is called to exit fullscreen.

The `will_cause_resize` flag was initially added to restore the
scroll position when toggling fullscreen mode crrev.com/1488653002
However, the scroll restoration was later removed because of its
complexity by crrev.com/c/1195714 and this flag wasn't cleaned up
at that time.

There are several places where a True value is passed to
`will_cause_resize` i.e. exit fullscreen when showing a printer pop
up dialog. These use cases shouldn't be affected by having another
page resize.

Bug: 1469462
Change-Id: I5c522121ea6eae847c2816f0239ff8f0fa97f8ae
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5031312
Reviewed-by: Alexander Cooper <alcooper@chromium.org>
Commit-Queue: Muyao Xu <muyaoxu@google.com>
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Kevin McNee <mcnee@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1224651}
2023-11-15 00:29:04 +00:00
Chris Fredrickson
b854bbf9be Remove some usages of EXECUTE_SCRIPT_USE_MANUAL_REPLY under content/
Removing reliance on EXECUTE_SCRIPT_USE_MANUAL_REPLY forces the
JavaScript to be written in terms of promises, which makes the code
less bug-prone since double-sends are systematically prevented (see
https://crrev.com/c/4318742 for an example bug that would have been
prevented by this).

There are still more usages, especially under content/browser/webrtc,
but those removals are not as mechanical and will be attempted in
followups.

Bug: 1423407, 1422660
Change-Id: Ib8f153da50f0bd3e2d09e00615973264dc3214d4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4332196
Reviewed-by: Dale Curtis <dalecurtis@chromium.org>
Auto-Submit: Chris Fredrickson <cfredric@chromium.org>
Commit-Queue: Chris Fredrickson <cfredric@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1122508}
2023-03-27 17:27:44 +00:00
Nick Diego Yamane
a2607afe80 properly disable KeyboardLock tests in unsupported platforms
This basically homogenizes the way platform-agnostic KeyboardLock
content browser tests are disabled in currently unsupported platforms.

Fixed: 1414629
Change-Id: I776384adbb26ca2e9efd13f2f1dc8956e7761b57
Cq-Include-Trybots: luci.chromium.try:linux-x64-castos
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4240688
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Auto-Submit: Nick Yamane <nickdiego@igalia.com>
Commit-Queue: John Abd-El-Malek <jam@chromium.org>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1105361}
2023-02-14 23:49:32 +00:00
Fergal Daly
49ab3f5754 Disable 13 keyboard lock tests on fuchsia.
The revert to fix this has conflicts https://crrev.com/c/4232185
so just disabling the tests.

Bug: 1414160
Change-Id: Ie0318988f1db77bbd6beff2be3e17d106ababd4c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4235278
Owners-Override: Fergal Daly <fergal@google.com>
Commit-Queue: Fergal Daly <fergal@chromium.org>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Reviewed-by: Nick Yamane <nickdiego@igalia.com>
Cr-Commit-Position: refs/heads/main@{#1103070}
2023-02-09 01:55:50 +00:00
Avi Drissman
4e1b7bc33d Update copyright headers in content/
The methodology used to generate this CL is documented in
https://crbug.com/1098010#c34.

No-Try: true
No-Presubmit: true
Bug: 1098010
Change-Id: I8c0f009d16350271f07d8e5e561085822cc9dd27
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3895935
Owners-Override: Avi Drissman <avi@chromium.org>
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
Auto-Submit: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1047456}
2022-09-15 14:03:50 +00:00
Dave Tapuska
327c06c9c7 Rename GetMainFrame to GetPrimaryMainFrame
Progressively rename some usages of GetMainFrame to GetPrimaryMainFrame.

This is an automated change via git grep & sed.

BUG=1250404

Change-Id: I5e8fda4f11104cf9fcde8a690a33dc6ab7c34f3f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3696741
Reviewed-by: Nasko Oskov <nasko@chromium.org>
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1013636}
2022-06-13 20:31:51 +00:00
Colin Blundell
ecd384fa19 [DOMMessageQueue] Convert content_browsertests to preferred constructor
This CL converts the remaining usages of the DOMMessageQueue default
constructor in content_browsertests to the one that takes in a
WebContents instance. The former listens for messages from all
WebContents instances via a notification, while the latter observes the
passed-in WebContents instance to listen for messages from that
instance. We are trying to eliminate the former entirely as part of the
elimination of NotificationService.

The conversions are for the most part straightforward; the one
exception is site_per_process_unload_browsertest.cc, in which we need
to catch a WebContents instance created via a popup to be able to listen
for messages that occur in that instance.

Bug: 1174774
Change-Id: Ieaf7d2811282e2a3c0c7dbbe95c58d2c7aeff20c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3635781
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Commit-Queue: Colin Blundell <blundell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1001976}
2022-05-11 08:58:30 +00:00
Peter Boström
1d6a095400 Remove unused "base/macros.h" in content/
Removes `#include "base/macros.h"` from files in content/ that do not
contain `ignore_result(`.

Bug: 1010217
No-Try: true
Change-Id: I887403408704241047e3bd66e953ff7df195368b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3274993
Commit-Queue: Peter Boström <pbos@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Owners-Override: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/main@{#940781}
2021-11-11 16:07:03 +00:00
Peter Boström
828b902994 Replace DISALLOW_COPY_AND_ASSIGN in content/
This replaces DISALLOW_COPY_AND_ASSIGN with explicit constructor deletes
where a local script is able to detect its insertion place (~Foo() is
public => insert before this line).

This is incomplete as not all classes have a public ~Foo() declared, so
not all DISALLOW_COPY_AND_ASSIGN occurrences are replaced.

IWYU cleanup is left as a separate pass that is easier when these macros
go away.

Bug: 1010217
Change-Id: Iea478401b7580682c7b9f195f7af9cbbdb6ce315
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3167292
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Owners-Override: Daniel Cheng <dcheng@chromium.org>
Commit-Queue: Peter Boström <pbos@chromium.org>
Cr-Commit-Position: refs/heads/main@{#923194}
2021-09-21 02:28:43 +00:00
Arthur Sonzogni
8ce6932024 Stop using --ignore-certificate-errors in test [14/N]
'--ignore-certificate-errors' is bad, because its behavior is not
plumbed correctly everywhere. As a result, its behavior is different
from using a real SSL certificate.

For tests that need to use multiple distinct sites (and not
just different origins), using either MockCertVerifier or
the net::EmbeddedTestServer::CERT_TEST_NAMES can allow multiple
distinct sites to talk to the test server.

Currently folks, are copy-pasting existing tests with
"ignore-certificate-errors". It would be lovely to update existing test
so that folks can start copy-pasting the "good" way instead.

This patch updates:
keyboard_lock_browsertest.cc

Bug: 1236525, 1124775
Change-Id: I3117219d44b7132a9c5c48628b88096399e4a47f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3074882
Auto-Submit: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: Ryan Sleevi <rsleevi@chromium.org>
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#909274}
2021-08-06 13:39:42 +00:00
Avi Drissman
c91bd8ea79 Migrate to ExecJs/EvalJs in content/
Bug: 1157718
Change-Id: Ibb5bdb3f994630cc2b84f4e60adaf307fe646cb3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2826401
Auto-Submit: Avi Drissman <avi@chromium.org>
Commit-Queue: John Abd-El-Malek <jam@chromium.org>
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Cr-Commit-Position: refs/heads/master@{#874039}
2021-04-19 23:58:44 +00:00
George Burgess IV
08c4fd64e3 fix instances of bugprone-argument-comment
This new clang-tidy check complains when param names /*in_comments=*/
don't match up with the actual parameter name they're being passed to.
Sometimes this is benign, other times, actual bugs are found.

Bug: 1136209
Change-Id: I9802951e5f8d4d77d0c0ae2a3f69134f93b548df
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2459427
Reviewed-by: Bo <boliu@chromium.org>
Commit-Queue: George Burgess <gbiv@chromium.org>
Cr-Commit-Position: refs/heads/master@{#815685}
2020-10-09 17:46:56 +00:00
Avi Drissman
97aef04552 Clean up duplicate WebContents "is fullscreen" functions
WebContents has both IsFullscreenForCurrentTab() and IsFullscreen().
It really only needs one. Consolidate them both into IsFullscreen().

Bug: 1100727
Change-Id: I3c578653089979b8dee9045f0d6b441cda975ed2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2275148
Auto-Submit: Avi Drissman <avi@chromium.org>
Reviewed-by: Leonard Grey <lgrey@chromium.org>
Commit-Queue: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#784135}
2020-06-30 21:04:48 +00:00
Mike Wasserman
4ca0979e93 Window Placement: Gate cross-screen fullscreen behavior on permission
Check for permission on cross-screen fullscreen requests.
Do not prompt users, fall back to the current screen on failure.

Plumb the requesting RenderFrameHost into FullscreenController.
(needed to make the appropriate origin-specific permission check)
Remove the redundant WebContents args; rely on RenderFrameHost.

Bug: 1080690
Change-Id: I8ec80e8b1f1f64ad2de1f936f4656d41a6e8e9d7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2203268
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Reviewed-by: Balazs Engedy <engedy@chromium.org>
Commit-Queue: Michael Wasserman <msw@chromium.org>
Cr-Commit-Position: refs/heads/master@{#773250}
2020-05-29 17:44:43 +00:00
Peter Kasting
919ce657e4 Add missing #includes of browser_test.h.
This is a step towards doing full IWYU of browser_test.h, which will
have other benefits.

Completely mechanical and already R+ed as part of r765923.

Tbr: sky
Bug: none
Change-Id: Icb7ab728098a6cf29c0920da4b524e96a7c024c2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2186411
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Reviewed-by: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#766361}
2020-05-07 10:22:36 +00:00
Balazs Engedy
683d2c7a8f Revert "IWYU for browser_test.h."
This reverts commit 66a53c909a.

Reason for revert: Breaks compile on official branded builders.

Original change's description:
> IWYU for browser_test.h.
> 
> Include this directly in relevant test files.  This lets us convert the
> HAS_OUT_OF_PROC_TEST_RUNNER checks in this file and
> view_event_test_base.h into #errors, and force people to not even
> include this file in files that can't use it.
> 
> Bug: none
> Tbr: sky
> Change-Id: I86626099eb047eb53e8b3611de38ba6bebc01a0b
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2136117
> Commit-Queue: Peter Kasting <pkasting@chromium.org>
> Reviewed-by: Scott Violet <sky@chromium.org>
> Reviewed-by: Lei Zhang <thestig@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#765923}

TBR=sky@chromium.org,pkasting@chromium.org,thestig@chromium.org

Change-Id: I4583916602404c310a93f571dd2c78645c6bd567
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: none
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2184132
Reviewed-by: Balazs Engedy <engedy@chromium.org>
Commit-Queue: Balazs Engedy <engedy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#765931}
2020-05-06 10:36:40 +00:00
Peter Kasting
66a53c909a IWYU for browser_test.h.
Include this directly in relevant test files.  This lets us convert the
HAS_OUT_OF_PROC_TEST_RUNNER checks in this file and
view_event_test_base.h into #errors, and force people to not even
include this file in files that can't use it.

Bug: none
Tbr: sky
Change-Id: I86626099eb047eb53e8b3611de38ba6bebc01a0b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2136117
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Reviewed-by: Scott Violet <sky@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#765923}
2020-05-06 09:38:56 +00:00
W. James MacLean
13d834d963 Remove WebContentsViewGuest & RenderWidgetHostViewGuest.
This CL removes more dead BrowserPlugin infrastructure.

Specifically, it remove WebContentsViewGuest, and
RenderWidgetHostViewGuest. It also removes the "guest_view_hack" which
has been in RenderWidgetHostViewMac/Aura since the inception of
BrowserPlugin.

Bug: 533069
Change-Id: Ie6d28ca981d612d3f7bf8f180c615f78d53b7e26
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1943097
Commit-Queue: James MacLean <wjmaclean@chromium.org>
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#721497}
2019-12-04 16:06:45 +00:00
Dave Tapuska
a418951d0e Define a blink side frame_host interface and move Fullscreen to it.
As outlined in design sketches
https://docs.google.com/document/d/1ChpbGA1M6aYxH9wqQYXQcvXZiVikeLI3JJP-fkezKP8/edit
and
https://docs.google.com/document/d/1QO99UstlPTY8eK4Lnc9qcNq3wQYTBDBsRZu6nGC4XG4/edit

introduce a FrameHost interface in blink so that blink can talk directly
to the RenderFrameHostImpl and not go through a public blink API.  ie.
the API becomes a mojo interface.

BUG=1008432

Change-Id: I98ef40c08b93f4a1fbc2e3ecad92a88bbbdcfc59
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1826988
Reviewed-by: Daniel Nicoara <dnicoara@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Reviewed-by: Bo <boliu@chromium.org>
Reviewed-by: Istiaque Ahmed <lazyboy@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: danakj <danakj@chromium.org>
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Cr-Commit-Position: refs/heads/master@{#706117}
2019-10-15 20:27:34 +00:00
Sergio Villar Senin
fa7fdde8cf Remove t/b/p/w/web_fullscreen_options.h dependency from chrome/browser
In order to remove the dependency, the web_fullscreen_options.h file was moved
to third_party/blink/public/common/fullscreen. Since the file is no longer in
the public/web/ directory we are also renaming it to fullscreen_options.h (and
the struct defined in it to FullscreeOptions).

Bug: 1008303
Change-Id: If96a8263b3bb696931ce9af4846f3d6dcbc40698
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1852288
Reviewed-by: Ted Choc <tedchoc@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Commit-Queue: Sergio Villar <svillar@igalia.com>
Cr-Commit-Position: refs/heads/master@{#705577}
2019-10-14 16:58:51 +00:00
Lucas Furukawa Gadani
4909f3c5be Remove const interfaces from content/public API.
Bug: 908139
Tbr: boliu@chromium.org, bengr@chromium.org, seantopping@chromium.org, lazyboy@chromium.org, scottmg@chromium.org
Change-Id: I24a403afe5d7b5f5a58e4ac6f8d3d82eb23f2611
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1661149
Commit-Queue: Lucas Gadani <lfg@chromium.org>
Reviewed-by: Scott Graham <scottmg@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Johannes Henkel <johannes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#670246}
2019-06-18 22:36:52 +00:00
Scott Violet
9e1d0ab4a4 content: remove remaining window-service references from content
BUG=958121
TEST=covered by tests

Change-Id: Ibfe6adc213d9d9c46a9fe3b250a4f6c296a8728a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1598329
Reviewed-by: Xiyuan Xia <xiyuan@chromium.org>
Commit-Queue: Scott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#657260}
2019-05-07 15:36:10 +00:00
Lucas Furukawa Gadani
95fc3616b2 Remove const interfaces from RenderViewHost, RenderWidgetHost and
RenderWidgetHostView.

Bug: 908139
Change-Id: Ie9254f2688e01ba20ec55f665d276bf90ce9fe65
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1464648
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Commit-Queue: Lucas Gadani <lfg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#648383}
2019-04-05 22:33:49 +00:00
arthursonzogni
a2fe90f05e RenderDocument: Update tests KeyboardLockBrowserTest
With RenderDocument:
https://docs.google.com/document/d/1C2VKkFRSc0kdmqjKan1G4NlNlxWZqE4Wam41FNMgnmA/edit#
a new RenderFrameHost is used after every navigations, not only the
cross-process ones, but also the same-process ones.

This CL updates tests so that they don't assume the RenderFrameHost to
be preserved.

Bug: 936696
Change-Id: I222e6a76cb9d16b68cb4802a09bc41ebd9d1bd9c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1538295
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#645280}
2019-03-28 13:39:43 +00:00
Alan Cutter
fb5689198a Dedupe "content/test/data" strings in content browsertests
This CL updates content browsertests to use the existing GetTestDataFilePath()
instead of hard coding "content/test/data" many times.

Bug: 946403
Change-Id: Ia90dbbdcd269cccd278de80bbf85ab3326fe1463
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1541546
Auto-Submit: Alan Cutter <alancutter@chromium.org>
Commit-Queue: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#645218}
2019-03-28 08:39:19 +00:00
Elly Fong-Jones
bb30abf237 flags: clean up keyboard lock flags
This change removes:
  keyboard-lock-api
and assigns:
  system-keyboard-lock
and removes backing features & tests for the former.

Bug: None
Change-Id: I4fe8fa3aeef65e2996e0091d557182af9fa6e565
Reviewed-on: https://chromium-review.googlesource.com/c/1477790
Reviewed-by: Joe Downing <joedow@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Commit-Queue: Avi Drissman <avi@chromium.org>
Auto-Submit: Elly Fong-Jones <ellyjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#633332}
2019-02-19 19:02:56 +00:00
Kent Tamura
21d1de6269 Remove "layouttest" or "layout test" in //content
They are renamed to "webtest" or "web test".
This CL has no behavior changes.

TBR=caitkp@chromium.org, mkwst@chromium.org

Bug: 843412
Change-Id: Ifdd22e1bfd10e727e17c2035b3faf1ae4fec1400
Reviewed-on: https://chromium-review.googlesource.com/c/1367391
Commit-Queue: Kent Tamura <tkent@chromium.org>
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Cr-Commit-Position: refs/heads/master@{#615044}
2018-12-10 04:45:20 +00:00
Joe Downing
7e79d96078 [KeyboardLock] Updating behavior for invalid key_codes param
Per discussion with API owner, we want the behavior for invalid
params to be a bit stricter.  Prior to this change, if someone
called the API with at least one valid DomString, then we would
allow lock to be set.  This made sense when we were translating
the key_codes param into native key codes (where we couldn't
determine the difference between 'invalid for this platform' and
'invalid key for all platforms'.  Now that we use DomCodes, we
can do better validation.

The second change is to cancel any current keyboard lock requests
if the API is called with invalid params.  The scenario here
involves lock() being called correctly (request is registered) and
then a second lock call being made w/ invalid params.  Since we
reject the promise in this case, it didn't make sense to keep the
lock request since the intention by the caller was to override the
initial call.  In practice, we don't think this will occur often
but it is a case we wanted to handle better.

BUG=680809

Change-Id: I0ca54cca262761133739ab1d43f22e219792ca7c
Reviewed-on: https://chromium-review.googlesource.com/1099762
Commit-Queue: Joe Downing <joedow@chromium.org>
Reviewed-by: Gary Kacmarcik <garykac@chromium.org>
Reviewed-by: Scott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#567800}
2018-06-15 21:34:27 +00:00
Devlin Cronin
513398fcc1 [Cleanup] Update histogram_tester.h includes in //content
Update all histogram_tester.h includes in //content to include
//base/test/metrics/histogram_tester.h

TBR=creis@chromium.org

Bug: 846421
Change-Id: Id1f2d111e1b71e32ca795a7953af63fb62ad2acd
Reviewed-on: https://chromium-review.googlesource.com/1086269
Reviewed-by: Devlin <rdevlin.cronin@chromium.org>
Commit-Queue: Devlin <rdevlin.cronin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#564514}
2018-06-05 15:33:49 +00:00
Joe Downing
a7235f9749 [KeyboardLock] Adding Chrome UX Browsertests
These tests are similar to the tests in the content layer, however
these test exercise Chrome E2E instead of using stubs.

BUG=680809

Change-Id: I371d1cdec025517634e62b7ee4cde674c480307c
Reviewed-on: https://chromium-review.googlesource.com/1068122
Commit-Queue: Joe Downing <joedow@chromium.org>
Reviewed-by: Scott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#563038}
2018-05-30 22:40:52 +00:00
Joe Downing
bddd12fc01 [KeyboardLock] KLSI should return an error if lock request fails
Previously the KeyboardLockServiceImpl would silently fail if the
keyboard lock request failed in some cases (we returned an error
for some scenarios but not all).

This change will ensure that if the keyboard.lock() promise succeeds,
the request was registered successfully.

BUG=680809

Change-Id: I65228603592a871173e6df4a1c265b14fc6a6d8f
Reviewed-on: https://chromium-review.googlesource.com/1066699
Commit-Queue: Joe Downing <joedow@chromium.org>
Reviewed-by: Gary Kacmarcik <garykac@chromium.org>
Reviewed-by: Scott Violet <sky@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#560726}
2018-05-22 19:22:16 +00:00
Joe Downing
386ea32692 [KeyboardLock] Enable keyboard-lock API by default
We've received 3 LGTMs for our blink I2S so I'm enabling the API:
https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/isXS3f3Tqo8

I am marking the API as 'stable' for M68 and will remove the runtime flag
after the next branch point.

BUG=680809

Change-Id: If805053651d5ffb3d9963bf176faf9c67dfa5e40
Reviewed-on: https://chromium-review.googlesource.com/1054329
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Reviewed-by: Philip Jägenstedt <foolip@chromium.org>
Reviewed-by: Gary Kacmarcik <garykac@chromium.org>
Commit-Queue: Joe Downing <joedow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#558336}
2018-05-14 16:46:22 +00:00
Joe Downing
c1a57efe00 [KeyboardLock] Implementing Content BrowserTest TODOs
This CL implements tests for a couple of TODOs that arose during the
initial code review for my content layer changes for this feature.

During implementation I found an issue where we weren't clearing
KeyboardLock during navigation, that now works correctly.

A big portion of this change involves codifying the behavior between
iframes and the KeyboardLock feature.  I haven't written many of
these tests before so I'd like to make sure that the tests I have
are set up correctly, testing what I think they are testing, and
the behavior I have codified is reasonable.

BUG=680809

Change-Id: Ief1fbfef48d396f4df72319bb5bb61120033eada
Reviewed-on: https://chromium-review.googlesource.com/1041137
Reviewed-by: Alex Moshchuk <alexmos@chromium.org>
Commit-Queue: Joe Downing <joedow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#557249}
2018-05-09 18:23:54 +00:00
Joe Downing
4d96f54992 [KeyboardLock] Enable BrowserTests for all platforms
Now that all desktop platforms have a browser-level implementation
for keyboard lock, it is time to remove the platform restriction
for the keyboard lock BrowserTests.

BUG=680809

Change-Id: Iad4ddea988069a73dd6cb31683a3a2086c753c47
Reviewed-on: https://chromium-review.googlesource.com/1042542
Reviewed-by: Scott Violet <sky@chromium.org>
Commit-Queue: Joe Downing <joedow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#555880}
2018-05-03 21:28:29 +00:00
Dave Tapuska
3ed44192c5 Add plumbing necessary to pass FullscreenOptions around.
Created a java side mirror object to the class that can be parceled
into an intent so that it works with the FullscreenActivity code.

Change TabObserver from onToggleFullscreenMode to
onEnterFullscreenMode/onExitFullscreenMode so that we could pass the
FullscreenOptions around.

This change does not have any behavior changes as of yet it is just
plumbing passing options around.

BUG=829937

Change-Id: I8599df0e155de78704d70dd22f886cd94f68d6ff
Reviewed-on: https://chromium-review.googlesource.com/1030837
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: Bo <boliu@chromium.org>
Reviewed-by: Reilly Grant <reillyg@chromium.org>
Reviewed-by: Rick Byers <rbyers@chromium.org>
Reviewed-by: Ted Choc <tedchoc@chromium.org>
Commit-Queue: Dave Tapuska <dtapuska@chromium.org>
Cr-Commit-Position: refs/heads/master@{#555125}
2018-05-01 18:53:30 +00:00
Joe Downing
190f4ac229 [KeyboardLock] MacOS RWHV integration
This change includes the integration of the MacOS KeyboardHook impl in
the RenderWidgetHostViewMac and RenderWidgetHostViewCocoa classes.

RWHVMac handles the lock/unlock calls from RenderWidgetHostImpl and
forwards them to RWHVCocoa which handles the events and input routing.

The RenderWidgetHostViewMac and RenderWidgetHostViewCocoa integration
follows the same pattern I used for RenderWidgetHostViewAura and
RenderWidgetHostViewEventHandler. The main difference between this impl
and the Aura impl is that there is a bridge class between RWHVMac and
RWHVCocoa (RenderWidgetHostViewNsBridgeView).

BUG=680809

Change-Id: I524c98c059ae4883bf597704c326b5a0055f1212
Reviewed-on: https://chromium-review.googlesource.com/989618
Reviewed-by: ccameron <ccameron@chromium.org>
Reviewed-by: Nick Carter <nick@chromium.org>
Commit-Queue: Joe Downing <joedow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#551491}
2018-04-17 22:00:27 +00:00
Joe Downing
f95205324e [KeyboardLock] Updating Mojo service impl to return error codes
The previous KeyboardLockService implementation always returned success
even when no KeyboardLock request was registered due to an error.  This
CL adds errors for two known error conditions which are now communicated
back to javascript by rejecting the promise.  The messages passed are
meant to help developers as they are building their website, they are not
something that can/should be used post-development (i.e. they represent
unrecoverable errors).

BUG=680809

Change-Id: I7748d0f0c7b8688b4e945e6aa349d75b2a9757ca
Reviewed-on: https://chromium-review.googlesource.com/1003216
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Scott Violet <sky@chromium.org>
Reviewed-by: Gary Kacmarcik <garykac@chromium.org>
Commit-Queue: Joe Downing <joedow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#549716}
2018-04-11 01:28:52 +00:00
Joe Downing
13dd76bc86 [KeyboardLock] Chrome UX layer integration for fullscreen management
This CL integrates the KeyboardLock feature into the Chrome UX layer.
Integrating in the ExclusiveAccessManager allows fine grained control
over when KeyboardLock is activated (for instance we want keyboard lock
activated in tab-initiated fullscreen, but not in browser or content
fullscreen.  The FullscreenController provides that nuanced level of
control for us.

Also, Keyboardlock should only be available to one
tab at a time which is conceptually the same as Fullscreen and
PointerLock.

Lastly, we need to integrate KeyboardLock logic into
the mechanism used for exiting fullscreen and displaying the exit
fullscreen instructions/bubble.  Future CLs will add an animated
exit UX which is tied to the press and hold gesture, and a rapid
tap 'panic' timer which will reshow the exit instructions (these
two behaviors were suggested as part of the UX design process).

I have some initial browsertests for this feature however I have
not added interactive browsertests yet as I would like to get
feedback on the implementation before adding additional tests.
I will add those in a follow-up CL if this impl looks good.

BUG=680809

Change-Id: I6588367875934b59ba979cef65a73707c3d85320
Reviewed-on: https://chromium-review.googlesource.com/989021
Reviewed-by: Dominick Ng <dominickn@chromium.org>
Reviewed-by: Yuri Wiitala <miu@chromium.org>
Reviewed-by: Scott Violet <sky@chromium.org>
Reviewed-by: Ilya Sherman <isherman@chromium.org>
Reviewed-by: Nick Carter <nick@chromium.org>
Commit-Queue: Joe Downing <joedow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#549230}
2018-04-09 18:32:15 +00:00
Joe Downing
192998b233 [KeyboardLock] Content layer integration
This change completes the KeybaoardLockServiceImpl class and hooks it
into the RenderWidgetHostImpl class.

RenderWidgetHostImpl is responsible for tracking the keys requested
to be locked, forwarding the request to WebContentsImpl, handling
the response from WebContentsImpl once the UX is fullscreen, and
then calling into the RenderWidgetHostView impl to actually request
KeyboardLock.

WebContentsImpl tracks the RenderWidgetHostImpl instance which has an
active KeyboardLock request.  It also calls back into that instance
once tab-initiated fullscreen is entered/exited.  Note that there are
two other approaches I could have taken here: I could have used a
WebContentsObserver class or I could have pushed this logic up
into the chrome layer (ExclusiveAccessManager related class).  I
chose the current approach as the logic needed for calling down to
the RenderWidgetHostImpl class is simple and only needed in a few
places.

RenderWidgetHostView is the class which will handle platform
specialization for the KeyboardLock request.  I've implemented this
logic for Aura in this CL, macOS will be completed in a follow-up.

My next CL will integrate KeyboardLock into the chrome layer and
implement ESC key handling and UX string display.  Also to be added
are some browser tests for this functionality.  These will be
required before we enable this functionality by default.

BUG=680809

Change-Id: I703d1ba27592943fff80432303583499d789a2ec
Reviewed-on: https://chromium-review.googlesource.com/939535
Commit-Queue: Joe Downing <joedow@chromium.org>
Reviewed-by: Nick Carter <nick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#545096}
2018-03-22 15:51:36 +00:00