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

Unified Diff: remoting/webapp/js_proto/sinon_stub_proto.js

Issue 959963002: [Chromoting] Enable jscompile for webapp unittests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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: remoting/webapp/js_proto/sinon_stub_proto.js
diff --git a/remoting/webapp/js_proto/sinon_stub_proto.js b/remoting/webapp/js_proto/sinon_stub_proto.js
new file mode 100644
index 0000000000000000000000000000000000000000..6a49fff1321cf4c19f74e09ab5eb575ccde74f77
--- /dev/null
+++ b/remoting/webapp/js_proto/sinon_stub_proto.js
@@ -0,0 +1,33 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// How to create sinon.stubs that work with jscompile.
+//
+// To create the stub:
+// sinon.$setupStub(<object>, <function-name>)
+//
+// To access the stub in unittests:
+// <object>.<function-name>.$testStub.<sinon-test>
+//
+// For example:
+// sinon.$setupStub(chrome.socket, 'create');
+// chrome.socket.create.$testStub.restore();
+//
+// For jscompile to analyze these corectly, you'll also need to add an entry
+// in this file for Chrome object you stub out this way. For example:
kelvinp 2015/02/26 00:31:30 s/Chrome/any
garykac 2015/02/28 02:33:33 Done.
+// chrome.socket.create.$testStub = new sinon.$testStub();
+
+base.debug.assert.$testStub = new sinon.$testStub();
+base.isAppsV2.$testStub = new sinon.$testStub();
+
+chrome.i18n.getMessage.$testStub = new sinon.$testStub();
+
+chrome.socket.connect.$testStub = new sinon.$testStub();
+chrome.socket.create.$testStub = new sinon.$testStub();
+chrome.socket.destroy.$testStub = new sinon.$testStub();
+chrome.socket.read.$testStub = new sinon.$testStub();
+chrome.socket.secure.$testStub = new sinon.$testStub();
+chrome.socket.write.$testStub = new sinon.$testStub();
+
+remoting.xhr.get.$testStub = new sinon.$testStub();

Powered by Google App Engine
This is Rietveld 408576698