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

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: asdf 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 <script>
tommycli 2016/05/06 21:10:57 The html and body tags can be omitted? I noticed e
Dan Beam 2016/05/06 21:43:23 are you asking in the "will it pass an HTML valida
3
4 function setUpPage() {
5 loadTimeData.data = {
6 'allowedByDefault': '<a href="https://google.com">Google!</a>',
7 'customAttr': '<a is="action-link">Take action!</a>',
8 'customTag': "<x-foo>I'm an X, foo!</x-foo>",
9 'javascriptHref': '<a href="javascript:alert(1)">teh hax</a>',
10 'script': '<script>alert(/xss/)</scr' + 'ipt>',
11 'text': "I'm just text, nobody should have a problem with me!",
12 };
13 }
14
15 function testI18n() {
16 I18nBehavior.i18n('allowedByDefault');
17 I18nBehavior.i18n('text');
18
19 assertThrows(function() { I18nBehavior.i18n('customAttr'); });
20 assertThrows(function() { I18nBehavior.i18n('customTag'); });
21 assertThrows(function() { I18nBehavior.i18n('javascriptHref'); });
22 assertThrows(function() { I18nBehavior.i18n('script'); });
23 }
24
25 function testI18nAdvanced() {
26 I18nBehavior.i18nAdvanced('customAttr', {
27 attrs: {
28 is: function(el, val) {
29 return el.tagName == 'A' && val == 'action-link';
30 },
31 },
32 });
33 I18nBehavior.i18nAdvanced('customTag', {tags: ['X-FOO']});
34 }
35
36 </script>
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