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

Unified Diff: remoting/webapp/crd/js/remoting.js

Issue 771003002: Add support for deferring app initialization when testing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years 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: remoting/webapp/crd/js/remoting.js
diff --git a/remoting/webapp/crd/js/remoting.js b/remoting/webapp/crd/js/remoting.js
index c2bedd1ddff9465c9e59bc3bb261aa8c1a990fb5..1aede84d3fef67ab00ee3a35b9ad2509b301b348 100644
--- a/remoting/webapp/crd/js/remoting.js
+++ b/remoting/webapp/crd/js/remoting.js
@@ -47,6 +47,26 @@ function consentRequired_(authContinue) {
}
/**
+ * Entry point for test code. In order to make test and production code as
+ * similar as possible, the same entry point is used for production code,
+ * but since production code should never have 'source' set to 'about_page',
+ * it will continue with initialization immediately. As a fail-safe, the
+ * mechanism by which initialization completes when under test is controlled
+ * by a simple UI, making it possible to use the app even if the previous
+ * assumption fails to hold in some corner cases.
+ */
+remoting.initForTesting = function() {
garykac 2014/12/02 16:43:22 This belongs in (the newly created) crd_main.js.
+ var urlParams = getUrlParameters_();
+ if (urlParams['source'] === 'about_page') {
+ document.getElementById('browser-test-continue-init').addEventListener(
+ 'click', remoting.init, false);
+ document.getElementById('browser-test-deferred-init').hidden = false;
+ } else {
+ remoting.init();
+ }
+};
+
+/**
* Entry point for app initialization.
*/
remoting.init = function() {
« remoting/webapp/crd/js/event_handlers.js ('K') | « remoting/webapp/crd/js/event_handlers.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698