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

Unified 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: clang 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
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | chrome/test/data/webui/assertions-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/webui/assertions.js
diff --git a/chrome/test/data/webui/assertions.js b/chrome/test/data/webui/assertions.js
new file mode 100644
index 0000000000000000000000000000000000000000..b7f62f5976b961dffc1794295bf8956cc40e398c
--- /dev/null
+++ b/chrome/test/data/webui/assertions.js
@@ -0,0 +1,61 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+function WebUIAssertionsTest() {}
+
+WebUIAssertionsTest.prototype = {
+ __proto__: testing.Test.prototype,
+ browsePreload: 'chrome://DummyURL',
+ typedefCppFixture: null,
+};
+
+GEN('#include "chrome/test/data//webui/assertions-inl.h"');
+GEN('');
+GEN('WebUIAssertionsTest::WebUIAssertionsTest() {}');
+GEN('WebUIAssertionsTest::~WebUIAssertionsTest() {}');
+GEN('MockWebUIProvider::MockWebUIProvider() {}');
+GEN('MockWebUIProvider::~MockWebUIProvider() {}');
+
+function testTwoExpects() {
+ expectTrue(false);
+ expectTrue(0);
+}
+
+TEST_F('WebUIAssertionsTest', 'testTwoExpects', function() {
+ var result = runTest(testTwoExpects, []);
+
+ expectFalse(result[0]);
+ expectTrue(!!result[1].match(/expectTrue\(false\): false/));
+ expectTrue(!!result[1].match(/expectTrue\(0\): 0/));
+});
+
+function twoExpects() {
+ expectTrue(false, 'message1');
+ expectTrue(false, 'message2');
+}
+
+function testCallTestTwice() {
+ twoExpects();
+ twoExpects();
+}
+
+TEST_F('WebUIAssertionsTest', 'testCallTestTwice', function() {
+ var result = runTest(testCallTestTwice, []);
+ expectFalse(result[0]);
+ expectEquals(2, result[1].match(
+ /expectTrue\(false, 'message1'\): message1: false/g).length);
+ expectEquals(2, result[1].match(
+ /expectTrue\(false, 'message2'\): message2: false/g).length);
+});
+
+function testConstructMessage() {
+ var message = 1 + ' ' + 2;
+ assertTrue(false, message);
+}
+
+TEST_F('WebUIAssertionsTest', 'testConstructedMessage', function() {
+ var result = runTest(testConstructMessage, []);
+ expectEquals(
+ 1, result[1].match(/assertTrue\(false, message\): 1 2: false/g).length);
+});
« no previous file with comments | « chrome/chrome_tests.gypi ('k') | chrome/test/data/webui/assertions-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698