blob: 1c8c973efe6e8224cfb19fb04eab78f19dcc0c5e [file] [log] [blame]
<!DOCTYPE html>
<!--
Copyright 2011 Software Freedom Conservancy. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<html>
<head>
<title>asserts_test.html</title>
<script src="../test_bootstrap.js"></script>
<script>
goog.require('goog.testing.jsunit');
goog.require('webdriver.test.testutil');
goog.require('webdriver.testing.asserts');
</script>
<script>
var result;
function setUp() {
result = webdriver.test.testutil.callbackPair();
}
function tearDown() {
}
function testApplyMatcher_nonPromiseValue_valueMatches() {
webdriver.testing.asserts.applyMatcher('foo', equals('foo')).
then(result.callback, result.errback);
result.assertCallback();
}
function testApplyMatcher_nonPromiseValue_notValueMatches() {
webdriver.testing.asserts.applyMatcher('foo', equals('bar')).
then(result.callback, result.errback);
result.assertErrback();
}
function testApplyMatcher_promiseValue_valueMatches() {
var d = new webdriver.promise.Deferred();
webdriver.testing.asserts.applyMatcher(d, equals('foo')).
then(result.callback, result.errback);
result.assertNeither();
d.resolve('foo');
result.assertCallback();
}
function testApplyMatcher_promiseValue_notValueMatches() {
var d = new webdriver.promise.Deferred();
webdriver.testing.asserts.applyMatcher(d, equals('foo')).
then(result.callback, result.errback);
result.assertNeither();
d.resolve('bar');
result.assertErrback();
}
function testApplyMatcher_promiseValue_promiseRejected() {
var d = new webdriver.promise.Deferred();
webdriver.testing.asserts.applyMatcher(d, equals('foo')).
then(result.callback, result.errback);
result.assertNeither();
d.reject();
result.assertErrback();
}
</script>
</head>
</html>