Chromium Code Reviews| Index: chrome/test/data/extensions/api_test/css_l10n/background.html |
| diff --git a/chrome/test/data/extensions/api_test/css_l10n/background.html b/chrome/test/data/extensions/api_test/css_l10n/background.html |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..3a8a4efb661e14d30a1fb28f1ce7db859bde6c3a |
| --- /dev/null |
| +++ b/chrome/test/data/extensions/api_test/css_l10n/background.html |
| @@ -0,0 +1,60 @@ |
| +<script> |
| + |
| +var firstEnter = true; |
| + |
| +chrome.test.getConfig(function(config) { |
| + chrome.test.log('Creating tab...'); |
| + |
| + var URL = 'http://localhost:PORT/files/extensions/test_file_with_body.html'; |
| + var TEST_FILE_URL = URL.replace(/PORT/, config.testServer.port); |
| + |
| + chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) { |
| + if (changeInfo.status != 'complete') |
| + return; |
| + if ((!firstEnter)) |
|
Mihai Parparita -not on Chrome
2011/08/16 17:42:41
One too many parentheses here.
adriansc
2011/08/16 22:13:51
Done.
|
| + return; |
| + firstEnter = false; |
| + |
| + // We need to test two different paths, because the message bundles used |
| + // for localization are loaded differently in each case: |
| + // (1) localization upon loading extension scripts |
| + // (2) localization upon injecting CSS with JavaScript |
| + chrome.test.runTests([ |
| + |
| + // Tests that CSS loaded automatically from the files specified in the |
| + // manifest has had __MSG_@@extension_id__ replaced with the actual |
| + // extension id. |
| + function extensionIDMessageGetsReplacedInContentScriptCSS() { |
| + var script_file = {}; |
| + script_file.file = 'test_extension_id.js'; |
| + chrome.tabs.executeScript(tabId, script_file, function() { |
| + chrome.tabs.get(tabId, chrome.test.callbackPass(function(tab) { |
| + chrome.test.assertEq('passed', tab.title); |
| + })); |
| + }); |
| + }, |
| + |
| + // First injects CSS into the page through chrome.tabs.insertCSS and then |
| + // checks that it has had __MSG_@@bidi_dir__ replaced with the correct |
|
Nebojša Ćirić
2011/08/16 17:40:24
make sure you update the comment when you change t
adriansc
2011/08/16 22:13:51
Done.
|
| + // message value. |
| + function textDirectionMessageGetsReplacedInInsertCSSCall() { |
| + var css_file = {}; |
| + css_file.code = 'p {direction: __MSG_@@bidi_dir__;}'; |
| + chrome.tabs.insertCSS(tabId, css_file, function() { |
| + var script_file = {}; |
| + script_file.file = 'test_paragraph_dir_style.js'; |
| + chrome.tabs.executeScript(tabId,script_file, function() { |
| + chrome.tabs.get(tabId, chrome.test.callbackPass(function(tab) { |
| + chrome.test.assertEq('passed', tab.title); |
| + })); |
| + }); |
| + }); |
| + } |
| + |
| + ]); |
| + }); |
| + |
| + chrome.tabs.create({ url: TEST_FILE_URL }); |
| +}); |
| + |
| +</script> |