| Index: chrome/test/data/extensions/api_test/executescript/basic/test.html
|
| ===================================================================
|
| --- chrome/test/data/extensions/api_test/executescript/basic/test.html (revision 112170)
|
| +++ chrome/test/data/extensions/api_test/executescript/basic/test.html (working copy)
|
| @@ -1,119 +1,6 @@
|
| -<script>
|
| -
|
| -var pass = chrome.test.callbackPass;
|
| -var fail = chrome.test.callbackFail;
|
| -var assertEq = chrome.test.assertEq;
|
| -var assertTrue = chrome.test.assertTrue;
|
| -var relativePath =
|
| - '/files/extensions/api_test/executescript/basic/test_executescript.html';
|
| -var testUrl = 'http://a.com:PORT' + relativePath;
|
| -var testFailureUrl = 'http://b.com:PORT' + relativePath;
|
| -var firstEnter = true;
|
| -
|
| -chrome.test.getConfig(function(config) {
|
| - testUrl = testUrl.replace(/PORT/, config.testServer.port);
|
| - testFailureUrl = testFailureUrl.replace(/PORT/, config.testServer.port);
|
| -
|
| - chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) {
|
| - if (changeInfo.status != 'complete')
|
| - return;
|
| - if (!firstEnter) {
|
| - return;
|
| - }
|
| - firstEnter = false;
|
| -
|
| - chrome.test.runTests([
|
| -
|
| - function executeJavaScriptCodeShouldSucceed() {
|
| - var script_file = {};
|
| - script_file.code = "document.title = 'executeScript';";
|
| - chrome.tabs.executeScript(tabId, script_file, function() {
|
| - chrome.tabs.get(tabId, pass(function(tab) {
|
| - assertEq('executeScript', tab.title);
|
| - }));
|
| - });
|
| - },
|
| -
|
| - function executeJavaScriptFileShouldSucceed() {
|
| - var script_file = {};
|
| - script_file.file = 'script1.js';
|
| - chrome.tabs.executeScript(tabId, script_file, function() {
|
| - chrome.tabs.get(tabId, pass(function(tab) {
|
| - assertEq('executeScript1', tab.title);
|
| - }));
|
| - });
|
| - },
|
| -
|
| - function insertCSSTextShouldSucceed() {
|
| - var css_file = {};
|
| - css_file.code = "p {display:none;}";
|
| - chrome.tabs.insertCSS(tabId, css_file, function() {
|
| - var script_file = {};
|
| - script_file.file = 'script3.js';
|
| - chrome.tabs.executeScript(tabId, script_file, function() {
|
| - chrome.tabs.get(tabId, pass(function(tab) {
|
| - assertEq('none', tab.title);
|
| - }));
|
| - });
|
| - });
|
| - },
|
| -
|
| - function insertCSSFileShouldSucceed() {
|
| - var css_file = {};
|
| - css_file.file = '1.css';
|
| - chrome.tabs.insertCSS(tabId, css_file, function() {
|
| - var script_file = {};
|
| - script_file.file = 'script2.js';
|
| - chrome.tabs.executeScript(tabId, script_file, function() {
|
| - chrome.tabs.get(tabId, pass(function(tab) {
|
| - assertEq('block', tab.title);
|
| - }));
|
| - });
|
| - });
|
| - },
|
| -
|
| - function insertCSSTextShouldNotAffectDOM() {
|
| - chrome.tabs.insertCSS(tabId, {code: 'p {display: none}'}, function() {
|
| - chrome.tabs.executeScript(
|
| - tabId,
|
| - {code: 'document.title = document.styleSheets.length'},
|
| - function() {
|
| - chrome.tabs.get(tabId, pass(function(tab) {
|
| - assertEq('0', tab.title);
|
| - }));
|
| - });
|
| - });
|
| - },
|
| -
|
| - function executeJavaScriptCodeShouldFail() {
|
| - chrome.tabs.update(tabId, { url: testFailureUrl }, function() {
|
| - var script_file = {};
|
| - script_file.code = "document.title = 'executeScript';";
|
| - chrome.tabs.executeScript(tabId, script_file, fail(
|
| - 'Cannot access contents of url "' + testFailureUrl +
|
| - '". Extension manifest must request permission to access this ' +
|
| - 'host.'));
|
| - });
|
| - },
|
| -
|
| - function executeJavaScriptWithNoneValueShouldFail() {
|
| - var script_file = {};
|
| - chrome.tabs.executeScript(tabId, script_file, fail(
|
| - 'No source code or file specified.'));
|
| - },
|
| -
|
| - function executeJavaScriptWithTwoValuesShouldFail() {
|
| - var script_file = {};
|
| - script_file.file = 'script1.js';
|
| - script_file.code = 'var test = 1;';
|
| - chrome.tabs.executeScript(tabId, script_file, fail(
|
| - 'Code and file should not be specified ' +
|
| - 'at the same time in the second argument.'));
|
| - }
|
| - ]);
|
| - });
|
| -
|
| - chrome.tabs.create({ url: testUrl });
|
| -});
|
| -
|
| -</script>
|
| +<!--
|
| + * 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.
|
| +-->
|
| +<script src="test.js"></script>
|
|
|