Index: chrome/third_party/mock4js/examples/PublisherTest.html |
diff --git a/chrome/third_party/mock4js/examples/PublisherTest.html b/chrome/third_party/mock4js/examples/PublisherTest.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..6bda220e5d402aa2c16be805b7e6809d4267c98d |
--- /dev/null |
+++ b/chrome/third_party/mock4js/examples/PublisherTest.html |
@@ -0,0 +1,47 @@ |
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" |
+"http://www.w3.org/TR/html4/loose.dtd"> |
+ |
+<html> |
+ <head> |
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
+ <title>Tests</title> |
+ <link rel="stylesheet" type="text/css" href="jsunit/css/jsUnitStyle.css"> |
+ <script language="JavaScript" type="text/javascript" src="../../jsunit/app/jsUnitCore.js"></script> |
+ <script language="JavaScript" type="text/javascript" src="..//mock4js.js"></script> |
+ <script language="JavaScript" type="text/javascript" src="Publisher.js"></script> |
+ <script language="JavaScript" type="text/javascript"> |
+ |
+ Mock4JS.addMockSupport(this); |
+ |
+ function setUp() { |
+ Mock4JS.clearMocksToVerify(); |
+ } |
+ |
+ function tearDown() { |
+ Mock4JS.verifyAllMocks(); |
+ } |
+ |
+ function testOneSubscriberReceivesAMessage() { |
+ // setup |
+ var mockSubscriber = mock(Subscriber); |
+ var publisher = new Publisher(); |
+ publisher.add(mockSubscriber.proxy()); |
+ |
+ var message = "message"; |
+ |
+ // expectations |
+ mockSubscriber.expects(once()).receive(message); |
+ |
+ // execute |
+ publisher.publish(message); |
+ } |
+ </script> |
+ </head> |
+ |
+ <body> |
+ <h1>JsUnit Tests</h1> |
+ |
+ <p>This page contains some JsUnit tests. To see them, take a look at the source.</p> |
+ </body> |
+</html> |
+ |