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

Side by Side Diff: chrome/test/data/webui/chrome_send_browsertest.js

Issue 8480027: Revert 109678 - WebUI test framework: fix Mock4JS verification, allow chrome.send passthrough. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | chrome/test/data/webui/chrome_send_browsertest-inl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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.
4
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 */
10
11 GEN('#include "chrome/test/data/webui/chrome_send_browsertest-inl.h"');
12
13 // Code that must be in a C++ file to pass clang rules.
14 GEN('ChromeSendWebUITest::ChromeSendWebUITest() {}');
15 GEN('ChromeSendWebUITest::~ChromeSendWebUITest() {}');
16 GEN('ChromeSendWebUITest::ChromeSendWebUIMessageHandler::');
17 GEN(' ChromeSendWebUIMessageHandler() {}');
18 GEN('ChromeSendWebUITest::ChromeSendWebUIMessageHandler::');
19 GEN(' ~ChromeSendWebUIMessageHandler() {}');
20 GEN('ChromeSendPassthroughWebUITest::ChromeSendPassthroughWebUITest() {}');
21 GEN('ChromeSendPassthroughWebUITest::~ChromeSendPassthroughWebUITest() {}');
22
23 /**
24 * Test fixture for chrome send WebUI testing.
25 * @constructor
26 * @extends {testing.Test}
27 */
28 function ChromeSendWebUITest() {}
29
30 ChromeSendWebUITest.prototype = {
31 __proto__: testing.Test.prototype,
32
33 /**
34 * Generate a real C++ class; don't typedef.
35 * @type {?string}
36 * @override
37 */
38 typedefCppFixture: null,
39
40 /** @inheritDoc */
41 browsePreload: DUMMY_URL,
42
43 /** @inheritDoc */
44 setUp: function() {
45 // Set up a mock handler class to catch the 'checkSend' message.
46 function MockHandler() {}
47 MockHandler.prototype = {
48 checkSend: function() {},
49 };
50 this.mockHandler = mock(MockHandler);
51 registerMockMessageCallbacks(this.mockHandler, MockHandler);
52 }
53 };
54
55 // Test that chrome.send can be mocked outside the preLoad method.
56 TEST_F('ChromeSendWebUITest', 'NotInPreload', function() {
57 this.mockHandler.expects(once()).checkSend();
58 chrome.send('checkSend');
59 });
60
61 /**
62 * Test fixture for chrome send WebUI testing with passthrough.
63 * @constructor
64 * @extends {ChromeSendWebUITest}
65 */
66 function ChromeSendPassthroughWebUITest() {}
67
68 ChromeSendPassthroughWebUITest.prototype = {
69 __proto__: ChromeSendWebUITest.prototype,
70 };
71
72 // Test that the mocked chrome.send can call the original.
73 TEST_F('ChromeSendPassthroughWebUITest', 'CanCallOriginal', function() {
74 chrome.send('expectCheckSend');
75 this.mockHandler.expects(once()).checkSend().
76 will(callFunction(function() {
77 chrome.originalSend('checkSend');
78 }));
79 chrome.send('checkSend');
80 });
OLDNEW
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | chrome/test/data/webui/chrome_send_browsertest-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698