Chromium Code Reviews| 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..a0868a994d805cf4685a0c392f49b63a4340ecbe |
| --- /dev/null |
| +++ b/chrome/test/data/extensions/api_test/executescript/run_at/test.js |
| @@ -0,0 +1,30 @@ |
| +// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
|
Mihai Parparita -not on Chrome
2012/03/30 23:29:55
This should say 2012.
eaugusti
2012/04/10 02:26:21
Done.
|
| +// 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; |
|
Mihai Parparita -not on Chrome
2012/03/30 23:29:55
This appears to be unused.
eaugusti
2012/04/10 02:26:21
Done.
|
| + |
| +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; |
| + chrome.tabs.onUpdated.removeListener(arguments.callee); |
| + chrome.test.runTests([ |
| + function executeAtStartShouldSucceed() { |
| + var script_file = {}; |
|
Mihai Parparita -not on Chrome
2012/03/30 23:29:55
The JavaScript naming style uses camelCase.
Also,
eaugusti
2012/04/10 02:26:21
Done.
|
| + script_file.code = "document.title = 'Injected';"; |
| + script_file.runAt = "document_start"; |
| + chrome.tabs.executeScript(tabId, script_file, function() { |
| + chrome.tabs.get(tabId, chrome.test.callbackPass(function(tab) { |
| + chrome.test.assertEq('Injected', tab.title); |
| + })); |
| + }); |
| + }, |
| + ]); |
| + }); |
| + chrome.tabs.create({ url: testUrl }); |
| +}); |