3
* Licensed to the Apache Software Foundation (ASF) under one
4
* or more contributor license agreements. See the NOTICE file
5
* distributed with this work for additional information
6
* regarding copyright ownership. The ASF licenses this file
7
* to you under the Apache License, Version 2.0 (the
8
* "License"); you may not use this file except in compliance
9
* with the License. You may obtain a copy of the License at
11
* http://www.apache.org/licenses/LICENSE-2.0
13
* Unless required by applicable law or agreed to in writing,
14
* software distributed under the License is distributed on an
15
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
* KIND, either express or implied. See the License for the
17
* specific language governing permissions and limitations
22
if (window.sessionStorage != null) {
23
window.sessionStorage.clear();
26
// Timeout is 2 seconds to allow physical devices enough
27
// time to query the response. This is important for some
29
var Tests = function() {};
30
Tests.TEST_TIMEOUT = 7500;
32
// Creates a spy that will fail if called.
33
function createDoNotCallSpy(name, opt_extraMessage) {
34
return jasmine.createSpy().andCallFake(function() {
35
var errorMessage = name + ' should not have been called.';
36
if (arguments.length) {
37
errorMessage += ' Got args: ' + JSON.stringify(arguments);
39
if (opt_extraMessage) {
40
errorMessage += '\n' + opt_extraMessage;
42
expect(false).toBe(true, errorMessage);
46
// Waits for any of the given spys to be called.
47
// Last param may be a custom timeout duration.
48
function waitsForAny() {
49
var spys = [].slice.call(arguments);
50
var timeout = Tests.TEST_TIMEOUT;
51
if (typeof spys[spys.length - 1] == 'number') {
55
for (var i = 0; i < spys.length; ++i) {
56
if (spys[i].wasCalled) {
61
}, "Expecting callbacks to be called.", timeout);