Snippets have an interesting relationship with UISourceCode. Snippets
are loaded and stored in a "filesystem" project, and have, as such, a
corresponding UISourceCode. When snippets are evaluated however,
DevTools treats them as "normal" page scripts and creates a second
UISourceCode in the "network" project of the main target.
The AutoMapping class is aware of the two snippet UISourceCodes and
connects them together the same way we handle workspaces (where
developers can add a local directory and have it mapped to a pages
resources).
When this mapping happens, the UISourceCodeFrame that displays the
snippet switches modes. UISourceCodeFrame has two modes: It can display
a single UISourceCode, or it can display such a filesystem <-> network
mapped pair of UISourceCodes (aka PersistenceBinding). The bug which
this CL fixes occurs during this switch.
Each UISourceCode has a list of messages attached that serve as the
basis for decorations in the editor. Previously, when the switch from
single UISourceCode to PersistenceBinding happened,
the UISourceCodeFrame would ignore the messages stored on the
newly bound network UISourceCode. It would keep showing the messages
from the filesystem UISourceCode. This CL fixes this by resetting
the rendered decorations to the union of both message sets.
Fixed: 1277403
Change-Id: Ibffb86afcbd1c6a5a5c629a6f9b3b2dff73ab9ed
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/3412774
Reviewed-by: Jaroslav Sevcik <jarin@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
This adds test cases for the 'Add selected text to watches' and
'Evaluate selected text in console' actions triggered via key shortcuts
in the sources panel code editor.
Also, the file 'context_menu_test.ts' is renamed to 'snippets_test.ts'
according to the tests implemented in there.
Bug: 1177004
Change-Id: I2adb0366c215cfd3f1fe9d099e3bee088381dded
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2809754
Commit-Queue: Andres Olivares <andoli@chromium.org>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Inconsistent URL escaping was breaking snippets, which by default
have characters (space and #) which need to be escaped.
As a general rule, anything called 'url' or 'path' is now url-encoded,
and anything called 'name' or 'platformPath' is not.
Bug: 1094436
Change-Id: I7a26e9f2bfa676d0cc1b4731ea939ebc12222a25
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2266998
Commit-Queue: Simon Zünd <szuend@chromium.org>
Reviewed-by: Simon Zünd <szuend@chromium.org>
Reviewed-by: Sigurd Schneider <sigurds@chromium.org>
The shared test runner logic was reimplementing parts of Mocha,
in particular the test logging and filtering. Moreover, it was
booting the hosted mode server and puppeteer outside of Mocha.
Mocha supports root level hooks [1]. These hooks allow us to
perform work before a test starts. Moreover, by using the
before and after hook, we can run logic before and after
all tests.
By using these hooks, we can extract the "boot the hosted mode
server and hookup puppeteer" part to these root hooks.
Additionally, we can reset the pages in the `beforeEach`, which
means that tests themselves don't have to reset the pages.
We also put the implementation code into third_party/conductor,
as we would like to reuse this logic for the Puppeteer tests.
The Puppeteer test suite now also uses Mocha and has very
similar requirements as to our DevTools tests. By extracting
from DevTools, we can look into expanding the test runner to
other usecases, but that is out of scope for now.
[1]: https://mochajs.org/#root-level-hooks
Bug: 1071369
Change-Id: Ie9f954359d9de84da564b74b6f5517dd535db008
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2150458
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
The runtime was throwing errors because `Snippets.SnippetsQuickOpen` did
not exist. The culprit is that the export statement still included a
`default class` rather than a `class`.
Also added an e2e-test that goes through the workflow of creating a
snippet and then verifying that the command menu shows these snippets
in its autocompletion.
R=aerotwist@chromium.org
Bug: 1060565
Change-Id: I9bb9d4ed34e5fda25cdd796a6a1e4c8a61f89958
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2107222
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Commit-Queue: Tim van der Lippe <tvanderlippe@chromium.org>