1 // Copyright (c) 2013 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.
6 common.tester.addAsyncTest('get_url', function(test) {
7 test.log('Clicking the button');
8 document.getElementById('button').dispatchEvent(new MouseEvent('click'));
10 var outputEl = document.getElementById('output');
11 outputEl.textContent = '';
13 test.log('Waiting for the URL to load.');
14 var intervalId = window.setInterval(function() {
15 if (!outputEl.textContent)
18 window.clearInterval(intervalId);
19 test.log('Output box changed...');
20 var expectedMessage = 'part of the test output';
21 if (outputEl.textContent.indexOf(expectedMessage) === -1) {
22 test.fail('Expected to find "' + expectedMessage + '" in the output,' +
23 'instead got "' + outputEl.textContent + '"');
26 test.log('OK, found "' + expectedMessage + '".');