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

Unified Diff: third_party/WebKit/LayoutTests/resources/mojo-helpers.js

Issue 1836203002: Change the battery-status layout tests to use JS mocks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cleanup in JS unload event Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/resources/mojo-helpers.js
diff --git a/third_party/WebKit/LayoutTests/resources/mojo-helpers.js b/third_party/WebKit/LayoutTests/resources/mojo-helpers.js
index db7a6264bf3d0f6219356e6ff2a3b89c06e6518f..7cc4668cdf4e812e74a9ace77ba1feb4e3a2d5e6 100644
--- a/third_party/WebKit/LayoutTests/resources/mojo-helpers.js
+++ b/third_party/WebKit/LayoutTests/resources/mojo-helpers.js
@@ -34,10 +34,13 @@ define('Mojo Helpers', [
'content/public/renderer/frame_service_registry',
'content/public/renderer/service_registry',
], (core, router, support, frameServiceRegistry, serviceRegistry) => {
- add_completion_callback(() => {
- frameServiceRegistry.clearServiceOverridesForTesting();
- serviceRegistry.clearServiceOverridesForTesting();
- });
+ let tearDown = () => {
+ frameServiceRegistry.clearServiceOverridesForTesting();
dcheng 2016/03/31 01:31:40 If a test forgot to call this, does this mean the
Sam McNally 2016/03/31 01:58:24 Yes, if they reuse the same frame and/or process.
+ serviceRegistry.clearServiceOverridesForTesting();
+ }
+ addEventListener('unload', tearDown);
+ if (window.add_completion_callback)
+ add_completion_callback(tearDown);
return {
core,

Powered by Google App Engine
This is Rietveld 408576698