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

Unified Diff: chrome/third_party/mock4js/examples/Publisher.js

Issue 7237030: Added options browser_tests using the generator and js handler framework. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: TestNavigationController in ui_test_utils, renamed LoadStart->JsInjectionReady, reordered methods. Created 9 years, 5 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: chrome/third_party/mock4js/examples/Publisher.js
diff --git a/chrome/third_party/mock4js/examples/Publisher.js b/chrome/third_party/mock4js/examples/Publisher.js
new file mode 100644
index 0000000000000000000000000000000000000000..7405a061be2ffe94973746ccb9fa6bcd3c27e64b
--- /dev/null
+++ b/chrome/third_party/mock4js/examples/Publisher.js
@@ -0,0 +1,29 @@
+/**
+ * Subscriber
+ */
+function Subscriber() {
+}
+
+Subscriber.prototype = {
+ receive: function(message) {
+ }
+}
+
+/**
+ * Publisher
+ */
+function Publisher() {
+ this._subscribers = [];
+}
+
+Publisher.prototype = {
+ publish: function(message) {
+ for(var i=0; i<this._subscribers.length; i++) {
+ var subscriber = this._subscribers[i];
+ subscriber.receive(message);
+ }
+ },
+ add: function(subscriber) {
+ this._subscribers.push(subscriber);
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698