blob: 1c6a267317fd42d5ac29b3641cf425e341b0775b [file] [log] [blame]
// Copyright 2017 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.
(async function() {
TestRunner.addResult(`Tests that console's copy command is copying into front-end buffer.\n`);
await TestRunner.loadModule('console_test_runner');
await TestRunner.showPanel('console');
var results = [];
var testCases = [
"copy('qwerty')",
"copy(document.querySelector('p'))",
"copy({foo:'bar'})",
'var a = {}; a.b = a; copy(a)',
'copy(NaN)',
'copy(Infinity)',
'copy(null)',
'copy(undefined)',
'copy(1)',
'copy(true)',
'copy(false)',
'copy(null)'
];
function copyText(text) {
results.push(text);
if (results.length === testCases.length) {
results.sort();
for (var result of results) TestRunner.addResult('InspectorFrontendHost.copyText: ' + result);
TestRunner.completeTest();
}
}
InspectorFrontendHost.copyText = copyText;
for (var i = 0; i < testCases.length; ++i) TestRunner.RuntimeAgent.evaluate(testCases[i], '', true);
})();