diff options
Diffstat (limited to 'chrome/test/data')
6 files changed, 60 insertions, 4 deletions
diff --git a/chrome/test/data/extensions/api_test/content_script_all_frames/all_frames.js b/chrome/test/data/extensions/api_test/content_script_all_frames/all_frames.js new file mode 100644 index 0000000..71d22fd --- /dev/null +++ b/chrome/test/data/extensions/api_test/content_script_all_frames/all_frames.js @@ -0,0 +1 @@ +chrome.extension.sendRequest("all_frames"); diff --git a/chrome/test/data/extensions/api_test/content_script_all_frames/manifest.json b/chrome/test/data/extensions/api_test/content_script_all_frames/manifest.json new file mode 100644 index 0000000..0f73a8f --- /dev/null +++ b/chrome/test/data/extensions/api_test/content_script_all_frames/manifest.json @@ -0,0 +1,18 @@ +{ + "name": "content_script_all_frames", + "version": "1.0", + "description": "Tests the all_frames property of content script declarations.", + "background_page": "test.html", + "permissions": ["tabs"], + "content_scripts": [ + { + "matches": ["http://*/*"], + "js": ["top_frame_only.js"] + }, + { + "matches": ["http://*/*"], + "js": ["all_frames.js"], + "all_frames": true + } + ] +} diff --git a/chrome/test/data/extensions/api_test/content_script_all_frames/test.html b/chrome/test/data/extensions/api_test/content_script_all_frames/test.html new file mode 100644 index 0000000..e8f8088 --- /dev/null +++ b/chrome/test/data/extensions/api_test/content_script_all_frames/test.html @@ -0,0 +1,34 @@ +<script> +// We load a page that has one iframe +// So we should receive two "all_frames" messages, and one "top_frame_only" +// messages. + +var num_all_frames_messages = 0; +var num_top_frame_only_messages = 0; + +chrome.test.runTests([ + // Tests receiving a request from a content script and responding. + function onRequest() { + chrome.extension.onRequest.addListener( + function(request, sender, sendResponse) { + if (request == "all_frames") { + num_all_frames_messages++; + } else if (request == "top_frame_only") { + num_top_frame_only_messages++; + } else { + chrome.test.fail("Unexpected request: " + JSON.stringify(request)); + } + + if (num_all_frames_messages == 2 && num_top_frame_only_messages == 1) { + chrome.test.succeed(); + } + } + ); + } +]); + +chrome.test.log("Creating tab..."); +chrome.tabs.create({ + url: "http://localhost:1337/files/extensions/test_file_with_iframe.html" +}); +</script> diff --git a/chrome/test/data/extensions/api_test/content_script_all_frames/top_frame_only.js b/chrome/test/data/extensions/api_test/content_script_all_frames/top_frame_only.js new file mode 100644 index 0000000..76ad923 --- /dev/null +++ b/chrome/test/data/extensions/api_test/content_script_all_frames/top_frame_only.js @@ -0,0 +1 @@ +chrome.extension.sendRequest("top_frame_only"); diff --git a/chrome/test/data/extensions/subscribe_page_action/feed_finder.js b/chrome/test/data/extensions/subscribe_page_action/feed_finder.js index d5c4f2a..5261264 100644 --- a/chrome/test/data/extensions/subscribe_page_action/feed_finder.js +++ b/chrome/test/data/extensions/subscribe_page_action/feed_finder.js @@ -2,10 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -if (window == top) { - findFeeds(); - window.addEventListener("focus", findFeeds); -} +findFeeds(); +window.addEventListener("focus", findFeeds); function findFeeds() { // Find all the RSS link elements. diff --git a/chrome/test/data/extensions/test_file_with_iframe.html b/chrome/test/data/extensions/test_file_with_iframe.html new file mode 100644 index 0000000..8a310c7 --- /dev/null +++ b/chrome/test/data/extensions/test_file_with_iframe.html @@ -0,0 +1,4 @@ +<html>
+Test file!
+<iframe src="test_file.html"></iframe>
+</html>
|