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

Side by Side Diff: Tools/GardeningServer/scripts/base_unittests.js

Issue 336033002: Cleanup some garden-o-matic cruft and dead code. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 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 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 document.body.appendChild(new LikeLikeProgress()); 307 document.body.appendChild(new LikeLikeProgress());
308 equals(document.body.lastChild.tagName, "PROGRESS"); 308 equals(document.body.lastChild.tagName, "PROGRESS");
309 // Safari 5.1 lacks the <progress> element. 309 // Safari 5.1 lacks the <progress> element.
310 // equals(document.body.lastChild.position, 0.1); 310 // equals(document.body.lastChild.position, 0.1);
311 document.body.lastChild.completed(); 311 document.body.lastChild.completed();
312 // Safari 5.1 lacks the <progress> element. 312 // Safari 5.1 lacks the <progress> element.
313 // equals(document.body.lastChild.position, 1); 313 // equals(document.body.lastChild.position, 1);
314 document.body.removeChild(document.body.lastChild); 314 document.body.removeChild(document.body.lastChild);
315 }); 315 });
316 316
317 test("relativizeTime", 14, function() {
318 var time = new Date();
319 equals(base.relativizeTime(time), "Just now");
320 time.setMinutes(time.getMinutes() - 1);
321 equals(base.relativizeTime(time), "1 minute ago");
322 time.setMinutes(time.getMinutes() - 1);
323 equals(base.relativizeTime(time), "2 minutes ago");
324 time.setMinutes(time.getMinutes() - 1);
325 equals(base.relativizeTime(time), "3 minutes ago");
326 time.setMinutes(time.getMinutes() - 56);
327 equals(base.relativizeTime(time), "59 minutes ago");
328 time.setMinutes(time.getMinutes() - 1);
329 equals(base.relativizeTime(time), "1 hour ago");
330 time.setMinutes(time.getMinutes() - 29);
331 equals(base.relativizeTime(time), "1 hour ago");
332 time.setMinutes(time.getMinutes() - 2);
333 equals(base.relativizeTime(time), "2 hours ago");
334 time.setMinutes(time.getMinutes() - 29);
335 equals(base.relativizeTime(time), "2 hours ago");
336 time.setHours(time.getHours() - 1);
337 equals(base.relativizeTime(time), "3 hours ago");
338 time.setHours(time.getHours() - 20);
339 equals(base.relativizeTime(time), "23 hours ago");
340 time.setHours(time.getHours() - 1);
341 equals(base.relativizeTime(time), "1 day ago");
342 time.setDate(time.getDate() - 1);
343 equals(base.relativizeTime(time), "2 days ago");
344 time.setDate(time.getDate() - 998);
345 equals(base.relativizeTime(time), "1000 days ago");
346 });
347
348 test("getURLParameter", 1, function() { 317 test("getURLParameter", 1, function() {
349 ok(!base.getURLParameter('non-existant')); 318 ok(!base.getURLParameter('non-existant'));
350 }); 319 });
351 320
352 test("parseJSONP", 6, function() { 321 test("parseJSONP", 6, function() {
353 deepEqual(base.parseJSONP(""), {}); 322 deepEqual(base.parseJSONP(""), {});
354 deepEqual(base.parseJSONP('p({"key": "value"})'), {"key": "value"}); 323 deepEqual(base.parseJSONP('p({"key": "value"})'), {"key": "value"});
355 deepEqual(base.parseJSONP('ADD_RESULTS({"dummy":"data"});'), {"dummy":"data" }); 324 deepEqual(base.parseJSONP('ADD_RESULTS({"dummy":"data"});'), {"dummy":"data" });
356 deepEqual(base.parseJSONP('{"dummy":"data"}'), {"dummy":"data"}); 325 deepEqual(base.parseJSONP('{"dummy":"data"}'), {"dummy":"data"});
357 deepEqual(base.parseJSONP('ADD_RESULTS({"builder(1)":"data"});'), {"builder( 1)":"data"}); 326 deepEqual(base.parseJSONP('ADD_RESULTS({"builder(1)":"data"});'), {"builder( 1)":"data"});
358 deepEqual(base.parseJSONP('{"builder(1)":"data"}'), {"builder(1)":"data"}); 327 deepEqual(base.parseJSONP('{"builder(1)":"data"}'), {"builder(1)":"data"});
359 }); 328 });
360 329
361 })(); 330 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698