Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / test / data / webui / chrome_send_browsertest.js
blob582e30ed0429cd2bc1e29b4951fe35d21764579d
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 /**
6 * @fileoverview Tests to ensure that chrome.send mocking works as expected.
7 * @author scr@chromium.org (Sheridan Rawlins)
8 * @see test_api.js
9 */
11 GEN('#include "chrome/test/data/webui/chrome_send_browsertest.h"');
13 /**
14 * Test fixture for chrome send WebUI testing.
15 * @constructor
16 * @extends {testing.Test}
18 function ChromeSendWebUITest() {}
20 ChromeSendWebUITest.prototype = {
21 __proto__: testing.Test.prototype,
23 /**
24 * Generate a real C++ class; don't typedef.
25 * @type {?string}
26 * @override
28 typedefCppFixture: null,
30 /** @inheritDoc */
31 browsePreload: DUMMY_URL,
33 /** @inheritDoc */
34 setUp: function() {
35 this.makeAndRegisterMockHandler(['checkSend']);
39 // Test that chrome.send can be mocked outside the preLoad method.
40 TEST_F('ChromeSendWebUITest', 'NotInPreload', function() {
41 this.mockHandler.expects(once()).checkSend();
42 chrome.send('checkSend');
43 });
45 /**
46 * Test fixture for chrome send WebUI testing with passthrough.
47 * @constructor
48 * @extends {ChromeSendWebUITest}
50 function ChromeSendPassthroughWebUITest() {}
52 ChromeSendPassthroughWebUITest.prototype = {
53 __proto__: ChromeSendWebUITest.prototype,
56 // Test that the mocked chrome.send can call the original.
57 TEST_F('ChromeSendPassthroughWebUITest', 'CanCallOriginal', function() {
58 this.mockHandler.expects(once()).checkSend().
59 will(callFunction(function() {
60 chrome.originalSend('checkSend');
61 }));
62 chrome.send('checkSend');
63 });