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

Side by Side Diff: bower_components/web-animations-js/test/testcases/impl-test-deprecation.html

Issue 786953007: npm_modules: Fork bower_components into Polymer 0.4.0 and 0.5.0 versions (Closed) Base URL: https://chromium.googlesource.com/infra/third_party/npm_modules.git@master
Patch Set: Created 5 years, 11 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
(Empty)
1 <!--
2 Copyright 2014 Google Inc. All Rights Reserved.
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15 -->
16
17 <!DOCTYPE html><meta charset="UTF-8">
18 <script src="../bootstrap.js"></script>
19 <script>
20 "use strict";
21
22 var useAncient = function(deprecationDate) {
23 _WebAnimationsTestingUtilities._deprecated('Ancient', deprecationDate,
24 'Please use Modern instead.');
25 };
26
27 var useOld = function(deprecationDate) {
28 _WebAnimationsTestingUtilities._deprecated('Old', deprecationDate,
29 'Please use New instead.');
30 };
31
32 var useSuperseded = function(deprecationDate) {
33 _WebAnimationsTestingUtilities._deprecated('Superseded', deprecationDate,
34 'See Replacement.');
35 };
36
37 test(function() {
38 var deprecationDate = new Date();
39 deprecationDate.setDate(deprecationDate.getDate() - 85);
40 var cutoffDate = new Date(deprecationDate);
41 cutoffDate.setMonth(cutoffDate.getMonth() + 3); // 3 months grace period
42
43 var warnings = [];
44 var savedConsoleWarn = console.warn;
45 try {
46 console.warn = function(message) {
47 warnings.push(message);
48 };
49
50 var firstExpectedWarning = 'Web Animations: Old is deprecated and will stop working on ' + cutoffDate.toDateString() + '. Please use New instead.';
51 var secondExpectedWarning = 'Web Animations: Superseded is deprecated and wi ll stop working on ' + cutoffDate.toDateString() + '. See Replacement.';
52
53 useOld(deprecationDate);
54 assert_equals(warnings.length, 1);
55 assert_equals(warnings[0], firstExpectedWarning);
56
57 useOld(deprecationDate);
58 assert_equals(warnings.length, 1);
59
60 useSuperseded(deprecationDate);
61 assert_equals(warnings.length, 2);
62 assert_equals(warnings[1], secondExpectedWarning);
63
64 useSuperseded(deprecationDate);
65 assert_equals(warnings.length, 2);
66 } finally {
67 console.warn = savedConsoleWarn;
68 }
69 }, 'Warn the first time each recently deprecated feature is used');
70
71 test(function() {
72 var deprecationDate = new Date(new Date());
73 deprecationDate.setDate(deprecationDate.getDate() - 95);
74
75 for (var i = 0; i < 2; ++i) {
76 try {
77 useAncient();
78 assert_true(false);
79 } catch (e) {
80 assert_equals(e.message, 'Ancient is no longer supported. Please use Moder n instead.');
81 }
82 }
83 }, 'Throw each time an anciently deprecated feature is used');
84
85 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698