Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Issue 320753002: Support javascript gtests in an extension background page. (Closed)

Created:
6 years, 6 months ago by David Tseng
Modified:
6 years, 6 months ago
CC:
chromium-reviews, oshima+watch_chromium.org, plundblad+watch_chromium.org, aboxhall+watch_chromium.org, arv+watch_chromium.org, yuzo+watch_chromium.org, dmazzoni+watch_chromium.org, dtseng+watch_chromium.org, stevenjb+watch_chromium.org, davemoore+watch_chromium.org, nkostylev+watch_chromium.org
Visibility:
Public.

Description

Support javascript gtests in an extension background page. - abstracts away the minimal amount of logic and data from WebUIBrowserTest to form JavaScriptBrowserTest. - JavaScriptBrowserTest knows how to manage js libraries, build runnable javascript, setup paths. - subclasses of JavaScriptBrowserTest are still responsible for js injection and listening to test result IPC's. - adds a subclass that knows how to inject test assets into an extension and relay pass/fail from the extension's background page as well as run tests in that context. (ExtensionJSBrowserTest). - ExtensionJSBrowserTest uses DOMAutomation's IPC's (which are available in an extension context); chrome.send is not. - adds ExtensionLoadWaiter as a helper class to load and wait for an extension. - eventually, should unify the way in which subclasses communicate to their test js resources: -- js-end bindings (chrome.send vs window.domAutomation.send) -- IPC messaging (WebUI specific handler system vs dom automation messages). -- clean up the hand rolled js string "building". -- make the subclass provide a getter to the WebContents that hosts its js under test. These items are not within the scope of this cl. - obtains friendly error messages from the extension's context while running tests via a json object passed back to the runner ExtensionJSBrowserTest; failures are printed in gtest. Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=277249

Patch Set 1 #

Patch Set 2 : WS #

Total comments: 42

Patch Set 3 : Address comments; rework a fair amount. #

Patch Set 4 : Fixup comment #

Total comments: 86

Patch Set 5 : Various improvements; address nits. #

Patch Set 6 : More improvements #

Patch Set 7 : add maybeGenHeader in call to GEN. #

Patch Set 8 : Update comment. #

Patch Set 9 : Lint #

Patch Set 10 : lint #

Total comments: 4

Patch Set 11 : EXPECT_TRUE and TODO. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+514 lines, -185 lines) Patch
M chrome/browser/resources/chromeos/chromevox/chromevox_tests.gypi View 1 2 3 4 5 2 chunks +42 lines, -0 lines 0 comments Download
A chrome/browser/resources/chromeos/chromevox2/cvox2/background/background.extjs View 1 2 3 4 5 1 chunk +54 lines, -0 lines 0 comments Download
M chrome/chrome_tests.gypi View 1 2 1 chunk +2 lines, -0 lines 0 comments Download
A chrome/test/base/extension_js_browser_test.h View 1 2 3 4 5 1 chunk +39 lines, -0 lines 0 comments Download
A chrome/test/base/extension_js_browser_test.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +61 lines, -0 lines 0 comments Download
A chrome/test/base/javascript_browser_test.h View 1 2 3 4 1 chunk +58 lines, -0 lines 0 comments Download
A chrome/test/base/javascript_browser_test.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +123 lines, -0 lines 0 comments Download
M chrome/test/base/js2gtest.js View 1 2 3 4 5 6 7 5 chunks +84 lines, -28 lines 0 comments Download
M chrome/test/base/web_ui_browser_test.h View 1 2 7 chunks +5 lines, -32 lines 0 comments Download
M chrome/test/base/web_ui_browser_test.cc View 1 2 3 4 5 15 chunks +32 lines, -124 lines 0 comments Download
M chrome/test/data/webui/test_api.js View 1 2 2 chunks +14 lines, -1 line 0 comments Download

Messages

