Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <script> | |
| 2 | |
| 3 var firstEnter = true; | |
| 4 | |
| 5 chrome.test.getConfig(function(config) { | |
| 6 chrome.test.log('Creating tab...'); | |
| 7 | |
| 8 var URL = 'http://localhost:PORT/files/extensions/test_file_with_body.html'; | |
| 9 var TEST_FILE_URL = URL.replace(/PORT/, config.testServer.port); | |
| 10 | |
| 11 chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) { | |
| 12 if (changeInfo.status != 'complete') | |
| 13 return; | |
| 14 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.
| |
| 15 return; | |
| 16 firstEnter = false; | |
| 17 | |
| 18 // We need to test two different paths, because the message bundles used | |
| 19 // for localization are loaded differently in each case: | |
| 20 // (1) localization upon loading extension scripts | |
| 21 // (2) localization upon injecting CSS with JavaScript | |
| 22 chrome.test.runTests([ | |
| 23 | |
| 24 // Tests that CSS loaded automatically from the files specified in the | |
| 25 // manifest has had __MSG_@@extension_id__ replaced with the actual | |
| 26 // extension id. | |
| 27 function extensionIDMessageGetsReplacedInContentScriptCSS() { | |
| 28 var script_file = {}; | |
| 29 script_file.file = 'test_extension_id.js'; | |
| 30 chrome.tabs.executeScript(tabId, script_file, function() { | |
| 31 chrome.tabs.get(tabId, chrome.test.callbackPass(function(tab) { | |
| 32 chrome.test.assertEq('passed', tab.title); | |
| 33 })); | |
| 34 }); | |
| 35 }, | |
| 36 | |
| 37 // First injects CSS into the page through chrome.tabs.insertCSS and then | |
| 38 // 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.
| |
| 39 // message value. | |
| 40 function textDirectionMessageGetsReplacedInInsertCSSCall() { | |
| 41 var css_file = {}; | |
| 42 css_file.code = 'p {direction: __MSG_@@bidi_dir__;}'; | |
| 43 chrome.tabs.insertCSS(tabId, css_file, function() { | |
| 44 var script_file = {}; | |
| 45 script_file.file = 'test_paragraph_dir_style.js'; | |
| 46 chrome.tabs.executeScript(tabId,script_file, function() { | |
| 47 chrome.tabs.get(tabId, chrome.test.callbackPass(function(tab) { | |
| 48 chrome.test.assertEq('passed', tab.title); | |
| 49 })); | |
| 50 }); | |
| 51 }); | |
| 52 } | |
| 53 | |
| 54 ]); | |
| 55 }); | |
| 56 | |
| 57 chrome.tabs.create({ url: TEST_FILE_URL }); | |
| 58 }); | |
| 59 | |
| 60 </script> | |
| OLD | NEW |