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

Side by Side Diff: chrome/test/data/webui/i18n_behavior_test.html

Issue 1952253004: I18nBehavior: make i18nRaw private as raw_, add tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@i18n-behavior
Patch Set: . Created 4 years, 7 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
« no previous file with comments | « no previous file | chrome/test/data/webui/webui_resource_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!doctype html>
2 <html>
3 <body>
4 <script>
5
6 function setUpPage() {
7 loadTimeData.data = {
8 'allowedByDefault': '<a href="https://google.com">Google!</a>',
9 'customAttr': '<a is="action-link">Take action!</a>',
10 'customTag': "<x-foo>I'm an X, foo!</x-foo>",
11 'javascriptHref': '<a href="javascript:alert(1)">teh hax</a>',
12 'script': '<script>alert(/xss/)</scr' + 'ipt>',
13 'text': "I'm just text, nobody should have a problem with me!",
14 };
15 }
16
17 function testI18n() {
18 I18nBehavior.i18n('allowedByDefault');
19 I18nBehavior.i18n('text');
20
21 assertThrows(function() { I18nBehavior.i18n('customAttr'); });
22 assertThrows(function() { I18nBehavior.i18n('customTag'); });
23 assertThrows(function() { I18nBehavior.i18n('javascriptHref'); });
24 assertThrows(function() { I18nBehavior.i18n('script'); });
25 }
26
27 function testI18nAdvanced() {
28 I18nBehavior.i18nAdvanced('customAttr', {
29 attrs: {
30 is: function(el, val) {
31 return el.tagName == 'A' && val == 'action-link';
32 },
33 },
34 });
35 I18nBehavior.i18nAdvanced('customTag', {tags: ['X-FOO']});
36 }
37
38 </script>
39 </body>
40 </html>
OLDNEW
« no previous file with comments | « no previous file | chrome/test/data/webui/webui_resource_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698