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

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

Issue 7250009: Added guts to pull call signatures when assertions & expectations fail. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Include constructed messages instead of just call signature. 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 unified diff | Download patch | Annotate | Revision Log
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 function WebUIAssertionsTest() {}
6
7 WebUIAssertionsTest.prototype = {
8 __proto__: testing.Test.prototype,
9 browsePreload: 'chrome://DummyURL',
10 typedefCppFixture: null,
11 };
12
13 GEN('#include "chrome/test/data//webui/assertions-inl.h"');
14
15 function testTwoExpects() {
16 expectTrue(false);
17 expectTrue(0);
18 }
19
20 TEST_F('WebUIAssertionsTest', 'testTwoExpects', function() {
21 var result = runTest(testTwoExpects, []);
22
23 expectFalse(result[0]);
24 expectTrue(!!result[1].match(/expectTrue\(false\): false/));
25 expectTrue(!!result[1].match(/expectTrue\(0\): 0/));
26 });
27
28 function twoExpects() {
29 expectTrue(false, 'message1');
30 expectTrue(false, 'message2');
31 }
32
33 function testCallTestTwice() {
34 twoExpects();
35 twoExpects();
36 }
37
38 TEST_F('WebUIAssertionsTest', 'testCallTestTwice', function() {
39 var result = runTest(testCallTestTwice, []);
40 expectFalse(result[0]);
41 expectEquals(2, result[1].match(
42 /expectTrue\(false, 'message1'\): message1: false/g).length);
43 expectEquals(2, result[1].match(
44 /expectTrue\(false, 'message2'\): message2: false/g).length);
45 });
46
47 function testConstructMessage() {
48 var message = 1 + ' ' + 2;
49 assertTrue(false, message);
50 }
51
52 TEST_F('WebUIAssertionsTest', 'testConstructedMessage', function() {
53 var result = runTest(testConstructMessage, []);
54 expectEquals(
55 1, result[1].match(/assertTrue\(false, message\): 1 2: false/g).length);
56 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698