Total messages: 18 (0 generated)
David Tseng
Took a long time to figure out this one, but it cleaned up to be ...
6 years, 6 months ago (2014-06-08 21:55:20 UTC) #1
Peter Lundblad
Hi, Exciting step in the right direction I think. I am wondering if we shoud ...
6 years, 6 months ago (2014-06-08 23:27:22 UTC) #2
David Tseng
On Sun, Jun 8, 2014 at 4:27 PM, <plundblad@chromium.org> wrote: > Hi, > > Exciting ...
6 years, 6 months ago (2014-06-09 01:27:04 UTC) #3
dmazzoni
Love it. This seems like a great first step at abstracting the webui code and ...
6 years, 6 months ago (2014-06-09 06:59:46 UTC) #4
David Tseng
PTAL; abstracted the extensiony test into a proper class and pushed down the ChromeVox specifics ...
6 years, 6 months ago (2014-06-10 05:35:22 UTC) #5
dmazzoni
lgtm https://codereview.chromium.org/320753002/diff/60001/chrome/test/base/extension_load_waiter.cc File chrome/test/base/extension_load_waiter.cc (right): https://codereview.chromium.org/320753002/diff/60001/chrome/test/base/extension_load_waiter.cc#newcode48 chrome/test/base/extension_load_waiter.cc:48: void ExtensionLoadWaiter::Reset() { Nit: blank line before https://codereview.chromium.org/320753002/diff/60001/chrome/test/base/extension_load_waiter.h ...
6 years, 6 months ago (2014-06-10 16:06:16 UTC) #6
David Tseng
+ phajdan.jr for chrome/test I've slightly changed the way WaitFor works; it now takes a ...
6 years, 6 months ago (2014-06-10 20:14:25 UTC) #7
Peter Lundblad
https://codereview.chromium.org/320753002/diff/60001/chrome/browser/resources/chromeos/chromevox/chromevox_tests.gypi File chrome/browser/resources/chromeos/chromevox/chromevox_tests.gypi (right): https://codereview.chromium.org/320753002/diff/60001/chrome/browser/resources/chromeos/chromevox/chromevox_tests.gypi#newcode97 chrome/browser/resources/chromeos/chromevox/chromevox_tests.gypi:97: '--deps_js', '<(chromevox_test_deps_js_file)', Need to remove deps file here as ...
6 years, 6 months ago (2014-06-11 16:45:08 UTC) #8
David Tseng
https://codereview.chromium.org/320753002/diff/60001/chrome/browser/resources/chromeos/chromevox/chromevox_tests.gypi File chrome/browser/resources/chromeos/chromevox/chromevox_tests.gypi (right): https://codereview.chromium.org/320753002/diff/60001/chrome/browser/resources/chromeos/chromevox/chromevox_tests.gypi#newcode97 chrome/browser/resources/chromeos/chromevox/chromevox_tests.gypi:97: '--deps_js', '<(chromevox_test_deps_js_file)', On 2014/06/11 16:45:04, Peter Lundblad wrote: > ...
6 years, 6 months ago (2014-06-11 17:52:55 UTC) #9
chromium-reviews
dtseng@chromium.org writes: > https://codereview.chromium.org/320753002/diff/60001/chrome/test/base/extension_load_waiter.h#newcode22 > chrome/test/base/extension_load_waiter.h:22: // Waits for extension with > |extension_id| to load. ...
6 years, 6 months ago (2014-06-11 18:44:52 UTC) #10
David Tseng
Good point. Placed maybeGenHeader inside of GEN as well. Unfortunate, but necessary it seems. On ...
6 years, 6 months ago (2014-06-11 19:11:53 UTC) #11
David Tseng
Btw, ping @phajdan.jr, I thik you're still the most appropriate owner. On Wed, Jun 11, ...
6 years, 6 months ago (2014-06-11 19:41:20 UTC) #12
Peter Lundblad
lgtm
6 years, 6 months ago (2014-06-11 21:48:18 UTC) #13
Paweł Hajdan Jr.
LGTM with comments https://codereview.chromium.org/320753002/diff/180001/chrome/test/base/extension_js_browser_test.cc File chrome/test/base/extension_js_browser_test.cc (right): https://codereview.chromium.org/320753002/diff/180001/chrome/test/base/extension_js_browser_test.cc#newcode26 chrome/test/base/extension_js_browser_test.cc:26: CHECK(load_waiter_->browser_context()); Please don't crash the entire ...
6 years, 6 months ago (2014-06-13 13:45:23 UTC) #14
David Tseng
The CQ bit was checked by dtseng@chromium.org
6 years, 6 months ago (2014-06-13 23:15:34 UTC) #15
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/dtseng@chromium.org/320753002/200001
6 years, 6 months ago (2014-06-13 23:17:26 UTC) #16
David Tseng
https://codereview.chromium.org/320753002/diff/180001/chrome/test/base/extension_js_browser_test.cc File chrome/test/base/extension_js_browser_test.cc (right): https://codereview.chromium.org/320753002/diff/180001/chrome/test/base/extension_js_browser_test.cc#newcode26 chrome/test/base/extension_js_browser_test.cc:26: CHECK(load_waiter_->browser_context()); On 2014/06/13 13:45:23, Paweł Hajdan Jr. wrote: > ...
6 years, 6 months ago (2014-06-13 23:23:38 UTC) #17
commit-bot: I haz the power
6 years, 6 months ago (2014-06-14 19:40:28 UTC) #18
Message was sent while issue was closed.
Change committed as 277249

Powered by Google App Engine
This is Rietveld 408576698