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

Side by Side Diff: chrome/test/data/extensions/api_test/content_scripts/css_l10n/background.js

Issue 8725019: Move another bunch of extension API tests to manifest_version 2. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 var firstEnter = true;
6
7 chrome.test.getConfig(function(config) {
8 chrome.test.log('Creating tab...');
9
10 var URL = 'http://localhost:PORT/files/extensions/test_file_with_body.html';
11 var TEST_FILE_URL = URL.replace(/PORT/, config.testServer.port);
12
13 chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) {
14 if (changeInfo.status != 'complete')
15 return;
16 if (!firstEnter)
17 return;
18 firstEnter = false;
19
20 // We need to test two different paths, because the message bundles used
21 // for localization are loaded differently in each case:
22 // (1) localization upon loading extension scripts
23 // (2) localization upon injecting CSS with JavaScript
24 chrome.test.runTests([
25
26 // Tests that CSS loaded automatically from the files specified in the
27 // manifest has had __MSG_@@extension_id__ replaced with the actual
28 // extension id.
29 function extensionIDMessageGetsReplacedInContentScriptCSS() {
30 chrome.extension.onRequest.addListener(
31 function(request, sender, sendResponse) {
32 if (request.tag == 'extension_id') {
33 if (request.message == 'passed') {
34 chrome.test.succeed();
35 } else {
36 chrome.test.fail(request.message);
37 }
38 }
39 }
40 );
41 var script_file = {};
42 script_file.file = 'test_extension_id.js';
43 chrome.tabs.executeScript(tabId, script_file);
44 },
45
46 // First injects CSS into the page through chrome.tabs.insertCSS and then
47 // checks that it has had __MSG_text_color__ replaced with the correct
48 // message value.
49 function textDirectionMessageGetsReplacedInInsertCSSCall() {
50 chrome.extension.onRequest.addListener(
51 function(request, sender, sendResponse) {
52 if (request.tag == 'paragraph_style') {
53 if (request.message == 'passed') {
54 chrome.test.succeed();
55 } else {
56 chrome.test.fail(request.message);
57 }
58 }
59 }
60 );
61 var css_file = {};
62 css_file.file = 'test.css';
63 chrome.tabs.insertCSS(tabId, css_file, function() {
64 var script_file = {};
65 script_file.file = 'test_paragraph_style.js';
66 chrome.tabs.executeScript(tabId,script_file);
67 });
68 }
69
70 ]);
71 });
72
73 chrome.tabs.create({ url: TEST_FILE_URL });
74 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698