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

Unified Diff: chrome/test/data/extensions/api_test/content_scripts/css_l10n/background.html

Issue 7552028: Injected CSS localization fix (see bug no.) (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Cleaned up old unused function. Created 9 years, 4 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/content_scripts/css_l10n/background.html
diff --git a/chrome/test/data/extensions/api_test/content_scripts/css_l10n/background.html b/chrome/test/data/extensions/api_test/content_scripts/css_l10n/background.html
new file mode 100644
index 0000000000000000000000000000000000000000..f907302efa82905d45307505ba5935aa4a9f19fd
--- /dev/null
+++ b/chrome/test/data/extensions/api_test/content_scripts/css_l10n/background.html
@@ -0,0 +1,74 @@
+<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)
+ 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() {
+ chrome.extension.onRequest.addListener(
+ function(request, sender, sendResponse) {
+ if (request.tag == 'extension_id') {
+ if (request.message == 'passed') {
+ chrome.test.succeed();
+ } else {
+ chrome.test.fail(request.message);
+ }
+ }
+ }
+ );
+ var script_file = {};
+ script_file.file = 'test_extension_id.js';
+ chrome.tabs.executeScript(tabId, script_file);
+ },
+
+ // First injects CSS into the page through chrome.tabs.insertCSS and then
+ // checks that it has had __MSG_text_color__ replaced with the correct
+ // message value.
+ function textDirectionMessageGetsReplacedInInsertCSSCall() {
+ chrome.extension.onRequest.addListener(
+ function(request, sender, sendResponse) {
+ if (request.tag == 'paragraph_style') {
+ if (request.message == 'passed') {
+ chrome.test.succeed();
+ } else {
+ chrome.test.fail(request.message);
+ }
+ }
+ }
+ );
+ var css_file = {};
+ css_file.file = 'test.css';
+ chrome.tabs.insertCSS(tabId, css_file, function() {
+ var script_file = {};
+ script_file.file = 'test_paragraph_style.js';
+ chrome.tabs.executeScript(tabId,script_file);
+ });
+ }
+
+ ]);
+ });
+
+ chrome.tabs.create({ url: TEST_FILE_URL });
+});
+
+</script>

Powered by Google App Engine
This is Rietveld 408576698