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

Side by Side Diff: chrome/test/data/extensions/api_test/executescript/basic/test.html

Issue 7517001: Switch from WebDocument::insertStyleText to ::insertUserStyleSheet for programatic CSS injection. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebaseline 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 <script> 1 <script>
2 2
3 var pass = chrome.test.callbackPass; 3 var pass = chrome.test.callbackPass;
4 var fail = chrome.test.callbackFail; 4 var fail = chrome.test.callbackFail;
5 var assertEq = chrome.test.assertEq; 5 var assertEq = chrome.test.assertEq;
6 var assertTrue = chrome.test.assertTrue; 6 var assertTrue = chrome.test.assertTrue;
7 var relativePath = 7 var relativePath =
8 '/files/extensions/api_test/executescript/basic/test_executescript.html'; 8 '/files/extensions/api_test/executescript/basic/test_executescript.html';
9 var testUrl = 'http://a.com:PORT' + relativePath; 9 var testUrl = 'http://a.com:PORT' + relativePath;
10 var testFailureUrl = 'http://b.com:PORT' + relativePath; 10 var testFailureUrl = 'http://b.com:PORT' + relativePath;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 var script_file = {}; 65 var script_file = {};
66 script_file.file = 'script2.js'; 66 script_file.file = 'script2.js';
67 chrome.tabs.executeScript(tabId, script_file, function() { 67 chrome.tabs.executeScript(tabId, script_file, function() {
68 chrome.tabs.get(tabId, pass(function(tab) { 68 chrome.tabs.get(tabId, pass(function(tab) {
69 assertEq(tab.title, 'block'); 69 assertEq(tab.title, 'block');
70 })); 70 }));
71 }); 71 });
72 }); 72 });
73 }, 73 },
74 74
75 function insertCSSTextShouldNotAffectDOM() {
76 chrome.tabs.insertCSS(tabId, {code: 'p {display: none}'}, function() {
77 chrome.tabs.executeScript(
78 tabId,
79 {code: 'document.title = document.styleSheets.length'},
80 function() {
81 chrome.tabs.get(tabId, pass(function(tab) {
82 assertEq(tab.title, '0');
83 }));
84 });
85 });
86 },
87
75 function executeJavaScriptCodeShouldFail() { 88 function executeJavaScriptCodeShouldFail() {
76 chrome.tabs.update(tabId, { url: testFailureUrl }, function() { 89 chrome.tabs.update(tabId, { url: testFailureUrl }, function() {
77 var script_file = {}; 90 var script_file = {};
78 script_file.code = "document.title = 'executeScript';"; 91 script_file.code = "document.title = 'executeScript';";
79 chrome.tabs.executeScript(tabId, script_file, fail( 92 chrome.tabs.executeScript(tabId, script_file, fail(
80 'Cannot access contents of url "' + testFailureUrl + 93 'Cannot access contents of url "' + testFailureUrl +
81 '". Extension manifest must request permission to access this ' + 94 '". Extension manifest must request permission to access this ' +
82 'host.')); 95 'host.'));
83 }); 96 });
84 }, 97 },
(...skipping 12 matching lines...) Expand all
97 'Code and file should not be specified ' + 110 'Code and file should not be specified ' +
98 'at the same time in the second argument.')); 111 'at the same time in the second argument.'));
99 } 112 }
100 ]); 113 ]);
101 }); 114 });
102 115
103 chrome.tabs.create({ url: testUrl }); 116 chrome.tabs.create({ url: testUrl });
104 }); 117 });
105 118
106 </script> 119 </script>
OLDNEW
« no previous file with comments | « chrome/renderer/extensions/user_script_idle_scheduler.cc ('k') | content/common/view_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698