LEFT | RIGHT |
1 // Copyright (C) 2007 Google Inc. | 1 // Copyright (C) 2007 Google Inc. |
2 // Licensed under the Apache License, Version 2.0 (the "License"); | 2 // Licensed under the Apache License, Version 2.0 (the "License"); |
3 // you may not use this file except in compliance with the License. | 3 // you may not use this file except in compliance with the License. |
4 // You may obtain a copy of the License at | 4 // You may obtain a copy of the License at |
5 // | 5 // |
6 // http://www.apache.org/licenses/LICENSE-2.0 | 6 // http://www.apache.org/licenses/LICENSE-2.0 |
7 // | 7 // |
8 // Unless required by applicable law or agreed to in writing, software | 8 // Unless required by applicable law or agreed to in writing, software |
9 // distributed under the License is distributed on an "AS IS" BASIS, | 9 // distributed under the License is distributed on an "AS IS" BASIS, |
10 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 10 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 public void testMetaRefreshDisallowed() throws Exception { | 128 public void testMetaRefreshDisallowed() throws Exception { |
129 assertRewritesWithMessage( | 129 assertRewritesWithMessage( |
130 "<meta http-equiv=\"refresh\" content=\"5;http://foo.com\"/>", | 130 "<meta http-equiv=\"refresh\" content=\"5;http://foo.com\"/>", |
131 "removing disallowed tag meta", | 131 "removing disallowed tag meta", |
132 MessageLevel.WARNING, false /* should not fail */); | 132 MessageLevel.WARNING, false /* should not fail */); |
133 } | 133 } |
134 | 134 |
135 public void testStylesSanitized() throws Exception { | 135 public void testStylesSanitized() throws Exception { |
136 assertRewritesWithMessage( | 136 assertRewritesWithMessage( |
137 "<p style=\"color: expression(foo)\">Bar</p>", | 137 "<p style=\"color: expression(foo)\">Bar</p>", |
138 "css property color has bad value: ==>expression(foo)<==", | 138 "removing css property color with bad value: ==>expression(foo)<==", |
139 MessageLevel.ERROR, true /* should fail */); | 139 MessageLevel.WARNING, false /* should not fail */); |
140 } | 140 } |
141 | 141 |
142 public void testStylesInScript() throws Exception { | 142 public void testStylesInScript() throws Exception { |
143 // CSS template expansion works on style templates in extracted event | 143 // CSS template expansion works on style templates in extracted event |
144 // handlers and script tags. | 144 // handlers and script tags. |
145 // TODO(ihab.awad): Rewrite "golden" or turn into a functional test | 145 // TODO(ihab.awad): Rewrite "golden" or turn into a functional test |
146 if (false) { | 146 if (false) { |
147 assertRewriteMatches("example-dynamic-styles.xml", | 147 assertRewriteMatches("example-dynamic-styles.xml", |
148 "example-dynamic-styles-rewritten.xml", | 148 "example-dynamic-styles-rewritten.xml", |
149 MessageLevel.WARNING); | 149 MessageLevel.WARNING); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 fail(sb.toString().trim()); | 241 fail(sb.toString().trim()); |
242 } | 242 } |
243 } | 243 } |
244 | 244 |
245 private static final String normalizeIndentation(String xml) { | 245 private static final String normalizeIndentation(String xml) { |
246 return xml.replaceAll("\n +([?:.])", "$1") | 246 return xml.replaceAll("\n +([?:.])", "$1") |
247 .replaceAll("\\(\n +", "(") | 247 .replaceAll("\\(\n +", "(") |
248 .replaceAll("\n *", " "); | 248 .replaceAll("\n *", " "); |
249 } | 249 } |
250 } | 250 } |
LEFT | RIGHT |