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

Side by Side Diff: third_party/WebKit/LayoutTests/animations/interpolation/resources/interpolation-test.js

Issue 1363233003: Make sure <url>s are being serialized according to spec (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix interpolation tests Created 5 years, 2 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2015 Google Inc. All rights reserved. 2 * Copyright (C) 2015 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 replace(/\.\d+/, function(m) { 200 replace(/\.\d+/, function(m) {
201 return m.replace(/0+$/, ''); 201 return m.replace(/0+$/, '');
202 }). 202 }).
203 replace(/\.$/, ''). 203 replace(/\.$/, '').
204 replace(/^-0$/, '0'); 204 replace(/^-0$/, '0');
205 }); 205 });
206 } 206 }
207 207
208 var anchor = document.createElement('a'); 208 var anchor = document.createElement('a');
209 function sanitizeUrls(value) { 209 function sanitizeUrls(value) {
210 var matches = value.match(/url\([^\)]*\)/g); 210 var matches = value.match(/url\("([^\)]*)"\)/g);
211 if (matches !== null) { 211 if (matches !== null) {
212 for (var i = 0; i < matches.length; ++i) { 212 for (var i = 0; i < matches.length; ++i) {
213 var url = /url\(([^\)]*)\)/g.exec(matches[i])[1]; 213 var url = /url\("([^\)]*)"\)/g.exec(matches[i])[1];
214 anchor.href = url; 214 anchor.href = url;
215 anchor.pathname = '...' + anchor.pathname.substring(anchor.pathname.last IndexOf('/')); 215 anchor.pathname = '...' + anchor.pathname.substring(anchor.pathname.last IndexOf('/'));
216 value = value.replace(matches[i], 'url(' + anchor.href + ')'); 216 value = value.replace(matches[i], 'url(' + anchor.href + ')');
217 } 217 }
218 } 218 }
219 return value; 219 return value;
220 } 220 }
221 221
222 function normalizeValue(value) { 222 function normalizeValue(value) {
223 return roundNumbers(sanitizeUrls(value)). 223 return roundNumbers(sanitizeUrls(value)).
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 loadScript('../../resources/testharness.js').then(function() { 407 loadScript('../../resources/testharness.js').then(function() {
408 return loadScript('../../resources/testharnessreport.js'); 408 return loadScript('../../resources/testharnessreport.js');
409 }).then(function() { 409 }).then(function() {
410 var asyncHandle = async_test('This test uses interpolation-test.js.') 410 var asyncHandle = async_test('This test uses interpolation-test.js.')
411 requestAnimationFrame(function() { 411 requestAnimationFrame(function() {
412 runTests(); 412 runTests();
413 asyncHandle.done() 413 asyncHandle.done()
414 }); 414 });
415 }); 415 });
416 })(); 416 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698