diff options
author | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-07 10:26:31 +0000 |
---|---|---|
committer | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-07 10:26:31 +0000 |
commit | b9a622b9fe09868974a5af845bc474752b239566 (patch) | |
tree | 939d1e3947e35bbd960a925992bc7f049fe5775f /chrome/test/data | |
parent | 72cbd32707a2ede460bcc1b3cb199e653282a8ed (diff) | |
download | chromium_src-b9a622b9fe09868974a5af845bc474752b239566.zip chromium_src-b9a622b9fe09868974a5af845bc474752b239566.tar.gz chromium_src-b9a622b9fe09868974a5af845bc474752b239566.tar.bz2 |
Revert "Implement chromium.self in content scripts..."
This reverts commit 61ab30f52667e739602ab2af4fd8f2d8a0a2a2f0.
Still seeing memory errors.
Review URL: http://codereview.chromium.org/63056
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13243 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/data')
8 files changed, 0 insertions, 151 deletions
diff --git a/chrome/test/data/extensions/content_script_inject/js_test.js b/chrome/test/data/extensions/content_script_inject/js_test.js deleted file mode 100755 index 87a0930..0000000 --- a/chrome/test/data/extensions/content_script_inject/js_test.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) 2009 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. - -// A quick and dirty JavaScript test runner.
-
-function assert(truth) {
- if (!truth) {
- throw new Error('Assertion failed');
- }
-}
-
-function runAllTests() {
- // If there was already an error, do nothing. We don't want to muddy
- // up the results.
- if (document.title.indexOf("Error: ") == 0) {
- return;
- }
-
- for (var propName in window) {
- if (typeof window[propName] == "function" &&
- propName.indexOf("test") == 0) {
- try {
- window[propName]();
- document.title += propName + ",";
- } catch (e) {
- // We use document.title to communicate results back to the browser.
- document.title = "Error: " + propName + ': ' + e.message;
- return;
- }
- }
- }
-}
diff --git a/chrome/test/data/extensions/content_script_inject/manifest.json b/chrome/test/data/extensions/content_script_inject/manifest.json deleted file mode 100755 index 8214fb6..0000000 --- a/chrome/test/data/extensions/content_script_inject/manifest.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "id": "00123456789ABCDEF0123456789ABCDEF0123456", - "version": "1.0.0.0", - "name": "User script inject", - "content_scripts": [ - { - "matches": ["file://*/content_script_inject_page.html"], - "css": ["script1.css"], - "js": ["js_test.js", "script1a.js", "script1b.js"] - }, - { - "matches": ["file://*/content_script_inject_page.html"], - "js": ["js_test.js", "script2.js"] - }, - { - "matches": ["file://*/content_script_inject_page.html"], - "js": ["js_test.js", "script3.js"], - "run_at": "document_start" - } - ] -} diff --git a/chrome/test/data/extensions/content_script_inject/script1.css b/chrome/test/data/extensions/content_script_inject/script1.css deleted file mode 100644 index 521b501b..0000000 --- a/chrome/test/data/extensions/content_script_inject/script1.css +++ /dev/null @@ -1,10 +0,0 @@ -/* -Copyright (c) 2006-2009 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. -*/ - -/* script1b.js tests that this rule was applied. */ -body { - background:red; -} diff --git a/chrome/test/data/extensions/content_script_inject/script1a.js b/chrome/test/data/extensions/content_script_inject/script1a.js deleted file mode 100755 index 87f4f55..0000000 --- a/chrome/test/data/extensions/content_script_inject/script1a.js +++ /dev/null @@ -1,7 +0,0 @@ -// Copyright (c) 2009 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. - -// create a global variable. script1b.js tests to make sure it is visible and -// script2.js tests to make sure it is not. -var script1_var = 1; diff --git a/chrome/test/data/extensions/content_script_inject/script1b.js b/chrome/test/data/extensions/content_script_inject/script1b.js deleted file mode 100755 index 8e7e102..0000000 --- a/chrome/test/data/extensions/content_script_inject/script1b.js +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) 2009 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. - -// This tests that we are running in the same global context as script1a.js. -function testScriptFilesRunInSameContext() { - assert(script1_var === 1); -} - -// This tests that our relationship to content is working correctly. -// a) We should not see content globals in our global scope. -// b) We should have a contentWindow object that looks like a DOM Window. -// c) We should be able to access content globals via contentWindow. -function testContentInteraction() { - assert(typeof content_var == "undefined"); - assert(typeof contentWindow != "undefined"); - assert(contentWindow.location.href.match(/content_script_inject_page.html$/)); - assert(contentWindow.content_var == "hello"); -} - -// Test that our css in script1.css was injected successfully. -function testCSSWasInjected() { - assert(document.defaultView.getComputedStyle( - document.body, null)["background-color"] == "rgb(255, 0, 0)"); -} - -runAllTests(); diff --git a/chrome/test/data/extensions/content_script_inject/script2.js b/chrome/test/data/extensions/content_script_inject/script2.js deleted file mode 100755 index 9133afa2..0000000 --- a/chrome/test/data/extensions/content_script_inject/script2.js +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) 2009 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. - -// Tests that we cannot see global variables defined in other content scripts. -// This var was defined in script1a.js. We run each content script in a separate -// context, so we shouldn't see globals across them. -function testCannotSeeOtherContentScriptGlobals() {
- assert(typeof script1_var == "undefined");
-}
-
-runAllTests();
diff --git a/chrome/test/data/extensions/content_script_inject/script3.js b/chrome/test/data/extensions/content_script_inject/script3.js deleted file mode 100644 index 15bc225..0000000 --- a/chrome/test/data/extensions/content_script_inject/script3.js +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) 2009 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. - -var gotDOMContentLoadedEvent = false; - -// Test that at parse time, we have the document element. -// This basically tests that we don't get injected too early (before there is -// a document element). -var hasDocumentElement = (document.documentElement.tagName == "HTML"); - -// TODO(aa): We would like to add more tests here verifying that we aren't -// injected too late. For example, we could test that there are zero child -// nodes to the documentElement, but unfortunately run_at:document_start is -// currently buggy and doesn't guarantee that. - -window.addEventListener("DOMContentLoaded", function() { - gotDOMContentLoadedEvent = true; -}, false); - -// Don't run tests until onload so that we can test that DOMContentLoaded and -// onload happen after this script runs. -window.addEventListener("load", runAllTests, false); - -function testRunAtDocumentStart() { - assert(hasDocumentElement); -} - -function testGotLoadEvents() { - assert(gotDOMContentLoadedEvent); -} diff --git a/chrome/test/data/extensions/content_script_inject_page.html b/chrome/test/data/extensions/content_script_inject_page.html deleted file mode 100755 index 4412e19..0000000 --- a/chrome/test/data/extensions/content_script_inject_page.html +++ /dev/null @@ -1,10 +0,0 @@ -<html> -<head> -<title></title> -<script> -var content_var = "hello"; -</script> -</head> -<body> -</body> -</html> |