Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2980)

Unified Diff: chrome/test/data/extensions/api_test/executescript/run_at/test.js

Issue 9456037: Adding run_at to chrome.tabs.executeScript/insertCss. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/test/data/extensions/api_test/executescript/run_at/test.js
diff --git a/chrome/test/data/extensions/api_test/executescript/run_at/test.js b/chrome/test/data/extensions/api_test/executescript/run_at/test.js
new file mode 100644
index 0000000000000000000000000000000000000000..f04d70c1ffd632ca25d3849b9fc75dd94588c9f5
--- /dev/null
+++ b/chrome/test/data/extensions/api_test/executescript/run_at/test.js
@@ -0,0 +1,36 @@
+// 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.
+
+var relativePath =
+ '/files/extensions/api_test/executescript/run_at/test.html';
+var testUrl = 'http://b.com:PORT' + relativePath;
+var firstEnter = true;
+
+chrome.test.getConfig(function(config) {
+ testUrl = testUrl.replace(/PORT/, config.testServer.port);
+
+ chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) {
+ if (changeInfo.status != 'complete')
+ return;
+ if (!firstEnter) {
Aaron Boodman 2012/03/28 01:04:16 Here's a cool trick: chrome.tabs.onUpdated.remove
eaugusti 2012/03/28 17:40:19 That is pretty cool. Done.
+ return;
+ }
+ firstEnter = false;
+
+ chrome.test.runTests([
+
Aaron Boodman 2012/03/28 01:04:16 no need for linebreak here
eaugusti 2012/03/28 17:40:19 Done.
+ function executeAtStartShouldSucceed() {
+ var script_file = {};
+ script_file.code = "document.title = 'Injected';";
+ chrome.tabs.executeScript(tabId, script_file, function() {
Aaron Boodman 2012/03/28 01:04:16 This doesn't seem to test the new feature at all.
eaugusti 2012/03/28 17:40:19 Wow, I can't believe I forgot to include the featu
+ chrome.tabs.get(tabId, chrome.test.callbackPass(function(tab) {
+ chrome.test.assertEq('Injected', tab.title);
+ }));
+ });
+ },
+ ]);
+ });
+
+ chrome.tabs.create({ url: testUrl });
+});

Powered by Google App Engine
This is Rietveld 408576698